yMassai Posted July 11, 2012 Posted July 11, 2012 carros [ source ] = createVehicle ( modelo, -50.28254, -1142.70104, 1.62812, 0, 0, 65 ) function onEnterVehicle () if .. triggerClientEvent ( "createMarcaEvent", localPlayer ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) function onExitVehicle () if .. triggerClientEvent("destroytruckt",localPlayer) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), onExitVehicle ) when the player enter the vehicle the desired event occurs. what functions can I use to identify the player get in and out of the vehicle?
Tete omar Posted July 11, 2012 Posted July 11, 2012 (edited) it mus be like this triggerClientEvent ( "createMarcaEvent", getRootElement() ) triggerClientEvent ( "createMarcaEvent1", getRootElement() ) Edited July 11, 2012 by Guest
denny199 Posted July 11, 2012 Posted July 11, 2012 I don't understand, what do you want? What do you mean with if... btw, you can trigger for only 1 car to. like this: lolauto = createVehicle ( modelo, -50.28254, -1142.70104, 1.62812, 0, 0, 65 ) function autofunction () --Some epic crap here end addEventHandler ( "onPlayerVehicleEnter",lolauto, autofunction ) And why using [ source ] when it's not defined.... In my opinion you should read the wiki again
yMassai Posted July 11, 2012 Author Posted July 11, 2012 carros [ source ] = createVehicle ( modelo, -50.28254, -1142.70104, 1.62812, 0, 0, 65 ) function onExitVehicle () if ( isElement ( carros [ source ] ) ) then triggerClientEvent("destroytruck",getRootElement ( )) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), onExitVehicle ) function onEnterVehicle () if ( isElement ( carros [ source ] )) then triggerClientEvent("destroytruck",getRootElement ( )) triggerClientEvent ( "createMarcaEvent", getRootElement ( ) ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) working
Anderl Posted July 11, 2012 Posted July 11, 2012 I don't understand, what do you want?What do you mean with if... btw, you can trigger for only 1 car to. like this: lolauto = createVehicle ( modelo, -50.28254, -1142.70104, 1.62812, 0, 0, 65 ) function autofunction () --Some epic crap here end addEventHandler ( "onPlayerVehicleEnter",lolauto, autofunction ) And why using [ source ] when it's not defined.... In my opinion you should read the wiki again You should too, onPlayerVehicleEnter source element is the player element, not the vehicle.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now