mehdi koocholo Posted June 8, 2023 Share Posted June 8, 2023 hi guys i want call marker from another function like this code local hidemark = createMarker(10,50,5,"cylinder",1,0,255,0) function mark(theplayer) markerveh =createMarker(0,0,5,"cylinder",1,0,255,0) end addEventHandler("onMarkerHit",marker1,mark) function job1(theplayer) setElementVisibleTo(markerveh,root,false)-- for here end addCommandHandler("hidemark",job1) Link to comment
Shady1 Posted June 8, 2023 Share Posted June 8, 2023 10 minutes ago, mehdi koocholo said: hi guys i want call marker from another function like this code local hidemark = createMarker(10,50,5,"cylinder",1,0,255,0) function mark(theplayer) markerveh =createMarker(0,0,5,"cylinder",1,0,255,0) end addEventHandler("onMarkerHit",marker1,mark) function job1(theplayer) setElementVisibleTo(markerveh,root,false)-- for here end addCommandHandler("hidemark",job1) local hidemark -- define hidemark as a global variable function createMarkers() hidemark = createMarker(10, 50, 5, "cylinder", 1, 0, 255, 0) end addEventHandler("onResourceStart", resourceRoot, createMarkers) function mark(thePlayer, matchingDimension) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then local markerveh = createMarker(0, 0, 5, "cylinder", 1, 0, 255, 0) -- Do something with markerveh end end addEventHandler("onMarkerHit", hidemark, mark) function job1(thePlayer) setElementVisibleTo(hidemark, root, false) end addCommandHandler("hidemark", job1) this test code, i hope helps to you Link to comment
mehdi koocholo Posted June 8, 2023 Author Share Posted June 8, 2023 5 minutes ago, Shady1 said: local hidemark -- define hidemark as a global variable function createMarkers() hidemark = createMarker(10, 50, 5, "cylinder", 1, 0, 255, 0) end addEventHandler("onResourceStart", resourceRoot, createMarkers) function mark(thePlayer, matchingDimension) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then local markerveh = createMarker(0, 0, 5, "cylinder", 1, 0, 255, 0) -- Do something with markerveh end end addEventHandler("onMarkerHit", hidemark, mark) function job1(thePlayer) setElementVisibleTo(hidemark, root, false) end addCommandHandler("hidemark", job1) this test code, i hope helps to you i want call markerveh not hidemark Link to comment
Shady1 Posted June 8, 2023 Share Posted June 8, 2023 1 minute ago, mehdi koocholo said: i want call markerveh not hidemark https://wiki.multitheftauto.com/wiki/SetElementVisibleTo Can you explain exactly what you want? Link to comment
mehdi koocholo Posted June 8, 2023 Author Share Posted June 8, 2023 1 minute ago, Shady1 said: https://wiki.multitheftauto.com/wiki/SetElementVisibleTo Can you explain exactly what you want? i want call markerveh from function mark to function job 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