Jump to content

[SOLVED] Marker


luskanek

Recommended Posts

Posted (edited)

Hello,

for key, corona in pairs (getElementsByType("marker")) do 
    if getMarkerType(corona) == "corona" then 

What I'm trying to do is to detect when a element hits a corona marker, however, the code triggers always, so not when it's a corona only. How do I fix this?

Edited by Guest
Posted
Hello,
for key, corona in pairs (getElementsByType("marker")) do 
    if getMarkerType(corona) == "corona" then 

What I'm trying to do is to detect when a element hits a corona marker, however, the code triggers always, so not when it's a corona only. How do I fix this?

Try this:

  
local corona = getElementsByType("marker") 
for key, v in pairs (corona) do 
    if getMarkerType(corona[i]) == "corona" then 

YnVnhLx.png

'^ Just a beginner scripter.'

Posted
Hello,
for key, corona in pairs (getElementsByType("marker")) do 
    if getMarkerType(corona) == "corona" then 

What I'm trying to do is to detect when a element hits a corona marker, however, the code triggers always, so not when it's a corona only. How do I fix this?

Try this:

  
local corona = getElementsByType("marker") 
for key, v in pairs (corona) do 
    if getMarkerType(corona[i]) == "corona" then -- or this:  if getMarkerType(v[i]) == "corona" then -- not sure with this  

YnVnhLx.png

'^ Just a beginner scripter.'

Posted

https://wiki.multitheftauto.com/wiki/OnMarkerHit

The source of this event is the marker that got hit by the element.
function lol(tElement) 
    if (getElementType(tElement) == "player") then 
        if (getMarkerType(source) == "corona") then 
            --Stuff 
        end 
    end 
end 
  
addEventHandler("onMarkerHit", root, lol) 

Posted
addEventHandler("onMarkerHit", getRootElement(), 
    function(tElement) 
        if getElementType(tElement) == "vehicle" then 
            if getMarkerType(source) == "corona" then 
                local x, y, z = getElementVelocity(tElement) 
                setElementVelocity(tElement, x * 1.06, y * 1.06, z) 
            end 
        end 
    end 
) 

Doesn't work, no errors.

Posted

Try increase the number.

addEventHandler("onMarkerHit", getRootElement(), 
    function(tElement) 
        if getElementType(tElement) == "vehicle" then 
            if getMarkerType(source) == "corona" then 
                local x, y, z = getElementVelocity(tElement) 
                setElementVelocity(tElement, x * 2.5, y * 2.5, z) 
            end 
        end 
    end 
) 

CiTLh.png

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