Description
With bind you can bind an eventHandler to an element from your class.
Syntax
bind(Classname.function,element)
Example
CCarhouse = {} function CCarhouse:constructor(ID,Model,X,Y,Z,RX,RY,RZ,Price) self.ID = ID self.Model = Model self.X = X self.Y = Y self.Z = Z self.RX = RX self.RY = RY self.RZ = RZ self.Price = Price self.Name = getVehicleNameFromModel(self.Model) self.eOnClck = bind(CCarhouse.onClick, self) addEventHandler("onElementClicked",self, self.eOnClick) end function CCarhouse:onClick(button,state,player) if button == "left" and state == "down" then outputChatBox("Clicked on "..self.Name,player,255,255,255) end end
There was an error while loading. Please reload this page.