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

Lua Player can enter title if players online > x

zenonx

New Member
Joined
May 25, 2017
Messages
4
Reaction score
1
Hello, my problem is about players. I want to make floor with player can enter only if on server are more than 30 players (for example). I think i need to do something with function getPlayersOnlineList() but am to bad for it
 
Solution
You want to make a movement script, instead running a global event you can use a global table which stores the amount of players online, the benefit of this is that you can simply populate the table when a player logins or depopulate it when they log out. This also allows you to easily index the table based on the ip as opposed to their player id.

Another alternative is to use a globalstorage, or you could create a for loop and loop through all the players online, some things are cpu/memory intensive...
You want to make a movement script, instead running a global event you can use a global table which stores the amount of players online, the benefit of this is that you can simply populate the table when a player logins or depopulate it when they log out. This also allows you to easily index the table based on the ip as opposed to their player id.

Another alternative is to use a globalstorage, or you could create a for loop and loop through all the players online, some things are cpu/memory intensive...
 
Last edited by a moderator:
Solution
So how to make this floop? I'll use globalevent with execute every 5 min to make my titles
No global event, thats cpu/memory intensive, u never want to have something running all the time regardless if everything else is. Like i said either use a global storage/table which updates when the player logs in or out this uses less resources than running through all the players.

Do you have a get ip function? Actually it would be more helpful if you told us what server version you are using. Always let people know what server version (not client version) you are using this eliminates the 20 questions.
 
Back
Top