SA-MP Forums Archive
[Tutorial] Healing system tutorial - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Healing system tutorial (/showthread.php?tid=496281)



Healing system tutorial - NovaGaming - 21.02.2014

Hello people of samp its me NovaGaming today i bring you a tutorial of how to make a heal system

You need to have pawno else download from the website
Once you have openeded pawno
Press the white icon this creates a new filterscript or gamemode
depends on what you want do do

Go to onplayerstatechange(playerid,newstate,oldstate)
pawn Code:
type new float:Health; //this creates a float to store the health in
 GetPlayerHealth(playerid,Health);  //this gets the health of the player
 type if(Health< 100){ //this checks if the health is less then 100
 SetTimer("HealthTimer",6000,true);   //this creates a timer when the player is getting healed  6000 = 6 seconds
      }
 also type if(Health>100){ //checks if the health is higher then 100
 SetTimer("HealthTimer",6000,false); //this stops the timer from giving health to players
               }
under onplayerstatechange type
pawn Code:
forward HealthTimer(playerid); //this makes us use the function healthtimer
public HealthTimer(playerid){
new Float:Health;
GetPlayerHealth(playerid,Health);
if(health < 100){ //If the health is less then 100
SetPlayerHealth(playerid, health + 5.0); //Gives the player his currenthealth + 5
}
if(health > 100){ //if the health is higher then 100 do nothing
}
return 1;
}
End now we are done you now have your own health system
If you have any questions ask me below in the commands


Re: Healing system tutorial - AlonzoTorres - 21.02.2014

Jesus Christ, use
pawn Code:
// The [ PAWN ] tag.
this is not readable.


Re: Healing system tutorial - NovaGaming - 21.02.2014

done


Re: Healing system tutorial - Abagail - 21.02.2014

You should just make a command to start/stop healing. This is okay for a beginner, I guess.


Re: Healing system tutorial - Riddy - 21.02.2014

This is one badly structured tutorial. Please, take all the comments out of the pawn code or at least correctly indent and use comment tags (//).


Re: Healing system tutorial - NovaGaming - 21.02.2014

Common stop the hate its the first tutorial i ever did in samp


Re: Healing system tutorial - AlonzoTorres - 21.02.2014

We're only trying to help you Nova.


Re: Healing system tutorial - NovaGaming - 21.02.2014

Yes but it felt like you were hating me or some reason


Re: Healing system tutorial - Riddy - 21.02.2014

Quote:
Originally Posted by NovaGaming
View Post
Yes but it felt like you were hating me or some reason
Don't expect to me nice and lovely.


Fix the indentation, c'mon.


Re: Healing system tutorial - ]Rafaellos[ - 21.02.2014

pawn Code:
if(health > 100){ //if the health is higher then 100 do nothing
}
Remove it. No need to be there.