[Tutorial] Healing system tutorial
#1

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
Reply
#2

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

done
Reply
#4

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

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 (//).
Reply
#6

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

We're only trying to help you Nova.
Reply
#8

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

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)