11.11.2011, 14:12
I make a stats command but it's not working as I wanted.
The color seems good at the NPCs but not to normal Players. Also the NPC's Armour was 1120403456 for the one NPC. Moreover, the time.
Here is the code
Here a picture from the stats (Taxi_Driver(NPC) & harry_Potter(NPC) and me)
The color seems good at the NPCs but not to normal Players. Also the NPC's Armour was 1120403456 for the one NPC. Moreover, the time.
Here is the code
pawn Код:
CMD:stats(playerid, params[])
{
new targetid;
if(sscanf(params,"i", targetid)) return SendClientMessage(playerid, COLOR_RED,"[ERROR]: Usage: /stats [playerid]");
if(IsPlayerConnected(targetid) == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is not connected!");
new Pname[24], sMessage[128];
GetPlayerName(targetid, Pname, sizeof(Pname));
format(sMessage, sizeof(sMessage), "***%s's (ID: %d) Stats***", Pname, targetid);
SendClientMessage(playerid, COLOR_ORANGE, sMessage);
new Float:health, Float:armor;
GetPlayerHealth(targetid, health);
GetPlayerArmour(targetid, armor);
format(sMessage, sizeof(sMessage), "Health: (%d) Armour: (%d)", floatround(health),armor);
SendClientMessage(playerid, COLOR_GREEN, sMessage);
new hour, minutes;
GetPlayerTime(targetid, hour, minutes);
format(sMessage, sizeof(sMessage), "Money: (%d) Score: (%d) Color: (%d) Time: (%d:%d) Skin: (%d)", GetPlayerMoney(targetid), GetPlayerScore(targetid), GetPlayerColor(targetid), hour, minutes, GetPlayerSkin(targetid));
SendClientMessage(playerid, COLOR_GREEN, sMessage);
return 1;
}