private async void StartFunctions(string status)
        {
            if (status.Length < 2)
            {
                return;
            }

            Debug.WriteLine(status);

            pStatus = JObject.Parse(status);

            if (pStatus.ContainsKey("Thirst") && pStatus.ContainsKey("Hunger"))
            {
                await Delay(1000);

                NUIEvents.UpdateHUD();

                Tick += MetabolismTimers;
                Tick += MetabolismUpdaters;
                Tick += MetabolismSaveDB;
                Tick += RadarControlHud;
                Tick += MetabolismSet;
            }
            loaded = true;
        }
        private async Task MetabolismTimers()
        {
            if (!loaded)
            {
                return;
            }

            await Delay(3000);

            if (pStatus["Thirst"].ToObject <int>() <= 0 && !API.IsPlayerDead(API.PlayerId()))
            {
                int newHealth = API.GetEntityHealth(API.PlayerPedId()) - 20;
                if (newHealth < 1)
                {
                    Function.Call((Hash)0x697157CED63F18D4, API.PlayerPedId(), 500000, false, true, true);
                }
                API.SetEntityHealth(API.PlayerPedId(), newHealth, 0);
            }
            if (pStatus["Hunger"].ToObject <int>() <= 0 && !API.IsPlayerDead(API.PlayerId()))
            {
                int newHealth = API.GetEntityHealth(API.PlayerPedId()) - 20;
                if (newHealth < 1)
                {
                    Function.Call((Hash)0x697157CED63F18D4, API.PlayerPedId(), 500000, false, true, true);
                }
                API.SetEntityHealth(API.PlayerPedId(), newHealth, 0);
            }

            await NUIEvents.UpdateHUD();
        }
        private async Task RadarControlHud()
        {
            if (!loaded)
            {
                return;
            }
            await Delay(1000);

            if (API.IsRadarHidden() && radarShow)
            {
                NUIEvents.ShowHUD(false);
                radarShow = false;
            }
            else if (!API.IsRadarHidden() && !radarShow)
            {
                NUIEvents.ShowHUD(true);
                radarShow = true;
            }

            if (API.IsPauseMenuActive() && radarShow)
            {
                NUIEvents.ShowHUD(false);
                radarShow = false;
            }
            else if (!API.IsPauseMenuActive() && !radarShow && !API.IsPlayerDead(API.PlayerId()))
            {
                NUIEvents.ShowHUD(true);
                radarShow = true;
            }
        }
        private async Task RadarControlHud()
        {
            if (!loaded)
            {
                return;
            }
            await Delay(1000);

            if ((API.IsRadarHidden()) || (API.IsPauseMenuActive()) || (!ApiCalls.APIShowOn) || (API.NetworkIsInSpectatorMode()) || (API.IsHudHidden()))
            {
                NUIEvents.ShowHUD(false);
            }
            else
            {
                NUIEvents.ShowHUD(true);
            }
        }
 private void ForceRespawn()
 {
     pStatus["Thirst"] = GetConfig.Config["OnRespawnThirstStatus"].ToObject <int>();
     pStatus["Hunger"] = GetConfig.Config["OnRespawnHungerStatus"].ToObject <int>();
     NUIEvents.UpdateHUD();
 }
Exemple #6
0
 private void setHud(bool enable)
 {
     NUIEvents.ShowHUD(enable);
 }