SA-MP Forums Archive
getplayerhealth help! lock pls - 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: getplayerhealth help! lock pls (/showthread.php?tid=452568)



getplayerhealth help! lock pls - Vule. - 21.07.2013

So if we create something like this
Код:
if(strcmp(cmdtext, "/heal", true) == 0)
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    if (health < 10.0)
    {
        SetPlayerHealth(playerid, 100.0);
    }
    return 1;
}
Why we need that ==0) after bracket,could someone explain pls?


Re: getplayerhealth help! - San1 - 21.07.2013

Its how long the cmdtext IS
Example "/heal" the 0 would turn into a 5 as it has 5 characters, But mostly you can use a 0 and still works


Re: getplayerhealth help! lock pls - Vule. - 21.07.2013

oh thanks
got it


Re: getplayerhealth help! lock pls - San1 - 21.07.2013

No Prob Would be appreciated if i get +Rep


Re: getplayerhealth help! lock pls - iggy1 - 21.07.2013

The "==0" is there because if the strings match (cmdtext and "/heal") strcmp will return 0. So don't rep san1.