xxldoener Posted June 1, 2012 Posted June 1, 2012 Ok, I just started scripting today and I wanted to start off very simpel, but I failed with my plan. First thing I programmed a code with which a message is given once a player enters a server. Everybody on the server can read this message. Next thing I wanted to make another message when entering the server, but this one should only be shown to the person that entered the server. I tried everything that came to my mind. I know that you can do outputChatBox(text, visibleTo) but I don't know what to enter for "visibileTo". The only thing I got it to work with was GetRandomPlayer() which is not what I want. But all the commands like getLocalPlaeyer() are client sided thus don't work. Can any1 help me?
Castillo Posted June 1, 2012 Posted June 1, 2012 You're using the event: onPlayerJoin? if so, then use 'source'.
xxldoener Posted June 1, 2012 Author Posted June 1, 2012 So here is my code, but it doesn't work... function welcomemsg() local name = getPlayerName(source) outputConsole('Welcome to the server, '..name..' !', source) end addEventHandler("onPlayerJoin", getRootElement(), welcomemsg) Edit: Ok, I finally got it function welcomemsg ( ) local name = getPlayerName ( source ) outputChatBox ( "Welcome to the server, " .. name .. "!", source) end addEventHandler ( "onPlayerJoin", getRootElement(), welcomemsg)
Castillo Posted June 1, 2012 Posted June 1, 2012 Yeah, you was using outputConsole instead of outputChatBox .
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