aintaro Posted June 4, 2014 Share Posted June 4, 2014 Hello when I use the onplayerconnect event from the mtasa wiki example nothing happens : --when a player connects function playerConnect (playerNick, playerIP, playerUsername, playerSerial, playerVersionNumber) if playerNick == "Player" then --check if his nick is "Player" cancelEvent(true,"The nick \"Player\" is not allowed, please change it to something else. You can change your nick in Settings menu Multiplayer tab.") --in that case refuse the connection else --output some data about the player outputChatBox (playerNick.." just connected to the server.") outputChatBox ("IP: "..playerIP.." Username: "..playerUsername.." Serial: "..playerSerial) end end --add the playerConnect function as a handler for onPlayerConnect addEventHandler ("onPlayerConnect", getRootElement(), playerConnect) is this event broken? Link to comment
xXMADEXx Posted June 4, 2014 Share Posted June 4, 2014 Does debugscript output any errors? Link to comment
aintaro Posted June 4, 2014 Author Share Posted June 4, 2014 Does debugscript output any errors? Nop nothing at all. Link to comment
Jusonex Posted June 4, 2014 Share Posted June 4, 2014 The only thing I can imagine is that you loaded the script on the client. Could you attach your meta.xml? Link to comment
aintaro Posted June 4, 2014 Author Share Posted June 4, 2014 I found the issue : onplayerconnect will only execute when another player joins the server. So basicly when you are testing on your machine you will not get the message with your ip and such because it only sends it to other players that are already connect on the server. Therefor I found another server event wich is called onPlayerJoin. onPlayerJoin will handle the player that just connected to the server instead of handling all the other players that are already connected. so the sum it all up : If you want other players to get a message when a specific player logs in then use : onPlayerConnect If you want the player that just connected to get a welcome message then use : onPlayerJoin Thanks again everybody for the help that you offered. Greetz, Aintaro 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