• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Teleport Gem With Exausted!!!

GeKirAh

Banned User
Joined
Feb 14, 2009
Messages
163
Reaction score
0
Location
Brazil !!!
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:
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
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.

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
 
Back
Top