this is for 8.54-8.57 ~was working fine on 0.4_DEV rev 3942 now i am using 0.4_DEV rev 3952~ 8.62 and it crashes ot... can someone fix it plx?
TY I REP++ OFC!
LUA:
local cfg = {
time = 5, -- Time the teleport is open.
exhausted = 60, -- Time you are exhausted.
storage = 1337, -- Storage used for "exhaust."
to = { x = 133, y = 113, z = 7 } -- Where the teleport takes you.
};
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, cfg.storage) > os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. getPlayerStorageValue(cid, cfg.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, cfg.storage) - os.time()) == 1 and "" or "s") .. " to create another teleport.")
elseif(getTilePzInfo(getCreaturePosition(cid)) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You cannot create a teleport in a protection zone.")
elseif(getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You may not create a teleport while fighting.")
elseif(hasProperty(getThingFromPos(toPosition).uid, CONST_PROP_BLOCKSOLID) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You cannot create a teleport here.")
else
function deleteTeleport()
local check = getThingfromPos(toPosition,false)
doRemoveItem(check.uid,1)
doSendAnimatedText(toPosition, "CLOSED", 180)
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
for x = 1, cfg.time do
local n = cfg.time - x
addEvent(doSendAnimatedText, x * 1000, toPosition, n > 0 and tostring(n), TEXTCOLOR_WHITE)
end
doCreateTeleport(1387, cfg.to, toPosition)
doSendMagicEffect(toPosition, CONST_ME_ENERGYAREA)
addEvent(deleteTeleport, cfg.time * 1000)
setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhausted)
end
return true
end