Yeah its ok if you made high prices
I upgraded script for you.
creaturescripts/creaturescripts.xml
Code:
<event type="think" name="addpointTimer" event="script" value="addpointTimer.lua"/>
creaturescripts/scripts/addpointTimer.lua
Code:
function onThink(cid, interval)
local time = 1*60*60 -- 1s*60s = 60s * 60s = 60min
local count = 1 -- points to add
if getPlayerStorageValue(cid, 455577) < os.time() then
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. count .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You gained 1 premium point for 1 hour online status.")
setPlayerStorageValue(cid, 455577, os.time() + time)
end
local remaining = math.ceil(getPlayerStorageValue(cid, 455577) - os.time())
if getPlayerStorageValue(cid, 455578) ~= 0 then
doPlayerSendCancel(cid, "!c to hide counter. Time to get point: "..remaining.."s.")
else
return remaining
end
return true
end
talkactions/talkactions.xml
Code:
<talkaction words="!c" event="script" value="hideCounter.lua"/>
talkactions/scripts/hideCounter.lua
Code:
function onSay(cid, words, param)
if(not checkExhausted(cid, 554, 5)) then
return true
end
if getPlayerStorageValue(cid, 455578) ~= 0 then
setPlayerStorageValue(cid, 455578, 0)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Timer hidden!")
else
setPlayerStorageValue(cid, 455578, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Timer shown!")
end
return true
end
talkactions/lib/talkactions.lua
Code:
function checkExhausted(cid, storage, seconds)
local v = exhaustion.get(cid, storage)
if(not v) then
exhaustion.set(cid, storage, seconds)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Please wait " .. v .. " seonds before using this command again.")
return false
end
return true
end
creaturescripts/login.lua
Code:
local time = 1*60*60 -- 1s*60s = 60s * 60s = 60min
registerCreatureEvent(cid, "addpointTimer")
setPlayerStorageValue(cid, 455577, os.time() + time)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Every 1 hour online you will get 1 premium point.")