Recommended Posts

function autoescola()
	triggerServerEvent("TeoriaCompleta", getLocalPlayer())
	local x, y, z = testRoute[1][1], testRoute[1][2], testRoute[1][3]
	blip = createBlip(x, y, z, 0, 2, 0, 255, 0, 255)
	marker = createMarker(x, y, z, "checkpoint", 4, 0, 255, 0, 150) 
	addEventHandler("onClientMarkerHit", marker, comecarautoescola)
	
	outputChatBox("#FF9933You are ready for the practical test. Take a DoL training machine and follow the route..", 255, 194, 14, true)
	
end

I would like that after appearing the message saying that it is ready for the practical test, the player was spawn automatically with a car in this position =(1090.815,-1769.211, 13.352)

How i can do this?

Share this post


Link to post

Use:

createVehicle -- create the vehicle
warpPedIntoVehicle -- warp player into the vehicle.

 

  • Like 1

Share this post


Link to post
1 hour ago, WorthlessCynomys said:

Hy!


createVehicle()
setElementPosition()
warpPedIntoVehicle()

 

function autoescola()
	triggerServerEvent("TeoriaCompleta", getLocalPlayer())
	local x, y, z = testRoute[1][1], testRoute[1][2], testRoute[1][3]
	blip = createBlip(x, y, z, 0, 2, 0, 255, 0, 255)
	marker = createMarker(x, y, z, "checkpoint", 4, 0, 255, 0, 150) 
	addEventHandler("onClientMarkerHit", marker, comecarautoescola)
	
	outputChatBox("#FF9933You are ready for the practical test. Take a DoL training machine and follow the route..", 255, 194, 14, true)
    local test = createVehicle(410, 1090.815, -1769.211, 13.352)
	warpPedIntoVehicle ( getLocalPlayer, test )	
end

so I used this command and the car is being created but the player is not set in it, remembering that I am in different dimension and interior.

Share this post


Link to post
Just now, murilo2929 said:

function autoescola()
	triggerServerEvent("TeoriaCompleta", getLocalPlayer())
	local x, y, z = testRoute[1][1], testRoute[1][2], testRoute[1][3]
	blip = createBlip(x, y, z, 0, 2, 0, 255, 0, 255)
	marker = createMarker(x, y, z, "checkpoint", 4, 0, 255, 0, 150) 
	addEventHandler("onClientMarkerHit", marker, comecarautoescola)
	
	outputChatBox("#FF9933You are ready for the practical test. Take a DoL training machine and follow the route..", 255, 194, 14, true)
    local test = createVehicle(410, 1090.815, -1769.211, 13.352)
	warpPedIntoVehicle ( getLocalPlayer, test )	
end

so I used this command and the car is being created but the player is not set in it, remembering that I am in different dimension and interior.

Then you should set the interior and dimension for the player or the vehicle before you warp the player into the new vehicle.

setElementInterior()
setElementDimension()

-- You can get the interior/dimension of an element with:
getElementInterior()
getElementDimension()

 

Share this post


Link to post
2 minutes ago, WorthlessCynomys said:

Then you should set the interior and dimension for the player or the vehicle before you warp the player into the new vehicle.


setElementInterior()
setElementDimension()

-- You can get the interior/dimension of an element with:
getElementInterior()
getElementDimension()

 

function autoescola()
	triggerServerEvent("TeoriaCompleta", getLocalPlayer())
	local x, y, z = testRoute[1][1], testRoute[1][2], testRoute[1][3]
	blip = createBlip(x, y, z, 0, 2, 0, 255, 0, 255)
	marker = createMarker(x, y, z, "checkpoint", 4, 0, 255, 0, 150) 
	addEventHandler("onClientMarkerHit", marker, comecarautoescola)
	
	outputChatBox("#FF9933You are ready for the practical test. Take a DoL training machine and follow the route..", 255, 194, 14, true)
    local test = createVehicle(410, 1090.815, -1769.211, 13.352)
	setElementDimension ( getLocalPlayer, 0 )
	setElementInterior ( getLocalPlayer, 0 )
	warpPedIntoVehicle ( getLocalPlayer, test )
end

 

i make like that, and don't work, what is wrong?

Share this post


Link to post
Just now, murilo2929 said:

function autoescola()
	triggerServerEvent("TeoriaCompleta", getLocalPlayer())
	local x, y, z = testRoute[1][1], testRoute[1][2], testRoute[1][3]
	blip = createBlip(x, y, z, 0, 2, 0, 255, 0, 255)
	marker = createMarker(x, y, z, "checkpoint", 4, 0, 255, 0, 150) 
	addEventHandler("onClientMarkerHit", marker, comecarautoescola)
	
	outputChatBox("#FF9933You are ready for the practical test. Take a DoL training machine and follow the route..", 255, 194, 14, true)
    local test = createVehicle(410, 1090.815, -1769.211, 13.352)
	setElementDimension ( getLocalPlayer, 0 )
	setElementInterior ( getLocalPlayer, 0 )
	warpPedIntoVehicle ( getLocalPlayer, test )
end

 

i make like that, and don't work, what is wrong?

The creation of the vehicle, the dimension and interior change and the warp has to happen on server-side!

Share this post


Link to post
2 minutes ago, WorthlessCynomys said:

The creation of the vehicle, the dimension and interior change and the warp has to happen on server-side!

i'm doing in client-side, how i can do that in server-side? thanks for helping.

Share this post


Link to post
Just now, murilo2929 said:

i'm doing in client-side, how i can do that in server-side? thanks for helping.

You use the triggerServerEvent as above and catch the call on server-side, then you do the same as on client-side, only that you're on server-side now.

Share this post


Link to post
20 minutes ago, WorthlessCynomys said:

You use the triggerServerEvent as above and catch the call on server-side, then you do the same as on client-side, only that you're on server-side now.

I put only in server-side and work, thanks alot

30 minutes ago, WorthlessCynomys said:

You use the triggerServerEvent as above and catch the call on server-side, then you do the same as on client-side, only that you're on server-side now.

One question, how i can make to when player hit marker the vehicle destroy?

Share this post


Link to post
1 hour ago, murilo2929 said:

I put only in server-side and work, thanks alot

One question, how i can make to when player hit marker the vehicle destroy?

Use 

addEventHandler -- "onPlayerMarkerHit"
getPedOccupiedVehicle
destroyElement

 

Share this post


Link to post
3 minutes ago, HassoN said:

Use 


addEventHandler -- "onPlayerMarkerHit"
getPedOccupiedVehicle
destroyElement

 

i use

getElementModel (theVehicle)
    destroyElement(theVehicle)	

and it worked, thanks anyway.

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.