22.02.2009, 09:01
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
Atleast tell me how to make it
if (strcmp("/hp", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid,100);
return 1;
}
Originally Posted by Norn
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;
}