nordi Posted August 29, 2015 Share Posted August 29, 2015 Hey I would like to spawn 2 cops inside a police car, and have them drive to my position, but for some reason it's not working: the cops do spawn inside the police car, car have lights and siren on, but the vehicle seems to be stuck: the cop do try and drive (he turns the wheels, try to accelerate) but it's like the handbrake is on / something prevent the car from moving... I did try to set freezeposition = false, and HandbrakeOn to false, but it's still not working. It's only doing these with police cars, but the same code works for every other vehicles ... Model m0 = new Model("POLICE"); m0.Request(1000); if (m0.IsInCdImage && m0.IsValid) { // If the model isn't loaded, wait until it is while (!m0.IsLoaded) { Wait(0); } backupcar = World.CreateVehicle(m0.Hash, GTA.Game.Player.Character.Position.Around(100)); backupcar.PlaceOnNextStreet(); backupcar.PlaceOnGround(); backupcar.SirenActive = true; } Model m1 = new Model(PedHash.Cop01SMY); m1.Request(1000); // Check to see if the model is valid (just to make sure you are not given a null exception) if (m1.IsInCdImage && m1.IsValid) { // If the model isn't loaded, wait until it is while (!m1.IsLoaded) { Wait(0); } pBackup1 = World.CreatePed(m1.Hash, backupcar.Position.Around(1)); Wait(5); pBackup1.SetIntoVehicle(backupcar, VehicleSeat.Driver); pBackup1.Weapons.Give(WeaponHash.Pistol, 1000, true, true); pBackup2 = World.CreatePed(m1.Hash, backupcar.Position.Around(1)); Wait(5); pBackup2.SetIntoVehicle(backupcar, VehicleSeat.RightFront); Wait(50); pBackup2.Weapons.Give(WeaponHash.Pistol, 1000, true, true); } Backuploc = Game.Player.Character.Position; } Wait(100); pBackup1.Task.DriveTo(backupcar, Backuploc, 12, 16, 1); Thanks. Link to comment Share on other sites More sharing options...
MoMadenU Posted August 29, 2015 Share Posted August 29, 2015 Hey I would like to spawn 2 cops inside a police car, and have them drive to my position, but for some reason it's not working: the cops do spawn inside the police car, car have lights and siren on, but the vehicle seems to be stuck: the cop do try and drive (he turns the wheels, try to accelerate) but it's like the handbrake is on / something prevent the car from moving... I did try to set freezeposition = false, and HandbrakeOn to false, but it's still not working. It's only doing these with police cars, but the same code works for every other vehicles ... Model m0 = new Model("POLICE"); m0.Request(1000); if (m0.IsInCdImage && m0.IsValid) { // If the model isn't loaded, wait until it is while (!m0.IsLoaded) { Wait(0); } backupcar = World.CreateVehicle(m0.Hash, GTA.Game.Player.Character.Position.Around(100)); backupcar.PlaceOnNextStreet(); backupcar.PlaceOnGround(); backupcar.SirenActive = true; } Model m1 = new Model(PedHash.Cop01SMY); m1.Request(1000); // Check to see if the model is valid (just to make sure you are not given a null exception) if (m1.IsInCdImage && m1.IsValid) { // If the model isn't loaded, wait until it is while (!m1.IsLoaded) { Wait(0); } pBackup1 = World.CreatePed(m1.Hash, backupcar.Position.Around(1)); Wait(5); pBackup1.SetIntoVehicle(backupcar, VehicleSeat.Driver); pBackup1.Weapons.Give(WeaponHash.Pistol, 1000, true, true); pBackup2 = World.CreatePed(m1.Hash, backupcar.Position.Around(1)); Wait(5); pBackup2.SetIntoVehicle(backupcar, VehicleSeat.RightFront); Wait(50); pBackup2.Weapons.Give(WeaponHash.Pistol, 1000, true, true); } Backuploc = Game.Player.Character.Position; } Wait(100); pBackup1.Task.DriveTo(backupcar, Backuploc, 12, 16, 1); Thanks. I was able to make it work, however for my vehicle spawn location I used: Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 10, 0)); Even with PlaceOnGround called, if a vehicle is spawed either above or below ground it will not be drivable. -HTH Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now