Exemplo n.º 1
0
 private void UpdateMoneyDecor()
 {
     if (Game.PlayerPed != null)
     {
         EntityDecoration.Set(Game.PlayerPed, PNAME_MONEY, MONEY);
     }
 }
Exemplo n.º 2
0
 private void UpdateLevelDecor()
 {
     if (Game.PlayerPed != null)
     {
         EntityDecoration.Set(Game.PlayerPed, PNAME_LEVEL, LVL);
     }
 }
Exemplo n.º 3
0
        private async Task OnTick()
        {
            Ped playerPed; Vehicle veh;

            if ((playerPed = LocalPlayer.Character) != null && (veh = playerPed.CurrentVehicle) != null)
            {
                if (!EntityDecoration.HasDecor(veh, VEH_FUEL_DECOR))
                {
                    veh.FuelLevel = Utils.GetRandomFloat(VEH_FUEL_MAX);
                    EntityDecoration.Set(veh, VEH_FUEL_DECOR, veh.FuelLevel);
                }
                else
                {
                    if (veh.GetPedOnSeat(VehicleSeat.Driver) == playerPed && !veh.IsInAir)
                    {
                        float newFuelLevel = EntityDecoration.Get <float>(veh, VEH_FUEL_DECOR) - veh.Speed * 0.01f;
                        if (newFuelLevel < 0f)
                        {
                            newFuelLevel = 0f;
                        }
                        EntityDecoration.Set(veh, VEH_FUEL_DECOR, newFuelLevel);
                    }

                    veh.FuelLevel = EntityDecoration.Get <float>(veh, VEH_FUEL_DECOR);

                    if (veh.FuelLevel == 0f)
                    {
                        Screen.DisplayHelpTextThisFrame("No Fuel left");
                    }
                    else if (veh.FuelLevel < VEH_FUEL_WARNING_THRESHOLD)
                    {
                        Screen.DisplayHelpTextThisFrame("Low Fuel Level");
                    }
                }
            }

            await Task.FromResult(0);
        }