MAX_SLOTS or MAX_PLAYERS
#1

I've always assumed that MAX_PLAYERS was defined by the 'maxplayers' value in the server config. Was I right?

If I was wrong. Does that mean when ever I've used the MAX_PLAYERS in a for loop, is it looping 500 times?
Reply
#2

MAX_PLAYERS will always 500.
Reply
#3

Shiiit...
Reply
#4

Unless you use these,
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 50// 50 = Server slots
Reply
#5

Quote:
Originally Posted by Steven82
Посмотреть сообщение
Unless you use these,
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 50// 50 = Server slots
Yes, I usually use it:

pawn Код:
#define MAX_SPLAYERS (ammount)
#define MAX_SVEHICLES (ammount)
Reply
#6

Cheers mates! Good to get this out of the way.
Reply
#7

Quote:
Originally Posted by MrDeath
Посмотреть сообщение
Yes, I usually use it:

pawn Код:
#define MAX_SPLAYERS (ammount)
#define MAX_SVEHICLES (ammount)
I use that sometimes also but not your exact defines :O
Reply
#8

To get max players from server.cfg i beleive its this, (slower than MAX_PLAYERS though)
pawn Код:
for(new i; i < GetMaxPlayers(); i++)
Reply
#9

Quote:
Originally Posted by iggy1
Посмотреть сообщение
To get max players from server.cfg i beleive its this, (slower than MAX_PLAYERS though)
pawn Код:
for(new i; i < GetMaxPlayers(); i++)
You could also do this for loops:

pawn Код:
//Global variable
new TOTAL_PLAYERS;

//OnGameModeInit:
TOTAL_PLAYERS = GetMaxPlayers();

//Loop:
for(new i; i < TOTAL_PLAYERS; i++)
Should be faster than calling GetMaxPlayers() every time.

However, I would recommend simply using foreach include.
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
This issue is covered in the code optimisations topic, the simple outcome is "use foreach".
Was just about to say the same.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)