Command /stats - 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: Command /stats (
/showthread.php?tid=342865)
Command /stats -
[D]ry[D]esert - 15.05.2012
Hi
I try to make /stats command it succes but when i show to player it show
Health = 121532562
without decimal point i mean like that
Health = 121.532562
How could i fix that ?
Here is the Code
pawn Код:
new Float:H,Float:A,targetid,targetname[MAX_PLAYER_NAME],str[120],str1[120],str2[120];
    if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, ""WHITE"Usage: "GREEN"/stats "WHITE"[playerid]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid PlayerID"RED"(Player Not Connected)!");
    GetPlayerHealth(playerid, H);
    GetPlayerArmour(playerid, A);
    GetPlayerTeam(targetid);
    GetPlayerName(targetid,targetname,sizeof(targetname));
    format(str,sizeof(str),"This Player Called %s",targetname);
    format(str1,sizeof(str1),""WHITE"Health = "RED"%d",H);
    format(str2,sizeof(str2),""WHITE"Armour = "RED"%d",A);
    SendClientMessage(playerid,COLOR_RED,str);
    SendClientMessage(playerid,COLOR_RED,str1);
    SendClientMessage(playerid,COLOR_RED,str2);
Re: Command /stats -
TzAkS. - 15.05.2012
"RED"%f",H);
Re: Command /stats -
[D]ry[D]esert - 15.05.2012
Quote:
Originally Posted by TzAkS.
"RED"%f",H);
|
Work Thanks but What is %f ?
and Could i do without decimal point ?
Re: Command /stats -
TzAkS. - 15.05.2012
%f is for Float,try like this
AW: Command /stats -
EthanR - 15.05.2012
Don't define "H" and "A" as floats, then GetPlayerHealth should give you an integer such as "121"
Example:
new Health, Armor;
GetPlayerHealth(playerid, Health);
GetPlayerArmour(playerid, Armor);
format(string, sizeof(string), "Your health/armor is currently on %d/%d", Health, Armor);
SendClientMessage(playerid, 0xFFFFFFFF, string);
Re: Command /stats -
Face9000 - 15.05.2012
Health: %0.1f
Armour: %0.1f