1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. GTA Network forum is now in archive mode.

How to make a ped steal a car

Discussion in 'Scripting Help' started by Fasta, Sep 5, 2017.

  1. Fasta

    Fasta Member

    Messages:
    5
    Likes Received:
    0
    Joined:
    Aug 31, 2017
    I tried this code, set "-1" driver seat and command my ped steal a car but nothing happened. Others seats are working.
    Code:
            [Command("ped")]
            public void SpawnPed(Client player)
            {
                Vector3 pos = player.position;
                pos.X += 3f;
                pos.Y += 3f;
                p = API.createPed(API.pedNameToModel("AfriAmer01AMM"), pos, 0);
            } 
    
            [Command("sit")]
            public void SitIntoCar(Client player, int seat)
            {          
                API.sendNativeToPlayer(player, Hash.FREEZE_ENTITY_POSITION, p.handle, false);
                API.sendNativeToAllPlayers(0xC20E50AA46D09CA8, p, myVehicle, -1, seat, 2.0, 1, 0);
            }
    
    Native function:
    Code:
    AI::TASK_ENTER_VEHICLE
    
    Hashes: 0xC20E50AA46D09CA8 0xB8689B4E
    void TASK_ENTER_VEHICLE(Ped ped, Vehicle vehicle, int timeout, int seat,
      float speed, int flag, Any p6) // 0xC20E50AA46D09CA8 0xB8689B4E
    speed 1.0 = walk, 2.0 = run
    p5 1 = normal, 3 = teleport to vehicle, 16 = teleport directly into vehicle
    p6 is always 0
    
    Usage of seat
    -1 = driver
    0 = passenger
    1 = left back seat
    2 = right back seat
    3 = outside left
    4 = outside right
    
    P.S.: When driver sit empty the ped can occupy it
     
    Last edited: Sep 5, 2017
  2. Vance

    Vance Well-Known Member

    Messages:
    244
    Likes Received:
    40
    Joined:
    Aug 31, 2016
    Code:
    (Ped ped, Vehicle vehicle, int timeout, int seat, float speed, int flag, Any p6)
    (p,          myVehicle,    -1,           seat,       2.0,           1,           0);
    
    your flags are wrong.
     
  3. Fasta

    Fasta Member

    Messages:
    5
    Likes Received:
    0
    Joined:
    Aug 31, 2017
    And how it should be?

    Here is my video with AI tests:


    P.S.: Sorry for my bad Englishfacepalm~~
     
    Last edited: Sep 6, 2017
  4. Vance

    Vance Well-Known Member

    Messages:
    244
    Likes Received:
    40
    Joined:
    Aug 31, 2016
    If you read the code, you'd notice you put timeout to -1 and seat to seat.
    (0xC20E50AA46D09CA8, p, myVehicle, 100, -1, 2.0, 1, 0);

    I fixed it for you, timeout is now "100" and seat is "-1"
     
  5. Fasta

    Fasta Member

    Messages:
    5
    Likes Received:
    0
    Joined:
    Aug 31, 2017
    In the video u can see how I call method. "/sit -1" and ped need sit into driver seat but nothing. Please watch the video and you'll understand that I did not mess with the flags
     

Share This Page