#Updated RPC Telepo...
 
Notifications
Clear all

#Updated RPC Teleport To WayPoint With Correct Ground Z Elevation

Page 1 / 4

KranK
Posts: 336
Topic starter
(@KranK)
Reputable Member
Joined: 9 years ago

Hey Rival Gamer Coders and modders as i have heard that many people trying to make this work and also asked me for code many times , im releasing this to your use

Code was updated and i made is as much simplest as i could , notice it may be not that easy to understand so try your best , if you dont understand any of this feel free to message me 😉

as you may notice my RPC class called hook and use special way of calling system if your is diffrent wich is most likely if you dont have hook you must rewrite the call of the natives to your way

Note
i have not tested this with not hooked RPC so all ups to your RPC calling/hooking system

Hook FTW

Past this code in to your Teleport to way point Button in your RPC tool

[HIDE]
[html]
int teleportActiveLineIndex = 0; // Blip Index Static

// Get Entity To Teleport
int Entity_ID = Hook.Call("PLAYER_PED_ID"); // Get Player Entity ID

if (Hook.Call("IS_PED_IN_ANY_VEHICLE", Entity_ID, 0)) // In Case Ped In Vehicle Get Vehicle Entity ID
{
Entity_ID = Hook.Call("GET_VEHICLE_PED_IS_USING", Entity_ID); // Entity_ID = Vehicle Entity ID
}

// Get Coords
Vector3 coords = new Vector3(); // Create Vector For Coords Defenitions
bool success = false; // Bool For difine What Ever Blip Coord Is Found Or Not
if (teleportActiveLineIndex == 0) // Using Blip Index Static
{
bool Blip_Found = false; // Blip Defenition

// Search For blip
int Blip_Iterator = Hook.Call(0xB9827942); // UI::_GET_BLIP_INFO_ID_ITERATOR

// Alocating Blip Coords by Blip interator
for (int i = Hook.Call("GET_FIRST_BLIP_INFO_ID",Blip_Iterator); Hook.Call("DOES_BLIP_EXIST",i) != false; i = Hook.Call("GET_NEXT_BLIP_INFO_ID",Blip_Iterator))
{
if (Hook.Call("GET_BLIP_INFO_ID_TYPE",i) == 4) // If Blip ID equals Map Set Marker By Player
{
coords = Hook.Call("GET_BLIP_INFO_ID_COORD",i); // Setting Blip Coords into Out previously Created Vector3
Blip_Found = true; // And Blip Found 😛
break; // Stop Searching for Blip
}
}
if (Blip_Found) // And When Blip Found Start Calculating Coords For Ground Z
{
// load needed map region and check height levels for ground existence
bool Ground_Found = false; // Bool For Ground

// Coords For Ground to alocate Correct Ground Z
float[] groundCheckHeight = { 100.0f, 150.0f, 50.0f, 0.0f, 200.0f, 250.0f, 300.0f, 350.0f, 400.0f, 450.0f, 500.0f, 550.0f, 600.0f, 650.0f, 700.0f, 750.0f, 800.0f };

for (int i = 0; i < groundCheckHeight.Length; ++i) // loop for calculating Ground Z by defined floats array
{
coords.z = groundCheckHeight; // Ground Z reset to Calculated Coords By Array or preset float from minimum to maximum Ground
Hook.Call("DO_SCREEN_FADE_OUT", 200);// Black Out The sсreen to hide Coords caluculation in game Client sided only

System.Threading.Thread.Sleep(100); // Lets wait abit to make sure all correct

Hook.Call("SET_ENTITY_COORDS_NO_OFFSET", Entity_ID, coords, 0, 0, 1); // Set Our Enity Coords Before Fixing Ground Position
Hook.Call("LOAD_ALL_OBJECTS_NOW");// in Case objects not load force them to do so 😛

uint Ground_Z_Pointer_Adress = 0x10070000;
if (Hook.Call("GET_GROUND_Z_FOR_3D_COORD", coords, Ground_Z_Pointer_Adress) == true)// If Ground Z found using defined Array ruturn true and writes Coords to pointer
{
Ground_Found = true; // And Ground Found
float Ground_Z = PS3.Extension.ReadFloat(Ground_Z_Pointer_Adress);
coords.z = Ground_Z + 3.0f; // Set Found Ground Z to Vector3 Z coord and Add 3.f to make you spawn abit upper the ground
break; // and stop the loop
}
}

// if ground not found then set Z in air and give player a parachute
if (!Ground_Found)
{
coords.z = 1000.0f;
int Player_ID = Hook.Call("PLAYER_PED_ID"); // Get Player Entity ID
uint Parachute = 0xFBAB5776;
Hook.Call("GIVE_DELAYED_WEAPON_TO_PED", Player_ID, Parachute, 1, 0);
MessageBox.Show("No ground found");
}
success = true; // and yes teleport
}
else
{
//If no way point was set
MessageBox.Show("No WayPoint Set ?!");
}

}
else // predefined coords
{
// here you can predefine coords if you need
success = true;
}

//And finnaly Correct Ground Z
if (success)
{
Hook.Call("SET_ENTITY_COORDS_NO_OFFSET",Entity_ID, coords, 0, 0, 1);
Hook.Call("DO_SCREEN_FADE_IN", 200); // Remove Screen Black out
}
[/html][/HIDE]

THIS IS NOT ALLOWED TO BE POSTED ANYWHERE ELSE

Reply
Name of the Video Game, and any other Tags
16 Replies
LEGACYY
Posts: 2350
(@legacyy)
Noble Member
Joined: 9 years ago

Hey Rival Gamer Coders and modders as i have heard that many people trying to make this work and also asked me for code many times , im releasing this to your use

as you may notice my RPC class called hook and use special way of calling system if your is diffrent wich is most likely if you dont have hook you must rewrite the call of the natives to your way

Note
i have not tested this with not hooked RPC so all ups to your RPC calling/hooking system

Hook FTW

Past this code in to your Teleport to way point Button in your RPC tool

Hidden content cannot be quoted.

THIS IS NOT ALLOWED TO BE POSTED ANYWHERE ELSE

The Legend at work 😉 Nice share

Reply
Xx_KTGANG_xX
Posts: 5
(@Xx_KTGANG_xX)
Active Member
Joined: 9 years ago

thx for this

Reply
Nullerdk
Posts: 28
(@Nullerdk)
Eminent Member
Joined: 9 years ago

nice!! thanks Krank

Reply
AsOGaMeR
Posts: 176
(@aso-gamer)
Estimable Member
Joined: 10 years ago

thanx Krank

Reply
Page 1 / 4