Processing Payday Code For Everybody Problem(Timer,playerid)
#7

PHP код:
stock GetPlayerID(playername[])
{
  for(new 
0<= MAX_PLAYERSi++)
  {
    if(
IsPlayerConnected(i))
    {
      new 
playername2[MAX_PLAYER_NAME];
      
GetPlayerName(iplayername2sizeof(playername2));
      if(
strcmp(playername2playernametruestrlen(playername)) == 0)
      {
        return 
i;
      }
    }
  }
  return 
INVALID_PLAYER_ID;

Try this.

You also need to check if the player is connected in your id command.

PHP код:
CMD:id(playeridparams[])
{
    new 
id,string[150],name[24],pname[24];
    if(
sscanf(params"u"name)) return SendClientMessage(playerid,-1,"Usage: /id [name]");
    
id GetPlayerID(name);
    if(
id=INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Player not connected!");
    
GetPlayerName(id,pname,24);
    
format(string,sizeof(string),"%d %s",id,pname);
    
SendClientMessage(playerid,COLOR_LIGHTGRAY,string);
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)