Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new PlayersHungerTimer[MAX_PLAYERS];
- new PlayersHungerHealTimer[MAX_PLAYERS];
- enum pInfo
- {
- pHunger
- };
- OnPlayerRegister
- {
- PlayerInfo[playerid][pHunger] = 100;
- }
- public OnPlayerConnect(playerid)
- {
- PlayersHungerTimer[playerid] = SetTimerEx("HungerRemoval", 30000, 1, "i", playerid);
- PlayersHungerHealTimer[playerid] = SetTimerEx("HungerHealthAddition", 60000, 1, "i", playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- KillTimer(PlayersHungerHealTimer[playerid]);
- KillTimer(PlayersHungerTimer[playerid]);
- return 1;
- }
- forward HungerHealthAddition(playerid);
- public HungerHealthAddition(playerid)
- {
- new Float:health;
- if(PlayerInfo[playerid][pHunger] == 100)
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health+10);
- }
- if(PlayerInfo[playerid][pHunger] > 100 && GetPlayerHealth(playerid, health) < 100)
- {
- new healthh = 0;
- healthh = PlayerInfo[playerid][pHunger] - 100;
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health+health);
- }
- }
- forward HungerRemoval(playerid);
- public HungerRemoval(playerid)
- {
- PlayerInfo[playerid][pHunger] -= 10;
- if(PlayerInfo[playerid][pHunger] <= 0)
- {
- new Float:health;
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement