NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? [SLOVED 100%] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? [SLOVED 100%] (
/showthread.php?tid=134856)
NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? [SLOVED 100%] - Micko9 - 17.03.2010
Wil This Work :
pawn Code:
if for (new p=0; p<MAX_PLAYERS; p++)
{
if (IsPlayerConnected(p) && p!=INVALID_PLAYER_ID) // code...
}

im not sure if it will check : if the player is connected & this isnt a invalid player id!
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? -
Carlton - 17.03.2010
Take out the if for statement
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? - Micko9 - 17.03.2010
Quote:
Originally Posted by Carlton
Take out the if for statement 
|
? i dont understand show me the code that wood maybe fix it if it doesnt work
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? -
Carlton - 17.03.2010
pawn Code:
for(new p = 0; p < MAX_PLAYERS; p ++ ) {
if(IsPlayerConnected(i) && p != INVALID_PLAYER_ID) {
}
}
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? -
Born2die - 17.03.2010
pawn Code:
forward ReturnPlayerID(PlayerName[]);
public ReturnPlayerID(PlayerName[])
{
foreach(Player,i)
{
if(strfind(pname[i],PlayerName,true)!=-1) return i;
}
return INVALID_PLAYER_ID;
}
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? - Micko9 - 17.03.2010
Quote:
Originally Posted by Born2die
pawn Code:
forward ReturnPlayerID(PlayerName[]); public ReturnPlayerID(PlayerName[]) { foreach(Player,i) { if(strfind(pname[i],PlayerName,true)!=-1) return i; } return INVALID_PLAYER_ID; }
|
now what i was searching for but o.k.
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? -
Born2die - 17.03.2010
Quote:
Originally Posted by Micko9
Quote:
Originally Posted by Born2die
pawn Code:
forward ReturnPlayerID(PlayerName[]); public ReturnPlayerID(PlayerName[]) { foreach(Player,i) { if(strfind(pname[i],PlayerName,true)!=-1) return i; } return INVALID_PLAYER_ID; }
|
now what i was searching for but o.k.
|
You could simply do
pawn Code:
new id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid)
{
//code
}
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? - Micko9 - 18.03.2010
Quote:
Originally Posted by Born2die
Quote:
Originally Posted by Micko9
Quote:
Originally Posted by Born2die
pawn Code:
forward ReturnPlayerID(PlayerName[]); public ReturnPlayerID(PlayerName[]) { foreach(Player,i) { if(strfind(pname[i],PlayerName,true)!=-1) return i; } return INVALID_PLAYER_ID; }
|
now what i was searching for but o.k.
|
You could simply do
pawn Code:
new id = strval(params); if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) { //code }
|
i wasnt asking for the syntax...im asking : does THE INVALID_PLAYER_ID exist by default?
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? -
Torran - 18.03.2010
Yes i think, Ive used it before
Re: NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? - Micko9 - 18.03.2010
Quote:
Originally Posted by Joe Torran C
Yes i think, Ive used it before
|
thanks!