Jump to content

Creating and triggering a marker in a function


tosfera

Recommended Posts

Okee so, this sounds so easy and I've done it before, but I always did it client-sided. This time I'm trying to create a marker with a command ( /sell ), and the only simple thing Im trying right now, is saying a message when a player enters the marker. But somehow, the server sideded script isn't recognising the marker as a proper element... :/

any idea's?

addCommandHandler("sell", 
    function ( source ) 
        local x, y, z = getElementPosition ( source ) 
        marker = createMarker(x, y, z-1, "cylinder", 4, 255, 0, 0, 150) 
    end 
) 
  
function testMarker( hitElement ) 
    outputChatBox("You entered a marker!", source) 
end 
addEventHandler("onMarkerHit", getRootElement(), testMarker) 
  

I'm doing this server-sided because its going to be like; you want some support? enter this marker and a private message thingy comes up. Just for fun, its like... a trade on other games, but then just walking. :D

Link to comment
Okee so, this sounds so easy and I've done it before, but I always did it client-sided. This time I'm trying to create a marker with a command ( /sell ), and the only simple thing Im trying right now, is saying a message when a player enters the marker. But somehow, the server sideded script isn't recognising the marker as a proper element... :/

any idea's?

addCommandHandler("sell", 
    function ( source ) 
        local x, y, z = getElementPosition ( source ) 
        marker = createMarker(x, y, z-1, "cylinder", 4, 255, 0, 0, 150) 
    end 
) 
  
function testMarker( hitElement ) 
    outputChatBox("You entered a marker!", source) 
end 
addEventHandler("onMarkerHit", getRootElement(), testMarker) 
  

I'm doing this server-sided because its going to be like; you want some support? enter this marker and a private message thingy comes up. Just for fun, its like... a trade on other games, but then just talking. :D

Link to comment

addCommandHandler("sell", 
    function ( source ) 
        local x, y, z = getElementPosition ( source ) 
        marker = createMarker(x, y, z-1, "cylinder", 4, 255, 0, 0, 150) 
    end 
) 
  
function testMarker( hitElement ) 
if (getElementType(hitElement) == "player") and ( source == marker ) then 
    outputChatBox("You entered a marker!",hitElement) 
        end 
   end 
addEventHandler("onMarkerHit", root, testMarker) 
  
Link to comment
addCommandHandler("sell", 
    function ( source ) 
        local x, y, z = getElementPosition ( source ) 
        marker = createMarker(x, y, z-1, "cylinder", 4, 255, 0, 0, 150) 
    end 
) 
  
function testMarker( hitElement ) 
if (getElementType(hitElement) == "player") and ( source == marker ) then 
    outputChatBox("You entered a marker!",hitElement) 
        end 
   end 
addEventHandler("onMarkerHit", root, testMarker) 
  

Hey thanks man, sorry 'bout yesterday. Trolling isn't the best thing to do at those points but, it kinda worked! Thaanks :3

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