Jump to content



Recommended Posts

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);



Link to comment


Get players z position and make a condition


local x,y,z = getElementPosition(localPlayer)

if z > 20 then

OBS:  ( the 20 is just an example get your player position in marker and add more o less depending where is your marker )

Edited by Furzy
Link to comment
  • Scripting Moderators


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

Link to comment
  • Moderators
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


If there is some abnormality in height --> https://wiki.multitheftauto.com/wiki/CreateColTube



Edited by IIYAMA
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...