BEGIN A NEW ADVENTURE
Interested in learning new things with an awesome group of people?


Source Teleport To WayPoint , Correct way , Cross Platform

Discussion in 'Grand Theft Auto' started by KranK, Sep 30, 2016.

  1. KranK ✮ ズ丂ム刀ズ ✮

    KranK

    Total Messages:
    350
    Likes Received:
    384
    Trophy Points:
    73
    Starter
    Hello RG members as the title say but to addition to it this code works low and high ground low-to-high-to low.

    Code:
    //Teleport to Way point loop
    
        if (TeleportWPLoop)
        {
            Blip WaypointID = UI::GET_FIRST_BLIP_INFO_ID(8);
            Vector3 WaypointCoords = UI::GET_BLIP_COORDS(WaypointID);
            Vector3 coordos;
            int Entity;
            if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false))
            {
                Entity = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID());
            }
            else
            {
                Entity = PLAYER::PLAYER_PED_ID();
            }
            float ZAxis;
    
    
            if (WaypointCoords.x != 0 && WaypointCoords.y != 0)
            {
                ENTITY::SET_ENTITY_COORDS(Entity, WaypointCoords.x, WaypointCoords.y, WaypointCoords.z, true, true, true, true);
                ContinueWP = true;
            }
            if (ContinueWP)
            {
                coordos = ENTITY::GET_ENTITY_COORDS(Entity, true);
                ENTITY::SET_ENTITY_COORDS(Entity, coordos.x, coordos.y, coordos.z + 10.0f, true, true, true, true);
            }
    
            if (GAMEPLAY::GET_GROUND_Z_FOR_3D_COORD(coordos.x, coordos.y, coordos.z, &ZAxis))
            {
                ENTITY::SET_ENTITY_COORDS(Entity, coordos.x, coordos.y, ZAxis + 1.0f, true, true, true, true);
                ZAxis = 0;
                TeleportWPLoop = false;
                ContinueWP = false;
            }
    
    
        }



     
    lambo, Cyb3r, anxify and 2 others like this.
  2. Loading...

    Similar Threads Forum Date
    Source #Updated RPC Teleport To WayPoint With Correct Ground Z Elevation Grand Theft Auto Jan 9, 2016

  3. Cain532 Happy Modding

    Cain532

    Total Messages:
    1,211
    Likes Received:
    658
    Trophy Points:
    123
    You could even do that top part like

    Code:
            int Entity = PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID() ? PLAYER::PLAYER_PED_ID() : PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID());
    
    That's kind of how I have it set in our RedDeadRekt project :)
     
    anxify and KranK like this.
  4. KranK ✮ ズ丂ム刀ズ ✮

    KranK

    Total Messages:
    350
    Likes Received:
    384
    Trophy Points:
    73
    Starter
    i prefer the way i did :)
     
    anxify and Cain532 like this.
  5. anxify Misc. Moderator

    anxify

    Total Messages:
    206
    Likes Received:
    118
    Trophy Points:
    53
    KranK This is amazing!!!! :D
     
  6. lambo Newbie

    lambo

    Total Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    KranK you sir are a Genius
    thank you
     
  7. lambo Newbie

    lambo

    Total Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    KranK a little addition well you might have a better way
    if the waypoint is over the ocean you get stuck in the sky untill you set another waypoint over land, this stops the loop and gives you a parachute
    Code:
    if (coordos.z >= 799.0000f)
           {
           WEAPON::GIVE_DELAYED_WEAPON_TO_PED(PLAYER::PLAYER_PED_ID(), 0xFBAB5776, 1, 1);
           TeleportWPLoop = false;
           ContinueWP = false;
           PRINT("Set Waypoint on Ground", 4000);
           }
    
     
    Cain532 likes this.
  8. KranK ✮ ズ丂ム刀ズ ✮

    KranK

    Total Messages:
    350
    Likes Received:
    384
    Trophy Points:
    73
    Starter
    there is also bug with helicopters btw ,, it wont fix ground position if you are in the helicopter
     
  9. lambo Newbie

    lambo

    Total Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    sometimes it just wont find ground z i think sometimes the map doesnt load quick enough for ContinueWP, and i think you have to be close to ground for GET_GROUND_Z_FOR_3D_COORD, but its still the best Teleport to waypoint :)

    for the heli IS_PED_IN_FLYING_VEHICLE will kill the loop but you will spawn underground
    Code:
    if (PED::IS_PED_IN_FLYING_VEHICLE(PLAYER::PLAYER_PED_ID()))
       {
       ENTITY::SET_ENTITY_COORDS(Entity, WaypointCoords.x, WaypointCoords.y, WaypointCoords.z, true, true, true, true);
       TeleportWPLoop = false;
       ContinueWP = false;
       PRINT("Ground_Z Not Found", 3000);
       }
    
     
  10. KranK ✮ ズ丂ム刀ズ ✮

    KranK

    Total Messages:
    350
    Likes Received:
    384
    Trophy Points:
    73
    Starter
    it always Find the Ground no meter what for me it looks like your ps3 being weird cause this code works flawless exept Helicopters and i dont care much cause i quit GTA modding
     
  11. lambo Newbie

    lambo

    Total Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    You could be right there its a old fat model
     
This website runs by the community, for the community... and it needs advertisements in order to keep running. Please disable your ad-blocker, or become a Prime member to hide all advertisements and this notice.