06.03.2010, 19:57
I've got a problem with my admin cmd ''/whois''
It shows player stats; Name, ID, money, IP, armour, health. But it ain't working correctly; Showing wrong stats.
Like this:
| Name: [UF]DarkPhoenix | ID: 11 | Money: $205386 | IP: 111.111.111.111 | Health: 100.00000000 | Armour: 0.000000000
And when I want to check stats of someone else it shows HIS/HER name, ID, money by MY IP, Health and Armour... After I typed it again it works fine. This always happens. I don't want Health and Armour ''100.0000000000'' or ''95.000000000'' I just want it like ''100'' or ''75'', etc.
This is my script:
Anyone knows what is wrong?
It shows player stats; Name, ID, money, IP, armour, health. But it ain't working correctly; Showing wrong stats.
Like this:
| Name: [UF]DarkPhoenix | ID: 11 | Money: $205386 | IP: 111.111.111.111 | Health: 100.00000000 | Armour: 0.000000000
And when I want to check stats of someone else it shows HIS/HER name, ID, money by MY IP, Health and Armour... After I typed it again it works fine. This always happens. I don't want Health and Armour ''100.0000000000'' or ''95.000000000'' I just want it like ''100'' or ''75'', etc.
This is my script:
pawn Код:
dcmd_whois(playerid, params[])
{
new index = 0;
new playermoney;
new PlayerIP[16];
GetPlayerIp(giveplayerid,PlayerIP,sizeof(PlayerIP));
new Float:pHealth,Float:pArmour;
GetPlayerHealth(playerid,pHealth);
GetPlayerArmour(playerid,pArmour);
tmp2 = strtok(params, index);
if (pInfo[playerid][pAdmin] < 1)
{
SystemMessage(playerid, "You are not an Administrator with the required level.");
return 1;
}
if(!strlen(tmp2))
{
SystemMessage(playerid, "[USAGE] ''/whois [playername/id]''.");
return 1;
}
new string[MAX_STRING];
giveplayerid = ReturnUser(tmp2);
if (IsPlayerConnected(giveplayerid))
{
playermoney = GetPlayerMoney(giveplayerid);
format(string, sizeof(string), "| Name: %s | ID: %d | Money: $%d | IP: %s | Health: %f | Armour: %f", PlayerName(giveplayerid), giveplayerid, playermoney, PlayerIP, pHealth, pArmour);
SystemMessage(playerid, string);
}
else
{
format(string, sizeof(string), "That player is not active.");
SystemMessage(playerid, string);
}
return 1;
}