• 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!

[EACH 1HOUR ONLINE] REWARD - PREMIUM POINTS TFS 1.2

Zak.Tibiam

New Member
Joined
Mar 25, 2012
Messages
150
Reaction score
3
hello people would like to know if anyone could help with a script that every 1 hour online in the player wins 1 server premium points on your account.

use tfs 1.2


Thank you
 
@Omni Cloud i need add this tag on creaturescriptS?

Code:
<event type="login" name="pontos" event="script" value="pontos.lua"/>

and this
Code:
local event = {}
local timeOnline = 60 * 60 * 1000

function addPremiumPoint(cid)
    local player = Player(cid)
    if player then
        db.query("UPDATE `accounts` SET `premium_points` = premium_points + 1 WHERE `id`= " .. player:getGuid() .. " LIMIT 1');")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have been online for an hour and have earned 1 premium point.")
        event[cid] = addEvent(addPremiumPoint, timeOnline, cid)
        return
    end
    event[cid] = nil
end

function onLogin(player)
    local cid = player:getId()
    if not event[cid] then
        event[cid] = addEvent(addPremiumPoint, timeOnline, cid)
    end
    return true
end
file .lua? thanks
 
Yes, you can add this code to login.lua also.
If you are adding it to other lua remember to register event in login.lua
 
Code:
[Error - mysql_real_query] Query: UPDATE `accounts` SET `premium_points` = premium_points + 1 WHERE `id`= 41855 LIMIT 1');
Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '')' at line 1
 
Code:
db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + 1 WHERE `id`= " .. player:getGuid() .. " LIMIT 1;")
 
Back
Top