GetPlayerHealth for my stats system?? -
stuoyto - 07.05.2012
Hello again samp forum,
I have set up a command on my server and that is when a player types /stats it will display their stats in the chat.
The only problem im having is how do i get a players health so that it can be displayed in the stats. I will show you what i already have and what the result is below:
Код:
CMD:stats(playerid, params[])
{
new stats[128];
new StatCash = GetPlayerMoney(playerid);
new StatKills = PlayerInfo[playerid][pKills];
new StatDeaths = PlayerInfo[playerid][pDeaths];
new StatSkin = GetPlayerSkin(playerid);
new StatLogins = PlayerInfo[playerid][pLogins];
new StatArmour = GetPlayerArmour(playerid);
new StatHealth = GetPlayerHealth(playerid);
new string[128];
if(gTeam[playerid] == 1)
{
format(string, sizeof(string), "Civilian");
}
else if(gTeam[playerid] == 2)
{
format(string, sizeof(string), "Police");
}
else if(gTeam[playerid] == 3)
{
format(string, sizeof(string), "Paramedic");
}
else if(gTeam[playerid] == 4)
{
format(string, sizeof(string), "Thief");
}
else if(gTeam[playerid] == 5)
{
format(string, sizeof(string), "Dealer");
}
else if(gTeam[playerid] == 6)
{
format(string, sizeof(string), "Lawyer");
}
format(stats, sizeof(stats), "Class[%s] || Money[%i] || Kills[%i] || Deaths[%i] || Skin ID[%i] || Logins[%i] || Health[%i] || Armour[%i]", string, StatCash, StatKills, StatDeaths, StatSkin, StatLogins, StatHealth, StatArmour);
SendClientMessage(playerid, LIGHTGREEN, "______________________________________PLAYER STATS_______________________________________");
SendClientMessage(playerid, WHITE, stats);
SendClientMessage(playerid, LIGHTGREEN, "__________________________________________________________________________________________");
return 1;
}
Within that code, this is what i cant get to work:
Код:
new StatArmour = GetPlayerArmour(playerid);
new StatHealth = GetPlayerHealth(playerid);
Because i get the following warnings:
Код:
C:\Users\Stuart\Desktop\Sanandreas\Server\gamemodes\Cops-N-Crooks.pwn(1100) : warning 202: number of arguments does not match definition
C:\Users\Stuart\Desktop\Sanandreas\Server\gamemodes\Cops-N-Crooks.pwn(1101) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Lines 1100 and 1101 being:
Код:
new StatArmour = GetPlayerArmour(playerid);
new StatHealth = GetPlayerHealth(playerid);
I know what i am trying to do is possible as ive seen it on other servers but im obviously not doing it right, i am just hoping that the members of this forums can help me. I would really appreciate it.
Stuoyto
Re: GetPlayerHealth for my stats system?? -
Kindred - 07.05.2012
pawn Код:
new Float:StatArmour, Float:StatHealth;
GetPlayerHealth(playerid,StatHealth);
GetPlayerArmour(playerid,StatArmour);
Both have 2 params.
Or as YuryFury said.
Re: GetPlayerHealth for my stats system?? -
Yuryfury - 07.05.2012
Also, both Health and Armour are floats, not integers.
Taken from my admin script:
pawn Код:
new Float:phealth, Float:parmour;
GetPlayerHealth(id,phealth);
GetPlayerArmour(id,parmour);
format(datastring,sizeof(datastring),"Health:%.3f Armour: %.3f",phealth,parmour);