project-lambdamenu icon indicating copy to clipboard operation
project-lambdamenu copied to clipboard

Teleport player to me?

Open sssnpr opened this issue 7 years ago • 3 comments

As seen in the title, is there a way to teleport the player to me?

sssnpr avatar Dec 25 '18 00:12 sssnpr

@Firecul , can you help me?

sssnpr avatar Dec 25 '18 00:12 sssnpr

@SniperHero007 you don't have to tag me on my own repo, I do get notifications. I don't know how to add that atm but I'll add it to my to do list

Firecul avatar Dec 25 '18 17:12 Firecul

@SniperHero007 you don't have to tag me on my own repo, I do get notifications. I don't know how to add that atm but I'll add it to my to do list

You cannot gain control of another player with just this I don't think..? But anyways, if you meant gain control of another players vehicle and teleport the player in vehicle to you. Then try this:

Entity mHandle;// mHandle = GET_VEHICLE_PED_IS_IN(selectedOnlineIndexedPed...
int NetID; //NetID = GET_VEHICLE_PED_IS_IN(selectedOnlineIndexedPed...
bool HasControl()
{
	return NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(mHandle) != 0;
}

bool RequestControlOnce()
{
	if (!NETWORK::NETWORK_IS_IN_SESSION() || HasControl())
		return true;
	NETWORK::SET_NETWORK_ID_CAN_MIGRATE(NetID, true);
	return NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(mHandle) != 0;
}

bool RequestControlNow(DWORD timeOut)
{
	for (timeOut += GetTickCount64(); GetTickCount64() < timeOut;)
	{
		if (RequestControlOnce())
			return true;
		WAIT(0);
	}
	return false;
}

This should be understandable. Calling it like so: mHandle = GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i), 0); NetID = GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i), 0);

			if (RequestControlNow(1000)) {
			//GTAvehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i), 0);
			//if (vehicle.RequestControl(1000)) { // <- if your using Menyoo or its setup.`

1000 is 1 second as you know, so that may just be enough time to gain control of the players vehicle. #ManyTicksArou

PulledResort avatar Mar 19 '21 06:03 PulledResort