OnIncomingConnection

OnIncomingConnection

Description:
Callback OnIncomingConnection is called when an IP address attempts a connection to the server. To block incoming connections, use BlockIpAddress.
Callback OnIncomingConnection was added in 0.3z R2-2 and will not work in earlier versions!


Parameters:
(playerid, ip_address[], port)
int playerid The ID of the player attempting to connect.
string ip_address The IP address of the player attempting to connect.
int port The port of the attempted connection.


Return Values:
  • 1 - Will prevent other filterscripts from receiving this callback.
  • 0 - Indicates that this callback will be passed to the next filterscript.
  • It is always called first in filterscripts.


Examples:
public OnIncomingConnection(playerid, ip_address[], port)
{
    printf("Incoming connection for player ID %i [IP/port: %s:%i]", playerid, ip_address, port);
    return 1;
}


Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.


Related Functions
The following functions may be useful, as they are related to this function in one way or another.
  • BlockIpAddress: Block an IP address from connecting to the server for a set amount of time.
  • UnBlockIpAddress: Unblock an IP that was previously blocked.