Exemplo n.º 1
0
        public void cmd_V(Client player, string input)
        {
            string[] param = input.Split(null);

            if (param[0] == "lista")
            {
                Dictionary <int, int> vehicles = VehicleClass.ListPlayerVehicles(player);
                if (vehicles.Count > 0)
                {
                    string json = API.toJson(vehicles);
                    API.triggerClientEvent(player, "vehicle_select", json);
                }
                else
                {
                    API.sendNotificationToPlayer(player, "Nie posiadasz żadnego pojazdu.");
                    return;
                }
            }
            if (param[0] == "zamknij" || param[0] == "z")
            {
                NetHandle vehicle = VehicleClass.GetNearestVehicle(player.position, 5f);

                if (!VehicleClass.IsPlayerHasPermForVehicle(player, vehicle))
                {
                    API.sendNotificationToPlayer(player, "Nie jesteś właścicielem tego pojazdu.");
                    return;
                }

                bool lk = !API.getVehicleLocked(vehicle);
                API.setVehicleLocked(vehicle, lk);
                API.sendNotificationToPlayer(player, (lk ? "Zamknąłeś" : "Otworzyłeś") + " pojazd!");
            }
            if (param[0] == "zaparkuj")
            {
                if (!API.isPlayerInAnyVehicle(player))
                {
                    API.sendNotificationToPlayer(player, "Nie znajdujesz się w żadnym pojeździe.");
                    return;
                }

                NetHandle    vehicle = API.getPlayerVehicle(player);
                VehicleClass vc      = API.getEntityData(vehicle, "data");

                if (!VehicleClass.IsPlayerHasPermForVehicle(player, vehicle))
                {
                    API.sendNotificationToPlayer(player, "Nie jesteś właścicielem tego pojazdu.");
                    return;
                }

                VehicleClass.ParkVehicle(vehicle);
                API.sendNotificationToPlayer(player, "Pomyślnie zaparkowano pojazd.");
            }
        }