/hp command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /hp command (
/showthread.php?tid=66462)
/hp command -
SweetBoyz - 22.02.2009
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
Re: /hp command -
Norn - 22.02.2009
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.
Re: /hp command -
Coicatak - 22.02.2009
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