Help Commands - 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: Help Commands (
/showthread.php?tid=602618)
Help Commands -
Amunra - 10.03.2016
PHP код:
CMD:die(playerid)
{
new Float:Hell;
if(GetPlayerHealth(playerid,Hell) < 100)
{
SendClientMessage(playerid,red,"You cant Use This Commands , If Your Health Under 100");
}
else
{
SetPlayerHealth(playerid,0.0);
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
}
return 1;
}
When I Type /die and My Health is 100 ... Thats Say "You cant Use This Commands , If Your Health Under 100" ..
And If My Health Under 100 .. Thats say "You cant Use This Commands , If Your Health Under 100" .. the same thing!!
Whats Wrong ?
Re: Help Commands -
Sjn - 10.03.2016
The way you are checking if the player's health is bellow 100 is wrong.
PHP код:
new Float: hp;
GetPlayerHealth(playerid, hp);
if (hp < 100.0)
{
//...
}
Re: Help Commands -
Amunra - 10.03.2016
Thanks
Re: Help Commands -
saffierr - 10.03.2016
Or just do
PHP код:
new Float:Hell;
GetPlayerHealth(playerid, Hell);
if(Hell != 100)) SendClientMessage(playerid, COLOR_RED, "You cant Use This Commands , If Your Health Under 100");
SetPlayerHealth(playerid,0.0);
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
Re: Help Commands -
xTURBOx - 10.03.2016
PHP код:
CMD:die(playerid)
{
new Float:Hell;
GetPlayerHealth(playerid,Hell);
if(hell < 100)
{
SendClientMessage(playerid,red,"You cant Use This Commands , If Your Health Under 100");
}
else
{
SetPlayerHealth(playerid,0.0);
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
}
return 1;
}