Jump to content

Unsure What Arg 2 Of addEventHandler Should Be


Recommended Posts

Well Here Is My Script I Have Never Quite Understood The 2 Arg In addEventHandler

addEvent("team:selectstart",true) 
function teamselect(player) 
    setElementPostition(player, 1928.68359375, -1776.30078125, 13.546875) 
    setPedRotation(player, 268) 
    setCameraMatrix(player, 1937.7578125, -1775.8779296875, 13.3828125, 1928.68359375, -1776.30078125, 13.546875) 
end 
addEventHandler("team:selectstart", ?, teamselect) 
     

Link to comment

the second argument of addEventHandler is something like.. the multitude of sources that can trigger it.

getRootElement() would mean that any element can trigger it

getResourceRootElement() would mean that only the current resource

example:

local marker = createMarker(..)

addEventHandler('onMarkerHit', marker, functionToExecute)

this means that onMarkerHit is only triggered via our own 'marker'

I should also note that your code is wrong. "?" is not defined anywhere.

Also, player element won't be passed just like that. Unless you know what you're doing, this could be nil.

Link to comment
You upper-case the first letter in every word. And did it ever come to you that all you had to do is click on addEventHandler in your first post and then, of course, read?

and binslayer, it's a '?' because he's not sure about the second argument. He wants to know what it's for.

http://wiki.multitheftauto.com/wiki/AddEventHandler

:/ I Can Read What I Write Either Your Blind Or You Cant Read Words With Capital Letters In Them

P.S. Thanks BinSlayer

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