toxicsmoke11 Posted March 10, 2014 Share Posted March 10, 2014 function test() local player = getPlayerName (source) outputChatBox("Say hello to " .. player .. ":D") end addEventHandler("onPlayerJoin", test) WARNING: test\script.lua:5: Bad argument @ 'addEventHandler' [Expected element at argument 2, got function] I doubt that i have to explain what i'm doing because it's obvious imo. Link to comment
Saml1er Posted March 10, 2014 Share Posted March 10, 2014 function test () outputChatBox ("Say Hello to " ..getPlayerName (source).." : D", getRootElement()) -- getRootElement() will send message to everyone end addEventHandler ("onPlayerJoin", getRootElement(), test) -- syntax for event Handler is (EventName, AttachTo, functionName ) Link to comment
toxicsmoke11 Posted March 10, 2014 Author Share Posted March 10, 2014 Thank you Saml1er Link to comment
Saml1er Posted March 10, 2014 Share Posted March 10, 2014 No problem. You seem to be interested in lua so if you need help with anything let me know then. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now