Bean666 Posted February 9, 2021 Posted February 9, 2021 Hi, i created a marker and it's small, and whenever I hit it, it gives out some functions, the problem is, it works, but if the marker is below me, it still works. EX: im in a roof and the marker is inside the building, whenever my position matches with the marker no matter how high up i am, it still triggers the onClientMarkerHit, do i need a col for my marker or theres something wrong. weapmarker = createMarker(-1519.1829833984, 2587.1801757813, 55.3,"cylinder",1.0,0,255,0,100) addEventHandler ( "onClientMarkerHit", resourceRoot, function ( hitPlayer ) if ( hitPlayer == localPlayer and getElementType ( hitPlayer ) == "player" ) then if not isPedInVehicle ( hitPlayer ) then if (interact == false) then interact = true; addEventHandler("onClientPreRender", getRootElement(), drawh); end end end end) Aftermath
Furzy Posted February 9, 2021 Posted February 9, 2021 (edited) Get players z position and make a condition Ex: local x,y,z = getElementPosition(localPlayer) if z > 20 then return end OBS: ( the 20 is just an example get your player position in marker and add more o less depending where is your marker ) Edited February 9, 2021 by Furzy FURZY'S CUSTOM WEAPON SYSTEM Discord: Furzy#4125
Moderators xLive Posted February 9, 2021 Moderators Posted February 9, 2021 Btw + You should use the predefined variable root instead of calling getRootElement to save a function call you can also see all predefined variables from here [REL] Vehicle Cannon [SHOW] Piano - Max Payne 3 GitHub
Moderators IIYAMA Posted February 9, 2021 Moderators Posted February 9, 2021 (edited) 9 hours ago, Shaman123 said: col for my marker or theres something wrong Colshapes are more reliable. You could try these functions: https://wiki.multitheftauto.com/wiki/GetElementColShape < use on marker https://wiki.multitheftauto.com/wiki/GetColShapeSize If there is some abnormality in height --> https://wiki.multitheftauto.com/wiki/CreateColTube (https://forum.multitheftauto.com/topic/100069-tut-addeventhandler-on-a-group-of-elements-small-tutorial/) Edited February 9, 2021 by IIYAMA Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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