Jump to content

[QUESTION] Problem with warpPedIntoVehicle


Shirobaka

Recommended Posts

Hey, i created a vehicle and a ped, when i try to put the ped with warpPedIntoVehicle into the vehicle, then nothing happens, i checked what the function returns, i only know that it should return true or false, but it returns nil, does someone know what the problem is?

Here the code:
 

function startPodium()
	local info = {}
	for i,player in ipairs(podiumPlayers) do
		if 1 == player.pos then
			infos.car1 = createVehicle(player.vehicle,-1497.5999755859,-383.10000610352,15.981786727905,0,0,117.99993896484)
			setVehicleColor(infos.car1, player.color1, player.color2, player.color3)
			infos.ped1 = createPed(player.ped,-2105.1000976563,-959.59997558594,32.200000762939,88.2527160)
			local warp = warpPedIntoVehicle(infos.ped1,infos.car1)
			ped = infos.car1
			outputDebugString(tostring(infos.ped1).." - "..tostring(infos.car1).." - "..tostring(warp))
		elseif 2 == player.pos then
			infos.car2 = createVehicle(player.vehicle,-1498.5,-369,15.800000190735,0,0,165.99865722656)
			setVehicleColor(infos.car2, player.color1, player.color2, player.color3)
			infos.ped2 = createPed(player.ped,-2105.1000976563,-960.79998779297,32.200000762939,84.2518920)
			warpPedIntoVehicle(infos.ped2,infos.car2)
			ped = infos.car2
		elseif 3 == player.pos then
			infos.car3 = createVehicle(player.vehicle,-1481.1999511719,-381,15.60000038147,0,0,71.992431640625)
			setVehicleColor(infos.car3, player.color1, player.color2, player.color3)
			infos.ped3 = createPed(player.ped,-2105.1000976563,-962.09997558594,32.200000762939,87.5017700)
			warpPedIntoVehicle(infos.ped3,infos.car3)
			ped = infos.car3
		end
		table.insert(info,{name=player.playerName,pos=player.pos,ped=ped})
	end
	triggerClientEvent("onSetPlayerPodium",root,info)
	triggerClientEvent("podiumCam",root)
end


infos is defined at the top of the script:
 

infos = {
	car1 = false,
	car2 = false,
	car3 = false,
	ped1 = false,
	ped2 = false,
	ped3 = false
}

 

Edited by Shirobaka
posted wrong code
Link to comment

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.
×
×
  • Create New...