Shadow Dan
Sh4dowDan
Here is final script fully working and calculated.
Script made by RazorBlade, thank you.
To make exhaust working you need this:
talkactions/lib/talkactions.lua
talkactions/talkactions.xml
talkactions/scripts/exit.lua
creaturescripts/creaturescripts.xml
creaturescripts/scripts/tptimer.lua
Script made by RazorBlade, thank you.
To make exhaust working you need this:
talkactions/lib/talkactions.lua
Code:
function checkExhausted(cid, storage, seconds)
local v = exhaustion.get(cid, storage)
if(not v) then
exhaustion.set(cid, storage, seconds)
else
doPlayerSendCancel(cid, "Please wait " .. v .. " seconds before use that command again.")
return false
end
return true
end
talkactions/talkactions.xml
Code:
<talkaction words="!exit" separator=" " script="exit.lua"/>
Code:
--script made by RazorBlade // otland.net
function onSay(player, words, param)
if(not checkExhausted(player, 777, 70)) then
return false
end
local time = 60 -- time before teleport
if not player:getCondition(CONDITION_INFIGHT) then
player:registerEvent("tpTimer")
player:setStorageValue(10, os.time() + time)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You will be teleported in " .. time .. " seconds unless you enter battle.")
return false
else
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You cannot teleport while in battle!")
return false
end
return true
end
Code:
<event type="think" name="tpTimer" script="others/tptimer.lua" />
Code:
--script made by RazorBlade // otland.net
function onThink(creature, interval)
local player = Player(creature)
if not Player(player) then
return creature:unregisterEvent("tpTimer")
end
if player:getCondition(CONDITION_INFIGHT) then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You are in combat! Teleport failed.")
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You can't teleport while in combat.")
return player:unregisterEvent("tpTimer")
end
if player:getStorageValue(10) < os.time() then
player:setStorageValue(10, -1)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:teleportTo(player:getTown():getTemplePosition())
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return player:unregisterEvent("tpTimer")
end
local remaining = math.ceil(player:getStorageValue(10) - os.time())
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Time before teleport: "..remaining..".")
return true
end
Last edited: