toptional Posted March 27, 2013 Share Posted March 27, 2013 Here is the client function SpawnDodo () triggerServerEvent ( "spawnDodo", localPlayer ) guiSetVisible(Window2, false) showCursor(false) destroyElement ( DestinationBlip ) destroyElement ( DestinationMarker ) PasengerMarker = createMarker (1574.69788, 1503.02808, 10.8363, "checkpoint",5,9,233,213,105 ) addEventHandler ( "onClientMarkerHit", PasengerMarker, mainFunction ) end addEventHandler ( 'onClientGUIClick', Button2, SpawnDodo, false ) And here the server addEvent ( "spawnDodo", true) addEventHandler ("spawnDodo", root, function () destroyElement ( source ) local dodo = createVehicle ( 593, 1580.09619, 1358.62195, 16, 0, 0,180 ) warpPedIntoVehicle( source, dodo ) outputChatBox ("#00CD66You will now take your first flight! Go to the blip marked on your map to pickup your first passenger.", source,24,116,205, true) fixVehicle ( dodo ) outputChatBox ("#EE9A00Please make your way to the terminal to pick the passnegers.", source,24,116,205, true) --destroyElement ( getRootElement() ) end ) My issue is this im trying to do this: when you hit this marker a gui shows up and you press the button and it spawns a dodo and destroys the current car you are in, althought when i change the destroyElement to ( source ) nothing is destroyed but with ( getRootElement() ) all the cars are destroyed which is not what i want Any help? Link to comment
manve1 Posted March 27, 2013 Share Posted March 27, 2013 addEvent ( "spawnDodo", true) addEventHandler ("spawnDodo", root, function () if (dodo) then destroyElement( dodo ) end local dodo = createVehicle ( 593, 1580.09619, 1358.62195, 16, 0, 0,180 ) warpPedIntoVehicle( source, dodo ) outputChatBox ("#00CD66You will now take your first flight! Go to the blip marked on your map to pickup your first passenger.", source,24,116,205, true) fixVehicle ( dodo ) outputChatBox ("#EE9A00Please make your way to the terminal to pick the passnegers.", source,24,116,205, true) --destroyElement ( getRootElement() ) end ) Link to comment
PaiN^ Posted March 27, 2013 Share Posted March 27, 2013 You're destroying the source which is the localPlayer, You should use getPedOccupiedVehicle to get his current vehicle .. Link to comment
manve1 Posted March 27, 2013 Share Posted March 27, 2013 You're destroying the source which is the localPlayer, You should use getPedOccupiedVehicle to get his current vehicle .. won't work when the person is in a marker, as he won't have any vehicle occupied Link to comment
toptional Posted March 27, 2013 Author Share Posted March 27, 2013 It depends the player might go in the marker with the vehilce or not, either way it's not working Manve. no errors! Link to comment
manve1 Posted March 27, 2013 Share Posted March 27, 2013 Robbster, another way you can make it is with saving data or getting destroyed all of them by model. Link to comment
Renkon Posted March 28, 2013 Share Posted March 28, 2013 addEvent ( "spawnDodo", true) addEventHandler ("spawnDodo", root, function () local v = getPedOccupiedVehicle(source) if v then destroyElement( v ) end local dodo = createVehicle ( 593, 1580.09619, 1358.62195, 16, 0, 0,180 ) warpPedIntoVehicle( source, dodo ) outputChatBox ("#00CD66You will now take your first flight! Go to the blip marked on your map to pickup your first passenger.", source,24,116,205, true) fixVehicle ( dodo ) outputChatBox ("#EE9A00Please make your way to the terminal to pick the passnegers.", source,24,116,205, true) --destroyElement ( getRootElement() ) end ) 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