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

[Request] addEvent with PlayerStorage.

Decent60

My peanut
Joined
Feb 28, 2008
Messages
99
Reaction score
0
I was trying to do a quest where I could use a lever once per 24 hours, using the getPlayerStorage command but I kinda ran into a problem with it, I got so far as the lever will stop after the first pulled but I can't figure out how to make it work after 24 hours have passed, this is what I have so far:

Code:
if item.uid == [Your Unique ID here] then
        if getPlayerStorageValue(cid,1234561) == -1 then
            setPlayerStorageValue(cid,1234561,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Your Congraz Words here.')
addEvent(onTime,1440*60*1000,a)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Your Denial Words Here.')
        end

Would placing this after that in the same lua make it work?
Code:
function onTime(a)
 setPlayerStorageValue(cid,1234561,-1)
[end]

So it would look like this:
Code:
if item.uid == [Your Unique ID here] then
        if getPlayerStorageValue(cid,1234561) == -1 then
            setPlayerStorageValue(cid,1234561,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Your Congraz Words here.')
addEvent(onTime,1440*60*1000,a)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Your Denial Words Here.')
        end  
function onTime(a)
 setPlayerStorageValue(cid,1234561,-1)
[end]
I don't have it set up completely on my server yet so I haven't tested this, I just wondered if that would make it work.

[Edit]
Actually I know I should have wrote [Help] instead of [Request], slight problem of waking up and trying to think xD
 
Last edited:
Code:
if item.uid == [Your Unique ID here] then
        if getPlayerStorageValue(cid,1234561) == -1 then
            setPlayerStorageValue(cid,1234561,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Your Congraz Words here.')
addEvent(onTime,1440*60*1000,a)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Your Denial Words Here.')
        end

a = { cid = cid }

function onTime(a)
doSetPlayerStorageValue(a.cid, 1234561, -1)
end
 
Back
Top