Hello, this has been requested by this user: http://otland.net/threads/premium-points-for-players-online-record.201470/ so i had nothing todo and made it ^^
Only tested in: 0.3
As the title says, you can configure, when it reach a new record, how much points it should add and on which record it should add. Also it will check if you have znote acc or gesior acc!
You can easily replace whole record.lua in globalevent, but if it doesnt exsist just add this then in globalevents.xml
and create new file and name it record.lua and paste the code below:
Enjoy!
Only tested in: 0.3
As the title says, you can configure, when it reach a new record, how much points it should add and on which record it should add. Also it will check if you have znote acc or gesior acc!
You can easily replace whole record.lua in globalevent, but if it doesnt exsist just add this then in globalevents.xml
Code:
<globalevent name="record" type="record" event="script" value="record.lua"/>
and create new file and name it record.lua and paste the code below:
Code:
local config = { --[record] {amount of points}
znote = "no", --If you use gesior acc leave it no
[50] = {points = 100},
[100] = {points = 200}
}
function onRecord(current, old, cid)
for _, pid in ipairs(getPlayersOnline()) do
if (config[current]) then
if (config.znote == "yes") then
db.executeQuery("UPDATE `znote_accounts` SET `points` = `points` + "..config[current].points.." WHERE `account_id` ='"..getPlayerAccount(pid).."'")
else
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + "..config[current].points.." WHERE `name` ='"..getPlayerAccount(pid).."'")
end
end
end
if (config[current]) then
addEvent(doBroadcastMessage, 150, "The server has reached a new record with "..current.." players online, all players which is online has recived "..config[current].points.." points.", MESSAGE_EVENT_ADVANCE)
else
addEvent(doBroadcastMessage, 150, "New record: " .. current .. " players are logged in.", MESSAGE_STATUS_DEFAULT)
end
db.executeQuery("INSERT INTO `server_record` (`record`, `world_id`, `timestamp`) VALUES (" .. current .. ", " .. getConfigValue('worldId') .. ", " .. os.time() .. ");")
return true
end
Enjoy!