darkmu
Well-Known Member
Can someone help me limit only 1 character that can win? Because my server allows to log more than 1 character in the same account and the staff is registering several and earning double tibia coins.
Lua:
function onThink(interval, lastExecution)
for _, player in pairs(Game.getPlayers()) do
accountID = player:getAccountId()
if (os.time() - player:getStorageValue(_TOKENS_LH.sto_online)) >= _TOKENS_LH.time * 60 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu ".. _TOKENS_LH.token_qnt .. " tibia coins!")
player:setStorageValue(_TOKENS_LH.sto_online, os.time())
db.asyncQuery('UPDATE `accounts` SET `coins` = `coins` + "'.. _TOKENS_LH.token_qnt .. '" WHERE `id` = '.. accountID)
end
end
return true
end