tankactions:
function onSay(cid, words, param, channel)
local getP = getPoints(cid)
local lastTime = getCreatureStorage(cid, 1219)
local currentTime = os.time()
local timeElapsed = currentTime - lastTime
local timeRemaining = config.p_time - timeElapsed
if timeRemaining < 0 then
timeRemaining = 0
end
local hours = math.floor(timeRemaining / 3600)
local minutes = math.floor((timeRemaining % 3600) / 60)
local seconds = timeRemaining % 60
doPlayerPopupFYI(cid, string.format("Você possui %d p-points!\nPróximo ponto em: %02d:%02d:%02d", getP, hours, minutes, seconds))
return true
end
globalevent:
--[[
P Points System by LsM.
###### © 2011
Version : v1.0
]]--
local config = {
p_time = 3600, -- Tempo em segundos para receber os pontos( 3600 = 1hora )
p_points = 1 -- Quantidade de pontos recebida a cada "p_time"
}
local function givePoints(cid, quant)
if os.time() - getCreatureStorage(cid, 1219) >= config.p_time then
doPlayerSendTextMessage(cid, 19, "Parabéns, você recebeu ".. config.p_points .." p-point. Agora você tem ".. config.p_points + getPoints(cid) .." p-points na sua conta. Seu tempo foi zerado, próximo p-points daqui 1 hora.")
doPlayerAddPoints(cid, quant)
doCreatureSetStorage(cid, 1219, os.time())
end
return true
end
function onThink(interval)
for i, v in pairs(getPlayersOnline()) do
givePoints(v, config.p_points)
end
return true
end