• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Just a little fast help

Guiaki

Member
Joined
Jan 3, 2011
Messages
137
Reaction score
8
Hey, I wanted to make a script that will give you points daily, which function can I use? that when a player log in 24hours after he received the first points of that day he earns more points, or every midnight everyone is credited 15 points dunno, how can i do it? please I need it the faster the best! i'll rep++

I was thinking in something like this:

Code:
local points = getPlayerStorageValue(cid, 880010)

function onMidnight(cid)
    if os.date("%X") == "00:00:00" then
        for i,1 #db.execute ("SELECT * FROM TABLE PLAYERS WHERE ID MAX") do // I DON't know how to make scripts in MySQL
            if points <= 15 then
                setPlayerStorageValue(cid, 880010, 15)
            end
        end
    end
end
 
Last edited by a moderator:
Please don't double post

@Topic
try this :)

Code:
local lastPointAwardedStorage = 6000
local pointsStorage = 6001
local timeBetweenPoints = (24 * 60 * 60)

function onLogin(cid)
    local lastAwarded = getPlayerStorageValue(cid, lastPointAwardedStorage)
    if ((lastAwarded == -1) or ((lastAwarded + timeBetweenPoints) <= os.time()) then
        setPlayerStorageValue(cid, lastPointAwardedStorage, os.time())
        setPlayerStorageValue(cid, pointsStorage, getPlayerStorageValue(cid, pointsStorage) + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have been awarded 1 point!")
    end
    return true
end
 
Omg you rule, thank you!!!

i'll test here and edit

----edit----
Thanks, i just had to make some adjustments now its working, thank you seriously!!

anyone who need this too here is the code:

Code:
local lastPointAwardedStorage = 60000
local pointsStorage = 60001
local timeBetweenPoints = 24 * 60 * 60

function onLogin(cid)
    local lastAwarded = getPlayerStorageValue(cid, lastPointAwardedStorage)
    if ((lastAwarded == -1) or ((lastAwarded + timeBetweenPoints) <= os.time())) then
        setPlayerStorageValue(cid, lastPointAwardedStorage, os.time())
        setPlayerStorageValue(cid, pointsStorage, 15)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have been awarded 15 point!")
    end
    return true
end
 
Last edited:
Back
Top