Does these two loops do the same thing?
#1

pawn Code:
for (new i = 0; i < MAX_PLAYERS; i++)
and

pawn Code:
for(new i; i != MAX_PLAYERS; i++)
Reply
#2

yes

( 1234 )
Reply
#3

Hi Lorenc, thanks for your answer.

Btw, from your tutorial, this

pawn Code:
public OnGameModeExit()
{
    for(new i; i != MAX_PLAYERS; i++) OnPlayerDisconnect(i, 1);
    db_close(Database);
    return 1;
}
Doesn't it need a IsPlayerConnected check?

EDIT:

I gotta another question.

Example:

PlayerInfo[playerid][pAdminLevel] = 0;

Where is it best to put this? OnPlayerConnect or OnPlayerDisconnect? Or maybe both?

Thanks
Reply
#4

the PlayerInfo[playerid][pAdminLevel] is a global variable, it wont get erased in case a level 3 admin logs out. so adding the level=0 into the disconnect, is a good idea.
to set admin level to 0 when connecting, is not the best idea (its value is set to 0 at initializing, also got set to 0 from a recently playing admin on that slot).
i suggest you to use PVars to store such "important" variables, so any of your filterscript can access it aswell. PVars gets deleted when a player disconnects, so no worry about resetting the player-arrays.
Reply
#5

Quote:
Originally Posted by Babul
View Post
the PlayerInfo[playerid][pAdminLevel] is a global variable, it wont get erased in case a level 3 admin logs out. so adding the level=0 into the disconnect, is a good idea.
to set admin level to 0 when connecting, is not the best idea (its value is set to 0 at initializing, also got set to 0 from a recently playing admin on that slot).
i suggest you to use PVars to store such "important" variables, so any of your filterscript can access it aswell. PVars gets deleted when a player disconnects, so no worry about resetting the player-arrays.
I suggest you to read this:
http://forum.sa-mp.com/showthread.ph...highlight=PVar
Reply
#6

Quote:
Originally Posted by Cowboy
View Post
pawn Code:
public OnGameModeExit()
{
    for(new i; i != MAX_PLAYERS; i++) OnPlayerDisconnect(i, 1);
    db_close(Database);
    return 1;
}
Why would there be anything like that at all is what I'm wondering. OnPlayerDisconnect is called for every player upon a controlled server restart anyways.
Quote:
Originally Posted by Cowboy
View Post
I gotta another question.

Example:

PlayerInfo[playerid][pAdminLevel] = 0;

Where is it best to put this? OnPlayerConnect or OnPlayerDisconnect? Or maybe both?
Both would be a waste. Resetting it under OnPlayerDisconnect is a good idea.
Reply
#7

Quote:
Originally Posted by AndreT
View Post
Why would there be anything like that at all is what I'm wondering. OnPlayerDisconnect is called for every player upon a controlled server restart anyways.
It's bugged with gmx.
Reply
#8

I tried that code, but it doesn't save when I gmx, why?
Reply
#9

Create costum gmx command.
Do the saving thinghy then run gmx.
Reply
#10

No other way? I would really like to use the gmx from rcon window
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)