OnIncomingConnection vs OnPlayerConnect
#1

So, I've been testing stuff out with the OnIncomingConnection callback, and wondered.
Can I do ban-checks on that callback, and 'deny'(Kick) connections if a ban has been found from there?
Or will that not display stuff to the connector/player.. cause time-outs if the connectors/players internet is slow?
Reply
#2

Why would you do ban check on OnIncomingConnection callback? It's not for that purpose, it just shows any incoming connection which doesn't means that player has connected to the server. It even can be someone flooding connections which could make your server alot slower because of many ban checks. Just use OnPlayerConnect.
Reply
#3

Quote:
Originally Posted by iZN
Посмотреть сообщение
Why would you do ban check on OnIncomingConnection callback? It's not for that purpose, it just shows any incoming connection which doesn't means that player has connected to the server. It even can be someone flooding connections which could make your server alot slower because of many ban checks. Just use OnPlayerConnect.
I just thought that It would be some-what more effective against bot-attacks xD

But what about this one;
pawn Код:
public OnIncomingConnection(playerid, ip_address[], port)
{
    new IPUsers = GetNumberOfPlayersOnThisIP(PlayerIP(playerid));
    if(IPUsers > MAX_CONNECTIONS_FROM_IP) BanWithReason(INVALID_PLAYER_ID, playerid, "Bot Attack");
    return 1;
}
Can that one stay, or should I move it back to OnPlayerConnect?
Reply
#4

Quote:
Originally Posted by Kyance
Посмотреть сообщение
I just thought that It would be some-what more effective against bot-attacks xD

But what about this one;
pawn Код:
public OnIncomingConnection(playerid, ip_address[], port)
{
    new IPUsers = GetNumberOfPlayersOnThisIP(PlayerIP(playerid));
    if(IPUsers > MAX_CONNECTIONS_FROM_IP) BanWithReason(INVALID_PLAYER_ID, playerid, "Bot Attack");
    return 1;
}
Can that one stay, or should I move it back to OnPlayerConnect?
Just think, if two players or more are connecting to your server, and your function GetNumberOfPlayersOnThisIP will check this 2 or more times which might de-sync the player and they might need to re-connect to your server. You can try fiddling around with this though, but under my consideration, one or more players might get de-synced because of many checks. I'd still recommend using OnPlayerConnect otherwise just test it because I don't have much idea about OnIncomingConnection.
Reply
#5

Quote:
Originally Posted by iZN
Посмотреть сообщение
Just think, if two players or more are connecting to your server, and your function GetNumberOfPlayersOnThisIP will check this 2 or more times which might de-sync the player and they might need to re-connect to your server. You can try fiddling around with this though, but under my consideration, one or more players might get de-synced because of many checks. I'd still recommend using OnPlayerConnect otherwise just test it because I don't have much idea about OnIncomingConnection.
Well then.. I will just keep it on OnPlayerConnect & use that minconnectiontime to do stuff.. thanks

by the way, nice signature
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)