示例#1
0
        private async Task ToggleSpotlight()
        {
            var vehicle = API.GetVehiclePedIsIn(API.GetPlayerPed(-1), false);

            if (API.GetVehicleClass(vehicle) == 18 || !Config.GetValueBool(Config.EMERGENCY_ONLY, true))
            {
                if (IsSpotlightEnabled(vehicle))
                {
                    API.DecorSetBool(vehicle, DECOR_NAME_STATUS, false);
                    API.DecorSetFloat(vehicle, DECOR_NAME_BRIGHTNESS, 0f);
                }
                else
                {
                    API.DecorSetBool(vehicle, DECOR_NAME_STATUS, true);
                    await TranslateDecorSmoothly(vehicle, DECOR_NAME_BRIGHTNESS, 0f, Config.GetValueFloat(Config.BRIGHTNESS_LEVEL, 30f), 30);
                }
            }
            await Task.FromResult(0);
        }
示例#2
0
        private async Task MoveSpotlightVertical(bool up)
        {
            var vehicle = API.GetVehiclePedIsIn(API.GetPlayerPed(-1), Config.GetValueBool(Config.REMOTE_CONTROL, true));
            var current = API.DecorGetFloat(vehicle, DECOR_NAME_Z);

            if (up)
            {
                if (current <= 0.1f)
                {
                    await TranslateDecorSmoothly(vehicle, DECOR_NAME_Z, current, current + 0.1f, 10);
                }
            }
            else
            {
                if (current >= -1.2f)
                {
                    await TranslateDecorSmoothly(vehicle, DECOR_NAME_Z, current, current - 0.1f, 10);
                }
            }
        }
示例#3
0
        private static bool IsSpotlightUsageAllowed(int handle)
        {
            int  vehicleClass = API.GetVehicleClass(handle);
            bool isHelicopter = vehicleClass == 15;
            bool isEmergency  = vehicleClass == 18;

            if (isHelicopter)
            {
                if (Config.GetValueBool(Config.HELICOPTER_SUPPORT, true))
                {
                    if (Config.GetValueBool(Config.HELICOPTER_POLMAV_ONLY, false))
                    {
                        if (API.IsVehicleModel(handle, (uint)API.GetHashKey("polmav")))
                        {
                            return(true);
                        }
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }

            if (VehicleHasRotatableTargetBone(handle) && Config.GetValueBool(Config.TURRET_SUPPORT, true))
            {
                return(true);
            }

            if (isEmergency || !Config.GetValueBool(Config.EMERGENCY_ONLY, true))
            {
                return(true);
            }

            return(true);
        }
示例#4
0
        private async Task MoveSpotlightHorizontal(bool left)
        {
            var vehicle = API.GetVehiclePedIsIn(API.GetPlayerPed(-1), Config.GetValueBool(Config.REMOTE_CONTROL, true));
            var current = API.DecorGetFloat(vehicle, DECOR_NAME_XY);

            Debug.WriteLine(Config.GetValueFloat(Config.RANGE_LEFT, 90f).ToString());
            if (left)
            {
                if (current <= Config.GetValueFloat(Config.RANGE_LEFT, 90f))
                {
                    await TranslateDecorSmoothly(vehicle, DECOR_NAME_XY, current, current + 10f, 10);
                }
            }
            else
            {
                if (current >= -Config.GetValueFloat(Config.RANGE_RIGHT, 30f))
                {
                    await TranslateDecorSmoothly(vehicle, DECOR_NAME_XY, current, current - 10f, 10);
                }
            }
        }
示例#5
0
 private static void DrawSpotlightLabel(bool status)
 {
     API.SetTextFont(0);
     API.SetTextProportional(true);
     API.SetTextScale(0.0f, 0.3f);
     if (status)
     {
         API.SetTextColour(144, 238, 144, 255);
     }
     else
     {
         API.SetTextColour(238, 144, 144, 255);
     }
     API.SetTextDropshadow(0, 0, 0, 0, 255);
     API.SetTextEdge(1, 0, 0, 0, 255);
     API.SetTextDropShadow();
     API.SetTextOutline();
     API.SetTextEntry("STRING");
     API.AddTextComponentString("Spotlight: " + (status ? "ON" : "OFF"));
     API.SetTextRightJustify(Config.GetValueBool(Config.MESSAGE_RIGHT_ALIGNED, false));
     API.DrawText(0.005f, 0.480f);
 }