• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[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 :
 
Initiate Mage
Joined
Jul 31, 2008
Messages
2
Reaction score
0
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

I need code for all user can use this.
 
Initiate Mage
Joined
Jul 31, 2009
Messages
4
Reaction score
0
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

I need code for all user can use this.

Code:
if(strcmp(cmd, "/healme", true) == 0){
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
return 1;
}
 
Last edited:
Junior Spellweaver
Joined
Apr 12, 2008
Messages
105
Reaction score
1
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?
 
Newbie Spellweaver
Joined
Jun 4, 2009
Messages
17
Reaction score
0
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
 
Initiate Mage
Joined
Dec 7, 2009
Messages
1
Reaction score
0
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:
Newbie Spellweaver
Joined
Feb 22, 2007
Messages
10
Reaction score
0
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);
		 }
	}
 
Experienced Elementalist
Joined
Sep 16, 2009
Messages
271
Reaction score
11
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

yeah, where do i have to put this code?
 
Junior Spellweaver
Joined
Apr 6, 2009
Messages
141
Reaction score
10
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..
 
Joined
Aug 15, 2006
Messages
944
Reaction score
53
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 ^_^
 
Newbie Spellweaver
Joined
Aug 8, 2008
Messages
30
Reaction score
6
Re: [Tutorial] [SA-MP] Restore Health / Armor Command

How to add it to a team if the gamemode have 2 teams?