Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

abdelmoez

Vehicle is moving back and forth

Recommended Posts

abdelmoez

hi guys

 

i wrote a script in c# for gta v

 

i create Ped and vehicle and i give to the Ped a target so he will to

 

but when the ped enter the car and drive he do strange thing he drive 1 cm forward the 1 cm backward !!!

 

this is my code

vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 17f), 228f);                var ped = World.CreatePed(PedHash.Marine01SMM, new GTA.Math.Vector3(-1572f, 2772f, 17f));                ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f),70f, 550f);Function.Call(Hash.SET_PED_INTO_VEHICLE, ped, vehicle, -1f); 
by the way in the drive to task the 3rd argument is radius and i dont know what should i put for so i keep it 70

 

 

Share this post


Link to post
Share on other sites
Jitnaught
vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 17f), 228f);            var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, PedHash.Marine01SMM); //create ped directly on seat instead of spawning, tasking to drive, then warping ped into vehicle            ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f), 10f, 50f); //70 meters is quite far away, and I don't think 550 meters per second is even possible in GTA

No idea if this will help, but they are some things that I thought could be improved.

Share this post


Link to post
Share on other sites
bhavinbhai2707

hi guys

 

i wrote a script in c# for gta v

 

i create Ped and vehicle and i give to the Ped a target so he will to

 

but when the ped enter the car and drive he do strange thing he drive 1 cm forward the 1 cm backward !!!

 

this is my code

vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 17f), 228f);                var ped = World.CreatePed(PedHash.Marine01SMM, new GTA.Math.Vector3(-1572f, 2772f, 17f));                ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f),70f, 550f);Function.Call(Hash.SET_PED_INTO_VEHICLE, ped, vehicle, -1f); 

by the way in the drive to task the 3rd argument is radius and i dont know what should i put for so i keep it 70

 

heyyy i found some mistakes

1. i suggest u too use ped.setintovehicle bcause its implemented in scripthook so why to mess up with params n yess use it before driveto function because u know c# compiles line by line so it will first give command to drive n then set which is not right n check ur params i think u r doing something wrong or either upload the native over here so i can check because m in phone so its difficult to browse native db

 

n about radius it means that upto how much distance around destination u want to drive

 

for ex:- if u put radius 5f the ped will drive around 5f radius of desti point :)

Share this post


Link to post
Share on other sites
abdelmoez

Thanks both for replying

but the vehicle is still moving so slow and back and forth !!

Share this post


Link to post
Share on other sites
Jitnaught

check ur params i think u r doing something wrong or either upload the native over here so i can check because m in phone so its difficult to browse native db

Besides him making the third parameter a float he did nothing wrong.

void SET_PED_INTO_VEHICLE(Ped ped, Vehicle vehicle, int seatIndex) //correct function params

-1 (int) is the driver's seat.

Share this post


Link to post
Share on other sites
abdelmoez

 

check ur params i think u r doing something wrong or either upload the native over here so i can check because m in phone so its difficult to browse native db

Besides him making the third parameter a float he did nothing wrong.

void SET_PED_INTO_VEHICLE(Ped ped, Vehicle vehicle, int seatIndex) //correct function params

-1 (int) is the driver's seat.

 

 

I changed my code to this and nothing changed '

vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 20f), 228f);var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, PedHash.Marine01SMM); //create ped directly on seat instead of spawning, tasking to drive, then warping ped into vehicleped.SetIntoVehicle(vehicle, VehicleSeat.Driver);ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f), 10f, 50f); //70 meters is quite far away, and I don't think 550 meters per second is even possible in GTA

 

Edited by abdelmoez

Share this post


Link to post
Share on other sites
Jitnaught

Remove "ped.SetIntoVehicle(vehicle, VehicleSeat.Driver);", you don't need it, because vehicle.CreatePedOnSeat already does that.

Edited by Jitnaught

Share this post


Link to post
Share on other sites
StAfFMaN

 

Hello guys !

 

I have a problem with my code... The same problem than here :

 

http://gtaforums.com/topic/817640-police-car-stuck-driveto-task-not-working/?hl=drive

 

My police car is very slowly ... I don't know how can i fixe it, i have tried the solution in the link but it's don't work...

 

This is my code :

 

VoiturePoliceRenfort = World.CreateVehicle(ModelVehiculePolice, joueur.GetOffsetInWorldCoords(new Vector3(0.0f, 50.0f, 0.0f))); // joueur.Position.Around(250f); don't work too...VoiturePoliceRenfort.PlaceOnNextStreet();VoiturePoliceRenfort.PlaceOnGround();VoiturePoliceRenfort.LightsOn = true;VoiturePoliceRenfort.SirenActive = true;RenfortPoliceConducteur.DrivingStyle = DrivingStyle.Rushed;RenfortPoliceConducteur.Task.DriveTo(VoiturePoliceRenfort, joueurPosition, 20.0f, 100.0f);

