Пример #1
0
        //[Command("buyvipvehicle"), Help(HelpManager.CommandGroups.Vehicles, "Command used inside dealership to buy a vehicle.", null)]
        public void BuyVehicle(Client player)
        {
            //Check if can buy more cars.
            Character character = player.GetCharacter();
            Account   account   = player.GetAccount();

            if (account.VipLevel < 1)
            {
                player.SendChatMessage("You must be a VIP to use the VIP dealership.");
                return;
            }
            if (character.OwnedVehicles.Count >= VehicleManager.GetMaxOwnedVehicles(player))
            {
                API.SendChatMessageToPlayer(player, "You can't own anymore vehicles.");
                API.SendChatMessageToPlayer(player, "~g~NOTE: You can upgrade your VIP to increase your vehicle slots.");
                return;
            }

            var currentPos = API.GetEntityPosition(player);

            if (_dealershipsLocations.Any(dealer => currentPos.DistanceTo(dealer) < 5F))
            {
                API.TriggerClientEvent(player, "vipdealership_showbuyvehiclemenu", API.ToJson(_motorsycles),
                                       API.ToJson(_copues), API.ToJson(_trucksnvans), API.ToJson(_offroad), API.ToJson(_musclecars),
                                       API.ToJson(_suv), API.ToJson(_supercars));
            }
            else
            {
                API.SendChatMessageToPlayer(player, "You aren't near any dealership.");
            }
        }
Пример #2
0
        public void BuyVehicle(Player player)
        {
            //Check if can buy more cars.
            Character character = player.GetCharacter();

            if (character.OwnedVehicles.Count >= VehicleManager.GetMaxOwnedVehicles(player))
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You can't own anymore vehicles.");
                NAPI.Chat.SendChatMessageToPlayer(player, "~g~NOTE: You can buy VIP to increase your vehicle slots.");
                return;
            }

            var currentPos = NAPI.Entity.GetEntityPosition(player);

            if (_dealershipsLocations.Any(dealer => currentPos.DistanceTo(dealer) < 5F))
            {
                if (NAPI.Player.IsPlayerInAnyVehicle(player))
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, "You're not able to buy a vehicle while in a vehicle!");
                    return;
                }

                NAPI.ClientEvent.TriggerClientEvent(player, "dealership_showbuyvehiclemenu", NAPI.Util.ToJson(_motorsycles),
                                                    NAPI.Util.ToJson(_copues), NAPI.Util.ToJson(_trucksnvans), NAPI.Util.ToJson(_offroad), NAPI.Util.ToJson(_musclecars),
                                                    NAPI.Util.ToJson(_suv), NAPI.Util.ToJson(_supercars), NAPI.Util.ToJson(_cycles), NAPI.Util.ToJson(_sedans), NAPI.Util.ToJson(_sportsCars), NAPI.Util.ToJson(_compactCars));
            }
            else
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You aren't near any dealership.");
            }
        }
Пример #3
0
        public void BuyVehicle(Client player)
        {
            //Check if can buy more cars.
            Character character = player.GetCharacter();

            if (NAPI.Player.IsPlayerInAnyVehicle(player))
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You're not able to buy a boat while in a vehicle!");
                return;
            }

            if (character.OwnedVehicles.Count >= VehicleManager.GetMaxOwnedVehicles(player))
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You can't own anymore vehicles.");
                NAPI.Chat.SendChatMessageToPlayer(player, "~g~NOTE: You can buy VIP to increase your vehicle slots.");
                return;
            }

            var currentPos = NAPI.Entity.GetEntityPosition(player);

            if (_dealershipsLocations.Any(dealer => currentPos.DistanceTo(dealer) < 5F))
            {
                NAPI.ClientEvent.TriggerClientEvent(player, "dealership_showbuyboatmenu", NAPI.Util.ToJson(_boats));
            }
            else
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You aren't near any dealership.");
            }
        }
Пример #4
0
        public void BuyVehicle(Client player)
        {
            //Check if can buy more cars.
            Character character = player.GetCharacter();
            Account   account   = player.GetAccount();

            /*if (account.VipLevel < 1)
             * {
             *  player.SendChatMessage("You must be a VIP to use the chopper dealership.");
             *  return;
             * }
             */



            if (character.OwnedVehicles.Count >= VehicleManager.GetMaxOwnedVehicles(player))
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You can't own anymore vehicles.");
                NAPI.Chat.SendChatMessageToPlayer(player, "~g~NOTE: You can upgrade your VIP to increase your vehicle slots.");
                return;
            }

            var currentPos = NAPI.Entity.GetEntityPosition(player);

            if (_dealershipsLocations.Any(dealer => currentPos.DistanceTo(dealer) < 5F))
            {
                if (NAPI.Player.IsPlayerInAnyVehicle(player))
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, "You're not able to buy a chopper while in a vehicle!");
                    return;
                }

                NAPI.ClientEvent.TriggerClientEvent(player, "chopperdealership_showbuyvehiclemenu", NAPI.Util.ToJson(_helicopters));
            }
            else
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You aren't near any dealership.");
            }
        }