Jump to content

[SOLVED]addEventHandler Problem


Chronic

Recommended Posts

When I go in theMarker3, nothing happens, I'm really confused on what I did wrong.

function marker ( thePlayer ) 
theMarker3 = createMarker ( 497.24795532227,-75.805885314941,997.5578125, "cylinder", 1, 255, 105, 180, 170 ) 
setElementInterior ( theMarker3, 11 ) 
addEventHandler ( "onMarkerHit", theMarker3, drinks ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, marker ) 
  
function drinks ( thePlayer ) 
outputChatBox ( "test" ) 
end 

The marker spawns fine, but nothing happens when I enter it.

Edited by Guest
Link to comment

The code is very messy. As to make it clearer and easier-to-understand I'd made some modifications.

Try this, I just removed the MARKER function as whenever a resource is started, the server reads everything so its not so needed (the onResourceStart event, I mean).

Btw, your mistake is that DRINKS function is below the eventHandler, which will mean, when the eventHandler is created, drinks function will not exist as it wasn't read yet, so easier would be:

theMarker3 = createMarker ( 497.24795532227,-75.805885314941,997.5578125, "cylinder", 1, 255, 105, 180, 170 ) 
setElementInterior ( theMarker3, 11 ) 
setElementInterior ( theMarker3, 11 ) 
  
function drinks(thePlayer) 
     outputChatBox("tits") 
end 
  
addEventHandler ( "onMarkerHit", theMarker3, drinks ) 

Be sure to use debugscript 3 in order to see any mistake (you'd have realized an error would have been shown

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