Please do you can help me ?

 

[stAfF]MaN

 

 

 

EDIT :

 

Problem found !!

 

Don't report in the tick() method this :

 

Game.Player.IgnoredByPolice; OR Game.Player.IgnoredByEveryone;

 

If you don't want police, juste set the wanted level to 0 in the tick() method ;) !!

 

I think it'll help you :p

Share this post


Link to post
Share on other sites
Jitnaught

@abdelmoez

I tested the code I gave you and this is the result:

. I do not get the problem you have. There must be another part of your mod that is causing the problem.

 

@StAfFMaN

I tested the code I gave him with IgnoredByEveryone and IgnoredByPolice set to true in a Tick, and I got the result you had in your post, but not the result he has, which is the ped driving forward and back repeatedly.

Edited by Jitnaught

Share this post


Link to post
Share on other sites
StAfFMaN
@StAfFMaN

 

I tested the code I gave him with IgnoredByEveryone and IgnoredByPolice set to true in a Tick, and I got the result you had in your post, but not the result he has, which is the ped driving forward and back repeatedly.

 

Oh okay sorry :/I thought it was the same problem

But... i think there must be code in a loop that causes the problem

Share this post


Link to post
Share on other sites
Jitnaught

Oh okay sorry :/ I thought it was the same problem

But... i think there must be code in a loop that causes the problem

If he does have that code in his Tick I still think he should try removing the code to see if it helps.

Share this post


Link to post
Share on other sites
abdelmoez

@abdelmoez

I tested the code I gave you and this is the result:

. I do not get the problem you have. There must be another part of your mod that is causing the problem.

 

@StAfFMaN

I tested the code I gave him with IgnoredByEveryone and IgnoredByPolice set to true in a Tick, and I got the result you had in your post, but not the result he has, which is the ped driving forward and back repeatedly.

 

I started new project and deleted all of the other code but the problem still there

 

 

this is the code

using System;using System.Collections.Generic;using System.Drawing;using System.Windows.Forms;using GTA;using GTA.Native;public class ArmyAttach : Script{    private Vehicle vehicle;    public ArmyAttach()    {        Tick += OnTick;        KeyDown += OnKeyDown;        KeyUp += OnKeyUp;    }    void OnTick(object sender, EventArgs e)    {    }    void OnKeyDown(object sender, KeyEventArgs e)    {    }    void OnKeyUp(object sender, KeyEventArgs e)    {        if (e.KeyCode == Keys.H)        {            vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 20f), 228f);            var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, PedHash.Marine01SMM);            ped.Armor = 75;            ped.Weapons.Give(WeaponHash.SMG, 900, true, true);            ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f), 10f, 50f);            UI.Notify("~b~Army~w~ Has Been Spawned");        }    }}
Edited by abdelmoez

Share this post


Link to post
Share on other sites
Jitnaught

Hm, maybe there is another mod that is conflicting?

Share this post


Link to post
Share on other sites
abdelmoez

Hm, maybe there is another mod that is conflicting?

 

thanks for every thing

i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks :)

Share this post


Link to post
Share on other sites
Jitnaught

Awesome! Glad you got it sorted out! :)

Share this post


Link to post
Share on other sites
bhavinbhai2707

 

Hm, maybe there is another mod that is conflicting?

thanks for every thing

i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks :)

just try to figure out which mod is conflicting with urs :)

Share this post


Link to post
Share on other sites
abdelmoez

 

 

Hm, maybe there is another mod that is conflicting?

thanks for every thing

i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks :)

just try to figure out which mod is conflicting with urs :)

 

I have about 50 mods :blink: it's very hard to figure out

Share this post


Link to post
Share on other sites
StAfFMaN

Too much of mods kills the mod lol

Share this post


Link to post
Share on other sites
bhavinbhai2707

 

 

 

Hm, maybe there is another mod that is conflicting?

 

thanks for every thing

i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks :)

just try to figure out which mod is conflicting with urs :)

 

I have about 50 mods :blink: it's very hard to figure out

 

if u will upload it somewhere then u have to find which mod is causing problem otherwise it can conflict for them too :)

Share this post


Link to post
Share on other sites
abdelmoez

 

 

 

 

Hm, maybe there is another mod that is conflicting?

thanks for every thing

i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks :)

just try to figure out which mod is conflicting with urs :)

I have about 50 mods :blink: it's very hard to figure out

if u will upload it somewhere then u have to find which mod is causing problem otherwise it can conflict for them too :)

 

 

 

Yeah i know that , but I made this mod for myself :colgate: so no need for that :cool:

 

thanks by the way

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.