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

bug with premium points lottery script

ex eclipse

New Member
Joined
Jul 15, 2007
Messages
282
Reaction score
1
Location
Brazil
Code:
<mod name="Lottery System" version="1.5" author="vDk" contact="[email protected]" enabled="yes">
    <config name="lottery_config"><![CDATA[
        config = {
            points = {1},
            website = true
        }
    ]]></config>
    <globalevent name="lottery" interval="14400000" event="script"><![CDATA[
    domodlib('lottery_config')
    function onThink(interval)
        local t = getPlayersOnline()
        if #t == 0 then
            return true
        end

        local winner = t[math.random(#t)]
        local n = type(config.points) == 'number' and config.points or config.points[math.random(#config.points)]

        db.executeQuery("UPDATE accounts SET premium_points = ".. n .." WHERE id = " .. getPlayerAccountId(winner))
        doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. n .. " Premium Points! Congratulations! (Next Lottery in 4 hours)")

        if config.website then
            db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES (".. db.escapeString(getCreatureName(winner)) ..", '".. n .." Premium Points')")
        end
        return true
    end
    ]]></globalevent>
</mod>

hi all im using this mod to raffle 1 premium points each 4 hours to a random player
the problem is that if player already got 10 points for example in ur account when the mod gives +1 point he stay with 1 point and lose the 10points that had before lol

also if u win 1 point and win again u keep with 1 point
the script should be set premium points +1 and not ="1"

someone knows how to fix it ?
 
Last edited by a moderator:
Um try this

db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. n .. " WHERE `id`='" .. getPlayerAccountId(winner) .. "' LIMIT 1;")
 
Last edited:
Code:
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. n .. " WHERE `id` = " .. getPlayerAccountId(winner))
 
Code:
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. n .. " WHERE `id` = " .. getPlayerAccountId(winner))

thanks!!
i changed to
db.executeQuery("UPDATE accounts SET premium_points = premium_points+'1' WHERE id = " .. getPlayerAccountId(winner))
xd
 
Back
Top