aunque Posted November 18, 2022 Share Posted November 18, 2022 I prepared a job script in this way, but the last markers are accepted even if they are entered with different tools and that marker does not disappear, how can I solve this? kargo_arac = {} kargo_teslim = {} function meslekbitis(source) if source then if isElement(kargo_arac[source]) then destroyElement(kargo_arac[source]) destroyElement(meslekbitis_marker) setElementData(source, "kargo:meslek", false) setElementData(source, "meslek", false) local para = 123 givePlayerMoney(source, para) end end end addEvent("meslek:basla", true) addEventHandler("meslek:basla", root, function() setElementData(source, "kargo:meslek", true) setElementData(source, "meslek", true) kargo_arac[source] = createVehicle(456, -29.71848, -1122.65125, 1.07812) warpPedIntoVehicle(source, kargo_arac[source]) setVehicleLocked(kargo_arac[source], true) local meslekbitis_marker = createMarker(-157.16824, -282.63116, 3.90531, "checkpoint", 2.5 , 255, 185, 15) addEventHandler("onMarkerHit", meslekbitis_marker, meslekbitis) kargobitis_blips = createBlip(-157.16824, -282.63116, 3.90531, 56) end) Link to comment
Shady1 Posted November 18, 2022 Share Posted November 18, 2022 (edited) hello @aunque welcome to the forum, i made some edits about the system,can you try this. kargo_arac = {} kargo_teslim = {} local meslekbitis_marker local kargobitis_blips function meslekbitis(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then local jobVehicle = getPedOccupiedVehicle(hitElement) if(jobVehicle) then if(kargo_arac[jobVehicle]) then destroyElement(kargo_arac[jobVehicle]) destroyElement(meslekbitis_marker) destroyElement(kargobitis_blips) setElementData(hitElement, "kargo:meslek", false) setElementData(hitElement, "meslek", false) givePlayerMoney(hitElement, 123) end end end end addEvent("meslek:basla", true) addEventHandler("meslek:basla", root, function() setElementData(source, "kargo:meslek", true) setElementData(source, "meslek", true) kargo_arac[source] = createVehicle(456, -29.71848, -1122.65125, 1.07812) warpPedIntoVehicle(source, kargo_arac[source]) setVehicleLocked(kargo_arac[source], true) meslekbitis_marker = createMarker(-157.16824, -282.63116, 3.90531, "checkpoint", 2.5 , 255, 185, 15) kargobitis_blips = createBlip(-157.16824, -282.63116, 3.90531, 56) addEventHandler("onMarkerHit", meslekbitis_marker, meslekbitis) end) i edits the code, check again Edited November 18, 2022 by Shady1 kodu düzeltttim Link to comment
aunque Posted November 18, 2022 Author Share Posted November 18, 2022 I'm just starting to learn the Lua language thanks for your help but this time it will not detect the marker on the profession tool. Link to comment
Shady1 Posted November 18, 2022 Share Posted November 18, 2022 kargo_arac = {} kargo_teslim = {} local meslekbitis_marker local kargobitis_blips function meslekbitis(hitElement, matchingDimension) if(getElementType(hitElement) == "vehicle") then if(kargo_arac[hitElement]) then local player = getVehicleOccupant(hitElement) destroyElement(kargo_arac[hitElement]) destroyElement(meslekbitis_marker) destroyElement(kargobitis_blips) setElementData(player, "kargo:meslek", false) setElementData(player, "meslek", false) givePlayerMoney(player, 123) end end end addEvent("meslek:basla", true) addEventHandler("meslek:basla", root, function() setElementData(source, "kargo:meslek", true) setElementData(source, "meslek", true) kargo_arac[source] = createVehicle(456, -29.71848, -1122.65125, 1.07812) warpPedIntoVehicle(source, kargo_arac[source]) setVehicleLocked(kargo_arac[source], true) meslekbitis_marker = createMarker(-157.16824, -282.63116, 3.90531, "checkpoint", 2.5 , 255, 185, 15) kargobitis_blips = createBlip(-157.16824, -282.63116, 3.90531, 56) addEventHandler("onMarkerHit", meslekbitis_marker, meslekbitis) end) try this code Link to comment
aunque Posted November 18, 2022 Author Share Posted November 18, 2022 Unfortunately still the same Link to comment
Shady1 Posted November 18, 2022 Share Posted November 18, 2022 2 minutes ago, aunque said: Unfortunately still the same do you want it for all vehicles Link to comment
aunque Posted November 18, 2022 Author Share Posted November 18, 2022 No just kargo_arac[source] = createVehicle(456, -29.71848, -1122.65125, 1.07812) I want for this vehicle is:456 Link to comment
mafioz Posted November 18, 2022 Share Posted November 18, 2022 Can you clarify what you want to do? I'm using a translator and didn't quite understand you Link to comment
aunque Posted November 18, 2022 Author Share Posted November 18, 2022 destroyElement(meslekbitis_marker) the code is not working how can i run it? Link to comment
mafioz Posted November 18, 2022 Share Posted November 18, 2022 11 minutes ago, aunque said: destroyElement(meslekbitis_marker) the code is not working how can i run it? Who is the source of events "meslek:basla"? Link to comment
aunque Posted November 18, 2022 Author Share Posted November 18, 2022 Thanks for your help, I solved the problem. Link to comment
Shady1 Posted November 18, 2022 Share Posted November 18, 2022 57 minutes ago, aunque said: Thanks for your help, I solved the problem. If you have another problem, I recommend you to open a new topic, we will help you. 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