Jump to content

help: Marker(cylinder)


H!tman

Recommended Posts

Posted

marker = createMarker(0, 0, -10, "cylinder", 1, 255, 0, 0, 255) 
function markerHit() 
    outputChatBox("hit") 
end 
addEventHandler("onClientMarkerHit", getRootElement(), markerHit) 

when i go to this position: x= 0 , y= 0 , z= 3 the event happen at same position except Z position.

is this MTA bug or the marked like that?

Posted (edited)

You forgot the name. You had getRootElement(), it also seems that you had some weird invincible character there.

local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) 
  
function onMarkerHit(hitPlayer, matchingDimension) 
    if hitPlayer then 
         outputChatBox("hit") 
    end 
end 
addEventHandler("onClientMarkerHit", marker, onMarkerHit) 

Tested.

Edited by Guest
Posted (edited)

Edited.

Are you sure you're doing this all on client-side? Because this is a client-side script, otherwise you should use onMarkerHit instead of onClientMarkerHit.

Edited by Guest
Posted

Try This :)

local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) 
  
function MarkerHit( hitElement, matchingDimension )-- define MarkerHit function for the handler 
  
    local elementType = getElementType( hitElement )-- get the hit element's type 
  
    outputChatBox( elementType.." Hit", getRootElement(), 255, 255, 0 )-- attach the element's type with the text, and output it 
  
end 
addEventHandler( "onMarkerHit", marker, MarkerHit )-- attach onMarkerHit event to MarkerHit function 

Posted (edited)
Try This :)
local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) 
  
function MarkerHit( hitElement, matchingDimension )-- define MarkerHit function for the handler 
  
    local elementType = getElementType( hitElement )-- get the hit element's type 
  
    outputChatBox( elementType.." Hit", getRootElement(), 255, 255, 0 )-- attach the element's type with the text, and output it 
  
end 
addEventHandler( "onMarkerHit", marker, MarkerHit )-- attach onMarkerHit event to MarkerHit function 

He is trying to make it client-side, he did not ask any graphics on his chat message and there is no need for that long script to find out is the element a player.

And you just copied it (https://wiki.multitheftauto.com/wiki/OnMarkerHit).

Man, please, I know you want to help, but copying straight from the wiki isn't a way to help - tho', it depends on script.

EDIT:

It seems like I misunderstood your problem, H!itman.

Yes, it's a Multi Theft Auto bug in my opinion, I've got a self-made toll script and it's annoying, always when you go fly over it like in 100 meters, it does the same.

Edited by Guest
Posted

it works but if i was in same x and y except z (if my z position was 100 or -100) the function works too

that's the problem like myonlake said.

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...