BlockIpAddress

BlockIpAddress

Description:
Function BlockIpAddress blocks an IP address from further communication with the server for a set amount of time (with wildcards allowed). Players trying to connect to the server with a blocked IP address will receive the generic "You are banned from this server." message. Players that are online on the specified IP before the block will timeout after specific amount of seconds and, upon reconnect, will receive the same message. Effect takes place only when server is running (it is not persistent).
Function BlockIpAddress was added in 0.3z R2-2 and will not work in earlier versions!
Wildcards can be used with this function, for example blocking the IP '6.9.*.*' will block all IPs where the first two octets are 6 and 9 respectively. Any number can be in place of an asterisk.


Parameters:
(ip_address[], timems)
string ip_address The IP to block.
int timems The time (in milliseconds) that the connection will be blocked for. 0 can be used for an indefinite block.


Return Values:
1 if ip_address string is not empty, otherwise 0.


Examples:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success) // if they supplied a bad password
    {
        BlockIpAddress(ip, 60 * 1000); // block the connections from this ip for one minute
    }
    return 1;
}


Related Functions
The following functions may be useful, as they are related to this function in one way or another.