public bool IsNearPropertyStorage()
        {
            var storageLocations = LocalSession.GetLocalData("Property.AccessableStorages", new JArray()).ToObject <List <Vector3> >();
            var playerPos        = Cache.PlayerPed.Position;

            return(storageLocations.Any(o => o.DistanceToSquared(playerPos) < Math.Pow(3, 2)));
        }
예제 #2
0
        private async Task FishingTick()
        {
            if (!IsEntityPlayingAnim(Cache.PlayerPed.Handle, "amb@world_human_stand_fishing@base", "base", 3))
            {
                Client.TriggerServerEvent("Fishing.CancelFishing");
                fishingAnim.End(Cache.PlayerPed);
                Client.DeregisterTickHandler(FishingTick);
            }

            if (!LocalSession.GetLocalData("Character.IsFishing", false))
            {
                fishingAnim.End(Cache.PlayerPed);
                Client.DeregisterTickHandler(FishingTick);
            }
        }
        private async void OnInteraciton()
        {
            var closeVault = GetStoreInRange();

            if (closeVault.Key != null)
            {
                if (!safeInstance.IsSafeDoorOpen() || currentRobberyLocation != closeVault.Key)
                {
                    var vaultObj = API.GetClosestObjectOfType(closeVault.Value.X, closeVault.Value.Y, closeVault.Value.Z, 3.0f, (uint)ObjectHash.v_ilev_gangsafe, false, false, false);
                    var doorObj  = API.GetClosestObjectOfType(closeVault.Value.X, closeVault.Value.Y, closeVault.Value.Z, 3.0f, unchecked ((uint)ObjectHash.v_ilev_gangsafedoor), false, false, false);
                    currentRobberyLocation = closeVault.Key;
                    var robbable = await awaitRobResult("Robbery.CheckCanRobStore", closeVault.Key);

                    if (robbable)
                    {
                        safeInstance.InitializeSafe(vaultObj, doorObj, new List <int>
                        {
                            rand.Next(1, 90),
                            rand.Next(1, 90),
                            rand.Next(1, 90),
                            rand.Next(1, 90),
                            rand.Next(1, 90),
                            rand.Next(1, 90),
                        }, SafeCracking.RotationDirections.Clockwise);
                        startVaultOpen();
                    }
                }
                else if (safeInstance.IsSafeDoorOpen() && LocalSession.GetLocalData("Robbery.CanRequestPayout", false))
                {
                    await BaseScript.Delay(0);

                    Client.TriggerServerEvent("Robbery.RequestPayout", closeVault.Key);
                }
            }

            /*var closeRegister = GTAHelpers.GetObjectInRange(ObjectHash.prop_till_01);
             *
             * if (closeRegister != 0)
             * {
             *  var closeStore = GetStoreInRange(20.0f);
             *  if (closeStore.Key == null) return;
             *
             *  Client.TriggerServerEvent("Robbery.Store.AttemptRegisterRobbery", closeStore.Key, Entity.FromHandle(closeRegister).Position);
             * }*/
        }
예제 #4
0
        public AdminMenu(Client client) : base(client)
        {
            adminOptions = new AdminOptions();
            client.Get <InteractionUI>().RegisterInteractionMenuItem(new MenuItemSubMenu
            {
                Title   = "[ADMIN] Admin menu",
                SubMenu = adminOptions
            }, () => canUseMenu, 1010);

            client.RegisterEventHandler("Player.OnLoginComplete", new Action(() =>
            {
                canUseMenu = LocalSession.GetLocalData("User.PermissionLevel", 0) > 0;
            }));
            client.RegisterEventHandler("Admin.GoToTarget", new Action <int>(async target =>
            {
                CitizenFX.Core.Player targetPlayer = new CitizenFX.Core.Player(GetPlayerFromServerId(target));
                Vector3 targetCoords = targetPlayer.Character.Position;

                await Game.PlayerPed.TeleportToLocation(targetCoords);
            }));

            client.RegisterTickHandler(CheckForMenu);
        }
예제 #5
0
        private async Task CheckForMenu()
        {
            await BaseScript.Delay(10000);

            canUseMenu = LocalSession.GetLocalData("User.PermissionLevel", 0) > 0;
        }
예제 #6
0
 public List <int> GetOwnedVehicles()
 {
     return(LocalSession.GetLocalData("Vehicles.OwnedVehicles", new JArray()).ToObject <List <int> >());
 }
예제 #7
0
 public List <int> GetVehiclesWithKeys()
 {
     return(LocalSession.GetLocalData("Vehicles.AccessibleVehicles", new JArray()).ToObject <List <int> >());
 }