Hello, I ask your help for a simple system of each one hour online the player should receive 1 point. Every 12 points (12 hours), through a talkaction he will buy 1 day of premium time. I already did some of the code and I need help for the rest, thanks!
Code:
local event = {}
local timeOnline = 60 * 60 * 1000
function addPremiumPoint(cid)
local player = Player(cid)
if player then
local time = player:getStorageValue(25230)
player:setStorageValue(25230, (time + 1))
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "[FREE VIP] You have been online for an hour and have earned 1 premium point. For every 12 premium points you gain 1 VIP Day.")
event[cid] = addEvent(addPremiumPoint, timeOnline, cid)
return
end
event[cid] = nil
end
function onLogin(player)
if player:getStorageValue(25230) == -1 then
player:setStorageValue(25230, 0)
end
local cid = player:getId()
if not event[cid] then
event[cid] = addEvent(addPremiumPoint, timeOnline, cid)
end
return true
end