Posts: 434
Threads: 80
Joined: Oct 2008
Reputation:
0
Hi all,
i would like to know how could i use sendclientmessage and kick in OnIncomingConnection?
I tried but didn't work
Max
Posts: 6,129
Threads: 36
Joined: Jan 2009
You will want to use the OnPlayerConnect callback instead. OnIncomingConnection is called before the player has completed the connection, so you can't send them messages yet.
Posts: 434
Threads: 80
Joined: Oct 2008
Reputation:
0
Ok, i for the kick? Same thing?
Max
Posts: 6,129
Threads: 36
Joined: Jan 2009
Yes, move all of the relevant code to OnPlayerConnect...
Posts: 6,129
Threads: 36
Joined: Jan 2009
A fake player wouldn't receive the message anyway
Posts: 434
Threads: 80
Joined: Oct 2008
Reputation:
0
Yes but i am making an system.
Player who whan join have to login into my website.
When they will connect to the server, in OnIncomingConnection
if the ip isn't in the player stats, kick an say him that they need to log in into website to play
Max
Posts: 3,002
Threads: 86
Joined: Jul 2010
Reputation:
0
You can'd do that using the incoming connection callback. It won't return a player's ID for you to use.
Sendclientmessage needs a player ID. You don't have a choice but to let him connect, send the message and after that kick.
Or don't send a message at all. Just refuse the connection.