Guest User

I Am Hungry - NeedToEat System v0.1

a guest
Apr 2nd, 2010
2,536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.75 KB | None | 0 0
  1. // |.:I Am Hungry System by Zimon95:.|
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. //Includes
  6. #include <a_samp>
  7.  
  8. //--------------------------[Configuration]------------------------------------|
  9. #undef MAX_PLAYERS       //                                                    |
  10. #define MAX_PLAYERS 50  //Change this to your player slot amount               |
  11. #define N2E_TIME 600000//Edit this value to change the timer, now = 10 mins    |
  12. #define LOOSING_HP 5  //The HP the player will lose                            |
  13. //-----------------------------------------------------------------------------|
  14. #define COLOR_RED 0xFF6347AA
  15.  
  16. //Forwards
  17. forward NeedToEat(playerid);
  18.  
  19. //Arrays
  20. new FirstSpawn[MAX_PLAYERS];
  21. new Float:CurHealth[MAX_PLAYERS];
  22.  
  23. public OnFilterScriptInit()
  24. {
  25.     print("---------------------------------------");
  26.     print("   |.:NeedToEat System by Zimon95:.|   ");
  27.     print("-------------|Loaded|------------------");
  28.     return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33.     print("---------------------------------------");
  34.     print("   |.:NeedToEat System by Zimon95:.|   ");
  35.     print("------------|Unloaded|-----------------");
  36.     return 1;
  37. }
  38.  
  39. public OnPlayerSpawn(playerid)
  40. {
  41.     FirstSpawn[playerid] += 1;
  42.     new Float:health;
  43.     GetPlayerHealth(playerid, health);
  44.     CurHealth[playerid] = health;
  45.     if(FirstSpawn[playerid] == 1) SetTimerEx("NeedToEat",N2E_TIME,1,"i",playerid);
  46.     return 1;
  47. }
  48.  
  49. public NeedToEat(playerid)
  50. {
  51.     new Float:health;
  52.     GetPlayerHealth(playerid, health);
  53.     if(CurHealth[playerid] >= health)
  54.     {
  55.      SendClientMessage(playerid,COLOR_RED,"-| Your stomach starts to feel hungry, go eat something! |-");
  56.      SetPlayerHealth(playerid,health-LOOSING_HP);
  57.      CurHealth[playerid] = health;
  58.     }
  59.     else
  60.     {
  61.      CurHealth[playerid] = health;
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment