• 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!

Add storage for 24h

shor

New Member
Joined
Jan 2, 2011
Messages
137
Reaction score
0
Location
Poland
Is it possible to add storage which will dissapear (or change from value 1 to 0) after 24h?

For example:
I add storage x, value 1 and after 24h it will be changed to storage x, value 0?



It can be used to access teleport 1 time per day for example.

Can anyone help me? Rep ;)
 
you can make something like this:

-- movement --

<movevent type="StepIn" actionid="12" event="script" value="example.lua"/>

-- script example.lua

function onStepIn(cid, item, frompos, item2, topos)

local timeToPass = 24 * 60 * 60 -- this mean 24 sec * 60 means minutes * 60 means hours
local storage = 12 -- or whatever storage you want
local destination = {x=x,y=y,z=z} -- put the destination what you want

if(not isPlayer(cid))then
return false
end


if(getPlayerStorageValue(cid, storage) < 0)then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Welcome!')
doTelepotThing(cid, destination)
doPlayerSetStorageValue(cid, storage, os.time())

elseif(os.time() - getPlayerStorageValue(cid, storage) >= timeToPass and item.actionid == 12)then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Welcome!')
doTelepotThing(cid, destination)
doPlayerSetStorageValue(cid, storage, os.time())

elseif(getPlayerStorageValue(cid, storage) > 0 and os.time() - getPlayerStorageValue(cid, storage) <= timeToPass and item.actionid == 12)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You need to wait 24 hours to pass again!')
end

return true
end
-- Movement --

i hope it works 4 u
 
Last edited:
Back
Top