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

Coins for being online

zerghel

Tsuni
Joined
Jul 1, 2008
Messages
299
Reaction score
9
Hi.
i got this script to give 1 coin every hour online (creaturescript)
but it need an "account, ip check" or something cause i allow multiclienting from same account
for 3 characters they get 3 coins every hour to their account
hope u can helpme with this
thx in advance
Lua:
local event = {}
local timeOnline = 60 * 60 * 1000

function addPremiumPoint(cid)
    local player = Player(cid)
    if player then
        db.query("UPDATE accounts SET coins = coins + 1 WHERE id = '" ..player:getAccountId().. "';")
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You have been online for an hour and have earned 1 Store coin.")
        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
 
Solution
Lua:
local timeOnline = 60 * 60 * 1000
local pointPlayers = {}

function addPremiumPoint(PID, playerIP)
    local player = Player(PID)
    if player then
        db.query("UPDATE accounts SET coins = coins + 1 WHERE id = '" ..player:getAccountId().. "';")
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You have been online for an hour and have earned 1 Store coin.")
        addEvent(addPremiumPoint, 60 * 60 * 1000, PID, playerIP)
        return true
    else
        pointPlayers[playerIP] = nil
    end
end

function onLogin(player)
    local PID = player:getId()
    local playerIP = player:getIp()
  
    if not pointPlayers[player:getIp()]  then
        pointPlayers[playerIP] = true
        addEvent(addPremiumPoint, 60 * 60 * 1000, PID...
Lua:
local timeOnline = 60 * 60 * 1000
local pointPlayers = {}

function addPremiumPoint(PID, playerIP)
    local player = Player(PID)
    if player then
        db.query("UPDATE accounts SET coins = coins + 1 WHERE id = '" ..player:getAccountId().. "';")
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You have been online for an hour and have earned 1 Store coin.")
        addEvent(addPremiumPoint, 60 * 60 * 1000, PID, playerIP)
        return true
    else
        pointPlayers[playerIP] = nil
    end
end

function onLogin(player)
    local PID = player:getId()
    local playerIP = player:getIp()
  
    if not pointPlayers[player:getIp()]  then
        pointPlayers[playerIP] = true
        addEvent(addPremiumPoint, 60 * 60 * 1000, PID, playerIP)
    end
    return true
end
 
Solution
i just realize, it would be better for account 'cause someone can bypass it using a friend's address
don't u think?
 
i just realize, it would be better for account 'cause someone can bypass it using a friend's address
don't u think?
it is already per account unless you allow multiple logins from the same account, and the by ip is easily bypassable by using a proxy xD
 
Im not that good. I did manage to get my hands on a bunch of C++, OpenGL, Boost, ect. books so I will see what I can do with it. Of course I always share what I make because im not a prick like some people on here. Not naming any names, Infernum....
 
Im not that good. I did manage to get my hands on a bunch of C++, OpenGL, Boost, ect. books so I will see what I can do with it. Of course I always share what I make because im not a prick like some people on here. Not naming any names, Infernum....
Since when do I not share everything I make? Maybe we can compare our releases and see who doesn't rewrite door and fishing scripts to release.
 
Back
Top