manve1 Posted December 5, 2012 Share Posted December 5, 2012 How can i make a script to get a specific vehicle that was created? EDIT: Like if i made a vehicle using this function: local monsterNot = createVehicle( 411, 0, 0, 1 ) How can i make like that some other function would work only for this vehicle, for example: if i was going to do a marker hit, it would work only for this vehicle, not the rest not even with same id. Link to comment
Castillo Posted December 5, 2012 Share Posted December 5, 2012 You get the vehicle of the player who hit the marker and check if it's the same as monsterNot. Link to comment
manve1 Posted December 5, 2012 Author Share Posted December 5, 2012 I got this part, but i can't figure out how to. EDIT: my script looks like this: addEventHandler('onMarkerHit', marker1, function( thePlayer ) if ( getPedOccupiedVehicle( thePlayer ) == theTrashCar ) then triggerClientEvent('marker1_', thePlayer) end end ) well, i got the car made .. but i can't figure out why it doesn't get the car Link to comment
Castillo Posted December 5, 2012 Share Posted December 5, 2012 Mind posting the whole script? Link to comment
manve1 Posted December 5, 2012 Author Share Posted December 5, 2012 SERVER: local marker1 = createMarker( 2316.25, -1933, 12, 'cylinder', 3.0, 155, 155, 0, 155 ) theTrashCar = createVehicle( 408, 2201, -1978, 17, 0, 0, 270 ) addEventHandler('onMarkerHit', marker1, function( thePlayer ) if ( getPedOccupiedVehicle( thePlayer ) == theTrashCar ) then triggerClientEvent('marker1_', thePlayer) end end ) CLIENT: addEvent('marker1_', true) addEventHandler('marker1_', getRootElement(), function() owner = getPedOccupiedVehicle( localPlayer ) setElementFrozen( localPlayer, true ) setElementFrozen( owner, true ) end ) Link to comment
Castillo Posted December 5, 2012 Share Posted December 5, 2012 local marker1 = createMarker ( 2316.25, -1933, 12, 'cylinder', 3.0, 155, 155, 0, 155 ) theTrashCar = createVehicle ( 408, 2201, -1978, 17, 0, 0, 270 ) addEventHandler ( 'onMarkerHit', marker1, function ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and getPedOccupiedVehicle ( thePlayer ) == theTrashCar ) then outputChatBox ( "Vehicle match" ) triggerClientEvent ( thePlayer, 'marker1_', thePlayer ) end end ) Link to comment
manve1 Posted December 5, 2012 Author Share Posted December 5, 2012 error: bad player pointer @ getPedOccupiedVehicle Link to comment
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