SA-MP Forums Archive
player info - 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)
+--- Thread: player info (/showthread.php?tid=484936)



player info - ScRipTeRi - 02.01.2014

hello i have make on command /info [id] but when i try to see another player info it dosn't work.
Here is my Code
pawn Код:
if (strcmp(cmdtext, "/info", true) == 0)
    {
    new tmp[MAX_SERVER_STRING]; tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "/info [id]");
    return 1;
    }
    if(!IsNumeric(tmp))
    {
      SendClientMessage(playerid, COLOR_RED1, "ERROR: You must put a valid ID! Not a name!");
      return 1;
    }
    player = strval(tmp);
    if(!IsPlayerConnected(player))
    {
      SendClientMessage(playerid, COLOR_RED1, "Player not found.");
      return 1;
    }
    new current_zone = player_zone[player];
    new string[256];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(player,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Player: %s ",pName);
    SendClientMessage(player,0xE89B5BBB ,string);
    format(string,sizeof string,"FPS: %d",FPS2[player]);
    SendClientMessage(player,-1 ,string);
    format(string,sizeof string,"Ping: %d",GetPlayerPing(player));
    SendClientMessage(player,-1 ,string);
    format(string,sizeof string,"Kills Spree: %d",Kills[player]);
    SendClientMessage(player,-1 ,string);
    return 1;
}



Re: player info - dominik523 - 02.01.2014

I would suggest you to use zcmd and sscanf plugin. It will be much more easier for you.


Re: player info - ScRipTeRi - 02.01.2014

with cmdtext it not work?


Re : player info - [HRD]Mar1 - 02.01.2014

pawn Код:
if (strcmp(cmdtext, "/info", true) == 0)
    {
    new tmp[MAX_SERVER_STRING]; tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "/info [id]");
    return 1;
    }
    if(!IsNumeric(tmp))
    {
      SendClientMessage(playerid, COLOR_RED1, "ERROR: You must put a valid ID! Not a name!");
      return 1;
    }
    player = strval(tmp);
    player = playerid;
    if(!IsPlayerConnected(player))
    {
      SendClientMessage(playerid, COLOR_RED1, "Player not found.");
      return 1;
    }
    else
    {
    new current_zone = player_zone[player];
    new string[256];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(player,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Player: %s ",pName);
    SendClientMessage(player,0xE89B5BBB ,string);
    format(string,sizeof string,"FPS: %d",FPS2[player]);
    SendClientMessage(player,-1 ,string);
    format(string,sizeof string,"Ping: %d",GetPlayerPing(player));
    SendClientMessage(player,-1 ,string);
    format(string,sizeof string,"Kills Spree: %d",Kills[player]);
    SendClientMessage(player,-1 ,string);
    }
    return 1;
}



Re: player info - ScRipTeRi - 02.01.2014

it not work have same problem again like mine


Re : player info - [HRD]Mar1 - 02.01.2014

scanf would be better.


Re: player info - Schocc - 02.01.2014

Quote:
Originally Posted by ScRipTeRi
Посмотреть сообщение
pawn Код:
player = playerid;
In this part you define your id as a value for var player.
Remove this line.