• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

One More Record Online

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
I am finding a script that when the server achieves a number "X" of record of on-line players, everybody receives an item.

By example:
If it arrive to 50 players online everybody receive an item, when arrive to 70, earns another one rewards and like this successively. Because in this way? Because itself with a new record is reached quickly, turns mess!


Thanks,
 
edit your record.lua globalevent
LUA:
local rewards = 
	{	--record = itemid
		[50] = 1234,
		[70] = 12345,
	}


function onRecord(current, old, cid)
	if rewards[current] then
		for _, pid in ipairs(getPlayersOnline()) do
			doPlayerAddItem(pid, rewards[current], 1)
		end
	end

        --etc...
 
Cbrm I'm giving REP +, it's alone that?

But I would like that had a message, like this:
"New record 50 players online. You are receiving a rewards by this."

- - - Updated - - -

Or then I can create another moon and alone add this phrase "Rewards by the record reached." Which you find better?

I am full of doubts, that alone script will function a time, correct? Or every time reach the number X he will give the item?
 
Last edited:
LUA:
local rewards = 
	{ --record = itemid
		[100] = 2160, -- If record == 100 then receive 10k
		[200] = 2160, -- If record == 200 then receive 10k
	}

function onRecord(current, old, cid)

	if rewards[current] then
		for _, pid in ipairs(getPlayersOnline()) do
			doPlayerAddItem(pid, rewards[current], 1)
			doPlayerSendTextMessage(0, cid, 22, "You received 10k as a gift because of a new record.")
		end
	end
	db.query("INSERT INTO `server_record` (`record`, `world_id`, `timestamp`) VALUES (" .. current .. ", " .. getConfigValue('worldId') .. ", " .. os.time() .. ");")
	addEvent(doBroadcastMessage, 150, "New record: " .. current .. " players are logged in.", MESSAGE_STATUS_DEFAULT)
end
 
Back
Top