Ejemplo n.º 1
0
        private void OnClientResourceStart(string resourceName)
        {
            if (API.GetCurrentResourceName() != resourceName)
            {
                return;
            }

            API.DecorRegister(DECOR_NAME_STATUS, 3);
            API.DecorRegister(DECOR_NAME_XY, 3);
            API.DecorRegister(DECOR_NAME_Z, 3);
            API.DecorRegister(DECOR_NAME_BRIGHTNESS, 3);

            API.RegisterCommand("spotlight", new Action <int, List <object>, string>(async(src, args, raw) =>
            {
                await ToggleSpotlight();
            }), false);

            API.RegisterCommand("spotlightaim", new Action <int, List <object>, string>(async(src, args, raw) =>
            {
                var vehicle = API.GetVehiclePedIsIn(API.GetPlayerPed(-1), false);

                switch (args[0])
                {
                case "up":
                    await MoveSpotlightVertical(true);
                    break;

                case "down":
                    await MoveSpotlightVertical(false);
                    break;

                case "left":
                    await MoveSpotlightHorizontal(true);
                    break;

                case "right":
                    await MoveSpotlightHorizontal(false);
                    break;
                }
            }), false);

            API.RegisterKeyMapping("spotlight", "Toggle spotlight", "keyboard", "l");
            API.RegisterKeyMapping("spotlightaim up", "Aim spotlight up", "keyboard", "prior");
            API.RegisterKeyMapping("spotlightaim down", "Aim spotlight down", "keyboard", "pagedown");
            API.RegisterKeyMapping("spotlightaim left", "Aim spotlight left", "keyboard", "delete");
            API.RegisterKeyMapping("spotlightaim right", "Aim spotlight right", "keyboard", "end");
        }