Ped entering passenger seat.

Recommended Posts

I want to do a Taxi Job on my server, but I can't get it to work. Is there any way to use the enter_passenger control on Peds?


taxiNPCk = {}

function warpTaxiNPCInTaxi(player, skin, name, vehicle)
	taxiNPCk[player] = createPed(skin, 0, 0, 0)
	setElementData(taxiNPCk[player], "pedname", name)
	warpPedIntoVehicle(taxiNPCk[player], vehicle, math.random(2,3))
addEvent("warpTaxiNPCInTaxi", true)
addEventHandler("warpTaxiNPCInTaxi", root, warpTaxiNPCInTaxi)


NPCnevek = {

NPCskinek = {

taxiNPCkLS = {
	{1173.0035400391, -1274.3172607422, 13.546875, 180},
	{1313.7718505859, -1389.6131591797, 13.518327713013, 180},

function taxiRender()
	if not isPedInVehicle(localPlayer) then return end
	x, y, z = getElementPosition(localPlayer)
	x1, y1, z1 = getElementPosition(taxiNPC)
	distance = getDistanceBetweenPoints3D(x, y, z, x1, y1, z1)
	if distance < 7 then
		ottVan = true
	if ottVan then
		setPedRotation(taxiNPC, findRotation(x1, y1, x, y))
		setControlState("handbrake", true)
		setPedControlState(taxiNPC, "forwards", true)
		setPedControlState(taxiNPC, "walk", true)
		if distance < 2.3 then
			triggerServerEvent("warpTaxiNPCInTaxi", localPlayer, localPlayer, getElementModel(taxiNPC), getElementData(taxiNPC, "pedname"), getPedOccupiedVehicle(localPlayer))
			setControlState("handbrake", false)
			toggleAllControls(true, true, true)
			removeEventHandler("onClientRender", root, taxiRender)
			ottVan = false
			setPedControlState(taxiNPC, "forwards", false)
			setPedControlState(taxiNPC, "walk", false)

function taxiSpawnNPC()
	if isElement(taxiNPC) then
	random1 = math.random(1, #taxiNPCkLS)
	random2 = math.random(1, #NPCnevek)
	random3 = math.random(1, #NPCskinek)
	taxiNPC = createPed(NPCskinek[random3][1], taxiNPCkLS[random1][1], taxiNPCkLS[random1][2], taxiNPCkLS[random1][3])
	outputChatBox("-- Taxi NPC Spawned --")
	outputChatBox(" -Skin: "..NPCskinek[random3][1])
	outputChatBox(" -Position (X, Y, Z): "..taxiNPCkLS[random1][1]..", ".. taxiNPCkLS[random1][2]..", ".. taxiNPCkLS[random1][3])
	setPedRotation(taxiNPC, taxiNPCkLS[random1][4])
	outputChatBox(" -Rotation: "..taxiNPCkLS[random1][4])
	setElementData(taxiNPC, "pedname", NPCnevek[random2][1].." #7cc576(Pedestrian)")
	outputChatBox(" -Name: "..NPCnevek[random2][1].." #7cc576(Pedestrian)",255,255,255,true)
	addEventHandler("onClientRender", root, taxiRenderTeszt)

function findRotation(x1,y1,x2,y2)
  local t = -math.deg(math.atan2(x2-x1,y2-y1))
  if t < 0 then t = t + 360 end;
  return t;

This is good enough too, but if possible, I would like to use the enter_passenger.

Share this post

Link to post

not supported.

The only thing you can do is create an overwrite, which will take a lot of time.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.