is possible convert this script for tfs 1.2 ?
someone help me please
original script by @narko
https://otland.net/threads/antytrap-tile.146887/#post-1413006
someone help me please
local session, events =
15 * 60, {}
function train(cid, time)
local player = Player(cid)
if isPlayer(cid) then
if os.time() - time >= session then
events[player:getGuid()] = nil
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -25105, -50250, CONST_ME_NONE)
doTeleportThing(cid, getPlayerMasterPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your trap tile has been expire. Thanks for playing Global-War.")
else
events[player:getGuid()] = addEvent(train, 6000, cid, time)
local v = player:getPosition(cid)
player:say('Trap Tile!', TALKTYPE_MONSTER_SAY)
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -3105, -3250, CONST_ME_NONE)
doSendMagicEffect(v, CONST_ME_MAGIC_GREEN)
end
end
end
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
train(cid, os.time())
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Warning!You are in trap tile.")
end
end
function onStepOut(cid, item, position, fromPosition)
if isPlayer(cid) then
local v = getPlayerGUID(cid)
if v then
stopEvent(events[v])
events[v] = nil
end
end
end
15 * 60, {}
function train(cid, time)
local player = Player(cid)
if isPlayer(cid) then
if os.time() - time >= session then
events[player:getGuid()] = nil
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -25105, -50250, CONST_ME_NONE)
doTeleportThing(cid, getPlayerMasterPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your trap tile has been expire. Thanks for playing Global-War.")
else
events[player:getGuid()] = addEvent(train, 6000, cid, time)
local v = player:getPosition(cid)
player:say('Trap Tile!', TALKTYPE_MONSTER_SAY)
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -3105, -3250, CONST_ME_NONE)
doSendMagicEffect(v, CONST_ME_MAGIC_GREEN)
end
end
end
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
train(cid, os.time())
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Warning!You are in trap tile.")
end
end
function onStepOut(cid, item, position, fromPosition)
if isPlayer(cid) then
local v = getPlayerGUID(cid)
if v then
stopEvent(events[v])
events[v] = nil
end
end
end
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/traptile.lua
nStepIn
luaAddEvent(). Argument #3 is unsafe
stack traceback:
[C]: in function 'addEvent'
data/movements/scripts/traptile.lua:13: in function 'train'
data/movements/scripts/traptile.lua:24: in function <data/movements/scripts/traptile.lua:22>
data/movements/scripts/traptile.lua
luaAddEvent(). Argument #3 is unsafe
stack traceback:
[C]: in function 'addEvent'
data/movements/scripts/traptile.lua:13: in function 'train'
data/movements/scripts/traptile.lua:24: in function <data/movements/scripts/traptile.lua:22>
original script by @narko
https://otland.net/threads/antytrap-tile.146887/#post-1413006