Jump to content

The vehicle did not want to go


Recommended Posts

Hi it's me again, my simple gamemode working but I have problem with drive cars. When I spawn Vehicle by the command /veh [name car] and I get in the car, the engine is not on and I cannot drive. Sory for so many unnecessary topics and all but I'm new and I'm learning. 

My Code:

[Command("veh", "Użyj: /veh [Nazwa pojazdu]", Alias = "vehicle")]
        public void CMD_Veh(Player player, string vehName) {

            if (!IPlayer.IsPlayerLoggedIn(player)) return;

            IPlayer iplayer = player.GetData<IPlayer>("PlayerData");

            if(!iplayer.HasAdminLevel((int)AdminRanks.Admin)) {

                player.SendChatMessage("Nie masz wystarczających uprawnień.");

            VehicleHash vehHash = NAPI.Util.VehicleNameToModel(vehName);

            if(vehHash == 0) {

                player.SendChatMessage("Nieprawidłowa nazwa pojazdu.");

            if(player.HasData("PlayerData.Temp.Adminveh")) {

                Vehicle old_veh = player.GetData<Vehicle>("PlayerData.Temp.Adminveh");

            Vehicle veh = NAPI.Vehicle.CreateVehicle(vehHash, player.Position, player.Rotation, 5, 5, "LS-BRAK", 0, false, true);
            player.SetIntoVehicle(veh, 0);

            player.SendNotification($"Pojazd {vehHash}, został stworzony poprawnie ");

            player.SetData("PlayerData.Temp.Adminveh", veh);

And he adds a video of how it works.


The video shows that the car does not respond to the "W" button, and it is not even turned on.

Edited by Nerdzik
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...