NEED HELP ( AGAIN ) : DOES INVALID_PLAYER_ID WORK? [SLOVED 100%]
#1

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!
Reply
#2

Take out the if for statement
Reply
#3

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
Reply
#4

pawn Code:
for(new p = 0; p < MAX_PLAYERS; p ++ ) {
  if(IsPlayerConnected(i) && p != INVALID_PLAYER_ID) {

  }
}
Reply
#5

pawn Code:
forward ReturnPlayerID(PlayerName[]);
public ReturnPlayerID(PlayerName[])
{
    foreach(Player,i)
    {
        if(strfind(pname[i],PlayerName,true)!=-1) return i;
    }
    return INVALID_PLAYER_ID;
}
Reply
#6

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.
Reply
#7

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
}
Reply
#8

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?
Reply
#9

Yes i think, Ive used it before
Reply
#10

Quote:
Originally Posted by Joe Torran C
Yes i think, Ive used it before
thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)