/hp command
#3

Quote:
Originally Posted by Norn
pawn Код:
if (strcmp("/hp", cmdtext, true, 10) == 0)
Why 10?

pawn Код:
#define color // Your color code here
if(!strcmp("/hp", cmdtext, true, 3) // 3 is the lenght. 1 for '/', 2 for 'h' and 3 for 'p'
// but you have another command starting by /hp it won't work
{
    if(cmdtext[3] == 0)
    {
        SendClientMessage(playerid, color, "USAGE: /hp [health]");
        return 1;
    }
    SetPlayerHealth(playerid, cmdtext[4]);
    SendClientMessage(playerid, color, "You have healed yourself to %d health", cmdtext[4])"
    return 1;
}
if(!strcmp("
/armor", cmdtext, true, 6)
{
    if(cmdtext[6] == 0)
    {
        SendClientMessage(playerid, color, "
USAGE: /armor [ammount]");
        return 1;
    }
    SetPlayerArmor(playerid, cmdtext[7]);
    SendClientMessage(playerid, color, "
You have given yourself %d armor", cmdtext[7])"
    return 1;
}
This will set your HP or Armor to the ammount you typed after the command. If you want limited ammount it's simple to add
Reply


Messages In This Thread
/hp command - by SweetBoyz - 22.02.2009, 09:01
Re: /hp command - by Norn - 22.02.2009, 09:06
Re: /hp command - by Coicatak - 22.02.2009, 21:36

Forum Jump:


Users browsing this thread: 1 Guest(s)