GeKirAh
Banned User
Hey guys!
I'm relatively new to the scripting world, but have been able to make fair progress so far..
Anyways this new item I'm trying to make, changing enchanted gems into teleport gems (to take you to important towns etc). They were working fine, however when I tried to incorporate a timing method into it (from a tutorial created by Colandus), I can't seem to get it to work.
Without further ado, heres my script as it is
Code:
If anyone could point out the errors I've made, I would very much appreciate it, thanks in advance!
If this doesnt work modify to it:
Credits: Jakahu
I'm relatively new to the scripting world, but have been able to make fair progress so far..
Anyways this new item I'm trying to make, changing enchanted gems into teleport gems (to take you to important towns etc). They were working fine, however when I tried to incorporate a timing method into it (from a tutorial created by Colandus), I can't seem to get it to work.
Without further ado, heres my script as it is
Code:
The idea is that you use the gem once, it removes the gem, teleports you to the target location. Then when you try to use the gem again, it checks the timing and either a) teleports you again or b) sends you the cancel message.function onUse(cid, item, fromPosition, itemEx, toPosition)
local compareTime = 1 * 60
local targetPlace= {x=159, y=387, z=7}
local currentValue = getPlayerStorageValue(cid, 23232)
if currentValue == -1 then
currentValue = os.time()
end
if (os.time() - currentValue) >= compareTime then
doTeleportThing(cid,targetPlace)
doSendMagicEffect(targetPlace,12)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,22,"You have teleported to Al Kahad.")
setPlayerStorageValue(cid, 23232, os.time())
else
doPlayerSendCancel(cid, "You can only use this item once every one minute.")
end
end
If anyone could point out the errors I've made, I would very much appreciate it, thanks in advance!
If this doesnt work modify to it:
if currentValue == -1 then
setPlayerStorageValue(cid, 23232, 60)
end
Credits: Jakahu