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 random, name = math.random(1, #getOnlinePlayers()), getPlayerNameByGUID(random)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` +" .. config.points .. " WHERE `id` = ".. getAccountIdByName(name) ..";")
doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. name ..', Reward: +' .. 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
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(cid)
local random, name = math.random(1, #getOnlinePlayers()), getCreatureName(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
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 name = math.random(1, #getOnlinePlayers())
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
doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. name .. ", Reward: +" .. config.points .. " points to the SMS Shop! Congratulations! (Next Lottery in " .. config.lottery_hour ..")")
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
Do kazdego xD Wiesz co, zaraz u siebie to przetestuje bo naprawde tak to nie ma sensu. A w miedzy czasie sprawdz czy masz premium_points w accounts.
getPlayersOnline zamiast getOnlinePlayers
co za porażka ludzie /
function onThink(interval, lastExecution)
local random = math.random(1, #getOnlinePlayers())
local name = getOnlinePlayers()[random]
doBroadcastMessage("Kocham Cie " .. name .. " :* ",22)
return true
end
21:37 Kocham Cie Chuj :*
21:37 Kocham Cie Chuj :*
21:38 Kocham Cie Lolek :*
21:38 Kocham Cie Lolek :*
21:38 Kocham Cie Chuj :*
function onThink(interval, lastExecution)
local random = math.random(1, #getPlayersOnline())
local name = getPlayersOnline()[random]
doBroadcastMessage("Kocham Cie " .. name .. " :* ",22)
return true
end
21:38 Kocham Cie 268462459 :*
21:38 Kocham Cie 268462458 :*
21:38 Kocham Cie 268462458 :*
21:39 Kocham Cie 268462459 :*
21:39 Kocham Cie 268462458 :*
+ do tego dodac getCreatureName(name)