/hp command
#1

Hey! I'm a new in these thing and can someone give me a code for command /hp, when player writes it, he gets 100 hp.
Atleast tell me how to make it
Reply
#2

pawn Код:
if (strcmp("/hp", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid,100);
        return 1;
    }
There you are buddy, atleast you've actually smiled in your post, unlike others :P

It brightens up my morning.
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)