KaLu17

Hungry Scripts

Apr 10th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.25 KB | None | 0 0
  1.  
  2. #define FILTERSCRIPT
  3.  
  4. #include <a_samp>
  5.  
  6.  
  7. #undef  MAX_PLAYERS                                                        
  8. #define MAX_PLAYERS     50  //Change this to your player slot amount              
  9. #define N2E_TIME    600000//Edit this value to change the timer, now = 10 mins    
  10. #define LOOSING_HP  5  //The HP the player will lose                            
  11.  
  12. #define COLOR_RED   0xFF6347AA
  13.  
  14. forward NeedToEat(playerid);
  15.  
  16. new FirstSpawn[MAX_PLAYERS];
  17. new Float:CurHealth[MAX_PLAYERS];
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     print("Zimon95");
  22.     return 1;
  23. }
  24.  
  25. public OnFilterScriptExit()
  26. {
  27.     print("Zimon95");
  28.     return 1;
  29. }
  30.  
  31. public OnPlayerSpawn(playerid)
  32. {
  33.         FirstSpawn[playerid] += 1;
  34.         new Float:health;
  35.         GetPlayerHealth(playerid, health);
  36.         CurHealth[playerid] = health;
  37.         if(FirstSpawn[playerid] == 1) SetTimerEx("NeedToEat", N2E_TIME, 1, "i", playerid);
  38.     return 1;
  39. }
  40.  
  41. public NeedToEat(playerid)
  42. {
  43.         new Float:health;
  44.         GetPlayerHealth(playerid, health);
  45.     if(CurHealth[playerid] >= health)
  46.     {
  47.         SendClientMessage(playerid, COLOR_RED,"Zaczynasz powoli robić się głodny.");
  48.         SetPlayerHealth(playerid, (health - LOOSING_HP));
  49.         CurHealth[playerid] = health;
  50.     }
  51.     else
  52.     {
  53.         CurHealth[playerid] = health;
  54.         }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment