Scripting/Squirrel/Functions/Misc/BanIP

From VC-MP Wiki

Jump to: navigation, search

This function bans an IP address from joining the server.

Syntax

bool BanIP( string ip )

Arguments

  • ip - This is the IP address to be banned

Example

This example will ban the IP address player entered with command '/c banip 127.0.0.1'. It will enter the IP into a file called banlist.lst, you can remove/add bans in this file. Players with IP's that are contained within this file will not be able to connect to the server.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "banip" )
     {
          MessagePlayer( "You have banned IP " +text, player );
          BanIP( text );
     }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
squirrel scripting