SA-MP Forums Archive
How to create a command check? - 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: How to create a command check? (/showthread.php?tid=476774)



How to create a command check? - d0nTtoucH - 20.11.2013

Hello! How do you check whether your health and armour in full in the spelling of command?


Re: How to create a command check? - newbie scripter - 20.11.2013

in ZCMD:
pawn Код:
CMD:checkhanda(playerid, params[])
{
    new Float:Health, Float:Armour;
    GetPlayerHealth(playerid, Health);
    GetPlayerArmour(playerid, Armour);
    if ( Health == 100 && Armour == 100)
    {
         SendClientMessage(playerid, -1, "You Have Both Health And Armour Full"):
    }
    else
    {
        SendClientMessage(playerid, -1, "You Don't Have Your Health And Armour Full");
    }
    return 1;
}
If u want to check if he has armour and give another msg, tell me.. REP if HELPED


Re: How to create a command check? - Lajko1 - 20.11.2013

Well I made this, it will tell you how much Armor and Health you have... I'm not sure if this is exactly what you want..

pawn Код:
if(strcmp(cmd, "/check", true) == 0)
    {
    new string[100];
    new Float: AR;
    new Float: HP;
    GetPlayerArmour(playerid, Float:AR);
    GetPlayerHealth(playerid, Float:HP);
    format(string, sizeof(string), "Health: %f, Armor: %f",Float:HP, Float: AR);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
    return 1;
    }



Re: How to create a command check? - d0nTtoucH - 20.11.2013

I want to check whether it is full health and armour, and if to perform command.


Re: How to create a command check? - iPrivate - 20.11.2013

pawn Код:
if(strcmp(cmd, "/check", true) == 0)
{
    new string[100];
    new Float: AR;
    new Float: HP;
    GetPlayerArmour(playerid, Float:AR);
    GetPlayerHealth(playerid, Float:HP);
    if(AR == 100 && HP == 100);
    {
         //Command
    }
    return 1;
}



Re: How to create a command check? - d0nTtoucH - 20.11.2013

Thanks! Lock.