justn Posted March 6, 2014 Share Posted March 6, 2014 (edited) SOLVED Edited March 6, 2014 by Guest Link to comment
Moderators IIYAMA Posted March 6, 2014 Moderators Share Posted March 6, 2014 onClientMarkerHit doesn't get trigged with vehicles. See wiki: https://wiki.multitheftauto.com/wiki/OnClientMarkerHit hitPlayer: The player that hit the marker So: addEventHandler ( "onClientMarkerHit", root, function ( hitElement ) if source == truckerMarker and localPlayer == hitElement then local vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle and getElementModel(vehicle) == 514 then triggerServerEvent ( "givePlayerPay", localPlayer ) destroyElement ( truckerMarker ) if isElement(truckerBlip) then -- very important destroyElement ( truckerBlip ) end guiSetVisible(destinationwindow,true) showCursor(true) triggerEvent ( "createTruckerEvent", localPlayer ) end end end) Link to comment
justn Posted March 6, 2014 Author Share Posted March 6, 2014 (edited) SOLVED Edited March 6, 2014 by Guest Link to comment
iPrestege Posted March 6, 2014 Share Posted March 6, 2014 For the vehicles because using it server side every vehicled created will destroy the last one you must use table's . Link to comment
justn Posted March 6, 2014 Author Share Posted March 6, 2014 (edited) SOLVED Edited March 6, 2014 by Guest Link to comment
iPrestege Posted March 6, 2014 Share Posted March 6, 2014 vehicle = { } addCommandHandler ( 'ccv', function ( player ) if vehicle [ player ] and isElement ( vehicle [ player ] ) then destroyElement ( vehicle [ player ] ) end local x,y,z = getElementPosition ( player ) vehicle [ player ] = createVehicle ( x,y,z,411 ) end ) This is an simple example. Link to comment
Moderators IIYAMA Posted March 6, 2014 Moderators Share Posted March 6, 2014 CVC +1 local vehicleTable = {} addEvent( "sum", true) addEventHandler("sum", getRootElement(), function(car) local truck = vehicleTable[source] -- load if truck then -- check if isElement( truck ) then destroyElement( truck ) end vehicleTable[source]= nil -- clean end if isElement(source) then local truck = createVehicle ( 514, 70.21049, -233.00739, 2.33665 ) warpPedIntoVehicle ( source, truck ) vehicleTable[source]= truck --save end end ) -- extra, because I am in a good mood. addEventHandler("onPlayerQuit",root, function () local truck = vehicleTable[source] if truck then if isElement( truck ) then destroyElement( truck ) end vehicleTable[source]= nil end end) -- @CVC Lol you posted first, Link to comment
justn Posted March 6, 2014 Author Share Posted March 6, 2014 Script working just the way i want it, Thanks @IIYAMA and @CVC 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