Hell is there any way i can make it so only like 4 players can join a server in my game.
ID:173925
Oct 26 2003, 1:58 am
|
|
In response to Loduwijk
|
|
A more effencet way to acomplish this task is like this. because it does not need to loop through all the mobs.
var/players = 0 Client/New() if(++players<4) del src ..() mob/Logout() players-- world << players ..() |
In response to Xzar
|
|
Xzar wrote:
A more effencet way to acomplish this task is like this. because it does not need to loop through all the mobs. I think you mean to have: if(players>=4)del src The way you had it, players would increase everything client/New() was called even if the player did not actually get in. I still prefer my loop though. Also, since you are talking about being more efficient, you could just return null there instead of doing del src. Returning null in client/New() disallows the new connection. |
Yes there is. What was the purpose of that "Hell" at the beginning of that sentence though?
In client/New() create a variable to keep track of the number of players. Loop through all mobs and add 1 to the variable for each one it finds with a client attached. Then you can simple do an: