Advertisement
Guest User

regenhp1b

a guest
Jun 18th, 2011
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.03 KB | None | 0 0
  1. /*Simple HP Regeneration by []Miller[]
  2. Like call of duty :D
  3.  
  4. Version: 1b
  5. Fixed bugs*/
  6.  
  7. #include <a_samp>
  8.  
  9. new HPreg;
  10.  
  11. forward HPregen(playerid);
  12.  
  13. public OnFilterScriptInit()
  14. {
  15.     print("\n--------------------------------------");
  16.     print(" blah blah blah by []Miller[]");
  17.     print("--------------------------------------\n");
  18.     return 1;
  19. }
  20.  
  21. public OnFilterScriptExit()
  22. {
  23.     //wanna add something?
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerSpawn(playerid)
  28. {
  29.     HPreg = SetTimer("HPregen",1000,true); //Setting timer when player spawn
  30.     SetPlayerHealth(playerid, 100); //let's set health to 100
  31. }
  32.  
  33. public HPregen(playerid)
  34. {
  35.     new Float:pHealth;
  36.     GetPlayerHealth(playerid, pHealth);
  37.     if(pHealth <= 100) SetPlayerHealth(playerid, pHealth+1); // regenerates +1 hp per 1,000 ms
  38.     if(pHealth <= 20)
  39.     {
  40.         GameTextForPlayer(playerid,"~r~You're low in health, Find some cover before taking more damage!",3000,3); // announcing that you have low health while regenerating
  41.     }
  42.     if(pHealth == 100) KillTimer(HPreg); //Health is full!
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement