[Tutorial] [SA:MP] Restore Health / Armor Command

Newbie Spellweaver
Joined
Oct 15, 2008
Messages
10
Reaction score
1
Hello =),

i want to show you how to create command for restore health and armor it's so easy !.

to OnPlayerCommandText:
PHP:
if(strcmp(cmd, "/hpap", true) == 0){
if(!IsPlayerAdmin(playerid)){ // check if player is admin
	SendClientMessage(playerid, 0xFF0000FF, "You aren't admin.");
   return 1;
 }else{
    SetPlayerHealth(playerid, 100); // set player's hp to 100
    SetPlayerArmour(playerid, 100); // set player's armor to 100
    SendClientMessage(playerid, 0x00FF00FF, "[-Admin-] Hp: **** Ap: 100 !");
    }
 return 1;
}

that's all :):
 
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

Nice one.

Maybe what you can do to improve it is to tell people what each line means or something?
 
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

where i have to put it in?

im new i have first server but i dont know how to script it in
 
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

where i have to put it in?

im new i have first server but i dont know how to script it in

Code:
[COLOR="Blue"]public[/COLOR] OnPlayerCommandText(playerid, cmdtext[])
{

if(strcmp(cmd, "/healme", true) == 0)
{
  [INDENT] SetPlayerHealth(playerid,100); [COLOR="SeaGreen"]// Sets the player health to 100.[/COLOR]
   SetPlayerArmour(playerid,100); [COLOR="SeaGreen"]// Sets the player armor to 100.[/COLOR]
   return 1; [COLOR="SeaGreen"]// Return 'true' OR '1' is used to notify the server that the command has successfully been processed.[/INDENT][/COLOR]}
return 0;
}

There you go.
 
Last edited:
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

anyone can tell how to do this..? where to put this please.. i am newby in gta sa multiplayer :(
 
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

To heal all..
Code:
	if(strcmp(cmd,"/healall",true) == 0)
	{
	    for(new i = 0; i <= MAX_PLAYERS; i++)
	    {
	        SetPlayerHealth(i,100);
	        SetPlayerArmour(i,100);
		 }
	}
 
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

Are you kidding me? Get pawno. Add it to OnPlayerCommandText. Run you're server.

I can tell mostly everyone here sucks at scripting if they haven't even looked at the SA-MP site WHICH HAS THE SERVER FILES IN THE DOWNLOADS SECTION AND A FORUM FOR BETTER HELP..
 
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

I can tell mostly everyone here sucks at scripting if they haven't even looked at the SA-MP site WHICH HAS THE SERVER FILES IN THE DOWNLOADS SECTION AND A FORUM FOR BETTER HELP..
True, but not everyone has what it takes to be a good scripter.. :tongue:
please don't advertise other forums ^_^
 
Back