juansanchez
Intermediate OT User
- Joined
- Apr 2, 2015
- Messages
- 217
- Reaction score
- 129
Hey everyone, i'm trying to learn how to script myself so i don't have to always ask for a new script when i need one.
So today i was working on this script that is supposed to:
-Check player level or reset.
-Check if the player has used the "lever" before the time.
-Check if there's a player inside the arena already.
If all the requirements are met, the player should teleport inside the arena, a boss should Spawn, and the player should recive a storage so can't use the lever again in X amount of time.
Everything is working fine, except the Storage. I can't seem to give the player a storage so he can't use the lever again, and i couldn't figure out what i did wrong. If anyone can help me i would appreciate it.
I'm using TFS 0.3.7
So today i was working on this script that is supposed to:
-Check player level or reset.
-Check if the player has used the "lever" before the time.
-Check if there's a player inside the arena already.
If all the requirements are met, the player should teleport inside the arena, a boss should Spawn, and the player should recive a storage so can't use the lever again in X amount of time.
Everything is working fine, except the Storage. I can't seem to give the player a storage so he can't use the lever again, and i couldn't figure out what i did wrong. If anyone can help me i would appreciate it.
I'm using TFS 0.3.7
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local from, to = {x = 608, y = 172, z = 8}, {x = 621, y = 181, z = 8}
local newPos = {x = 614, y = 177, z = 8}
local time = 20
local reset = 50
local storage = 10123
if getPlayerReset(cid) < reset then
return doPlayerSendTextMessage(cid,20, 'Voce precisa de '.. reset ..' resets ou mais.') -- Checks if the player has level to use the lever.
elseif (exhaustion.check(cid, storage) == TRUE) then
doPlayerSendTextMessage(cid,20, 'Voce precisa esperar pra puxar a alavanca.') -- Checks if the player has already used the lever.
return false
else
for x = from.x, to.x do
for y = from.y, to.y do
local creature = getTopCreature({x = x, y = y, z = from.z})
if isPlayer(creature.uid) and creature.uid ~= 0 then
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid,20,"Ja existe um jogador dentro da quest. Aguarde sua vez.") -- Checks if there is someone inside already.
return true
end
end
end
doTeleportThing(cid, newPos)
exhaustion.set(cid, storage, time)
doSummonCreature("Deus", {x=614, y=178, z=8})
return true
end
end