Help Commands
#1

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 ?
Reply
#2

The way you are checking if the player's health is bellow 100 is wrong.

PHP код:
new Floathp;
GetPlayerHealth(playeridhp);
if (
hp 100.0)
{
    
//...

Reply
#3

Thanks
Reply
#4

Or just do
PHP код:
new Float:Hell;
GetPlayerHealth(playeridHell);
if(
Hell != 100)) SendClientMessage(playeridCOLOR_RED"You cant Use This Commands , If Your Health Under 100");
SetPlayerHealth(playerid,0.0); 
SetPlayerScore(playerid,GetPlayerScore(playerid)-1); 
Reply
#5

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)