Boomer
Grenadia.eu - Best EVO
- Joined
- Aug 22, 2009
- Messages
- 97
- Reaction score
- 0
Code:
local config =
{
lottery_hour = "24 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
points = 15, -- how many points winner get?
website = "yes" -- Do you have `lottery` table in your database?
}
function onTimer()
local players, random, name = getOnlinePlayers(), math.random(1, table.maxn(getOnlinePlayers())), players[random]
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. config.points .. " WHERE `id` = " .. getAccountIdByName(name) .. ";")
doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. name .. ", Reward: +" .. config.points .. " points to the SMS Shop! Congratulations! (Next Lottery in " .. config.lottery_hour ..")")
if(config.website == "yes") then
db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. name .."', '".. config.points .." premium points');")
end
return true
end
W tym zmieniłem na takie:
Code:
local config =
{
lottery_hour = "24 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
points = 15, -- how many points winner get?
website = "yes" -- Do you have `lottery` table in your database?
}
function onTimer()
local players, random, name = getPlayersOnline(), math.random(1, table.maxn(getPlayersOnline())), players[random]
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. config.points .. " WHERE `id` = " .. getAccountIdByName(name) .. ";")
doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. name .. ", Reward: +" .. config.points .. " points to the SMS Shop! Congratulations! (Next Lottery in " .. config.lottery_hour ..")")
if(config.website == "yes") then
db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. name .."', '".. config.points .." premium points');")
end
return true
end
Lecz dalej wyskakuje błąd: