18.08.2011, 17:06
Hello, I have recently made a /spec command which shows the players id and name, it shows id 0's id and name but it only shows id 1's name.
pawn Код:
CMD:spec(playerid, params[])
{
new string[128], tname[MAX_PLAYER_NAME], id;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1 , "ERROR: You are not an admin!");
if (sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /spec [playerid]");
if(id == playerid)return SendClientMessage(playerid,COLOR_RED,"ERROR: You are not able to spec yourself.");// Just making sure.
if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_RED, "ERROR: This ID has not been found.");
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer(playerid, id);
GetPlayerName(id, tname, sizeof(tname));
format(string, sizeof(string), "~b~ID: ~w~%d~n~~b~Name: ~w~%s", id, tname);
GameTextForPlayer(playerid, string, 12000, 4);
return 1;
}