ID:264183
 
Code:
var
players=100
maxplayers=100
world/IsBanned(key,address)
if(players >=maxplayers)
.["Login"] = 0
client/New()
..()
players++


Problem description:
ive set the number of active players to the max in order to see if ill get booted out since
players = 100+myself meaning players = 101 yet i dont get booted out can someone explain to me why...thanks ahead


Add 1 to the players before you call the parent. I'm not familiar with isBanned(), but it's called in client/New() I think.
In response to Jeff8500
what do you mean?
You never called ..() at the beginning of the proc:

world/IsBanned(key,address)
. = ..()
if(players >=maxplayers)
.["Login"] = 0


Lummox JR
Doesn't look like you really know what you're doing... The . variable doesn't even contain a list reference at the time you're trying to modify a list's associated value through it, it's at its default of null since you didn't set it to anything else.
Also, look up world/IsBanned() to see how it works. It's quite pointless to set the Login parameter to 0; in fact it probably has no effect and does nothing. Since to stop the connection IsBanned() just needs to return a true value, you could even just return 1 instead. The code posted at [link] is more like how you should do it.

Also, it looks like you may have forgotten to ever decrease the players var, so mentioning it just in case.
In response to Kaioken
ok this is getting rather annoying:
var
players = 100
max_players=100

These are the vars, as you see the number of players is equal to the number of max players allowed meaning that the next player to log on(Me) will get booted out
here is what i tried:
world/IsBanned()
.=..()
if(players >=max_players)
return 0

world/IsBanned(key,address)
. = ..()
if(players >=max_players)
.["Login"] = 1

world/IsBanned() //don't need args >_>
if(players >= max_players)
return list("desc" = "Sorry, server is full.")
return ..()

world/IsBanned(key,address)
.=..()
if(players >= max_players)
return list("desc" = "Login failed due to server player limit reached.","Login" = 1)
else
return list("desc"="Login access granted.","Login"=0)


All of the above has failed to achieve my goal, even though the above examples were given to me by Kaioken and Lummox JR so can some please help and tell me whats wrong!!!
In response to Biond_coder
Biond_coder wrote:
please help and tell me whats wrong!!!

world/IsBanned() does not take effect for those on the same computer as the host?

Try having somebody else connect, or use client/New() instead.
In response to Android Data
a) i tried to use anothe computer and the result is the same:failure

b) the reason i want to use world/IsBanned() is because it can boot players out before having them download the resources meaning they wont increase possible lag to the server...
In response to Android Data
Android Data wrote:
world/IsBanned() does not take effect for those on the same computer as the host?

Indeed, I noticed it does not get called sometimes if you connect to your own game. If your client.address is null or 127.0.0.1, then it won't get called for you, but if you connect to your game through your external IP (therefore you have a different client.address) it's consistently called for you so you can test it, etc. I'm not sure if this is intended behavior or not, and they may want to change it even if so.
Hey i solved the problem so thanks guys each one of you really helped me and im thankful.