Garry's Mod Wiki

server_addban

Description

Called when a Player is banned using Player:Ban, banip or the banid command.

If banip was used the networkid will be an empty string.
If banid was used the ip will be an empty string.

Members

string networkid
The SteamID the player has. Will be BOT for bots and STEAM_0:0:0 in single-player.
string name
The name the player has.
number userid
The UserID the player has.
string ip
The IPAddress of the player.
string duration
The Duration of the Ban (in minutes).
string by
The name of the Person who Banned the Player or Console.
boolean kicked
whether the player was also kicked.

Examples

Example

This is a basic template with the purpose of including all arguments / table variables to make it easily known which values can be accessed.

gameevent.Listen( "server_addban" ) hook.Add( "server_addban", "server_addban_example", function( data ) local name = data.name // Same as Player:Nick() local steamid = data.networkid // Same as Player:SteamID() local id = data.userid // Same as Player:UserID() local ip = data.ip // Same as Player:IPAddress() local duration = data.duration // The Duration of the Ban (in minutes). local by = data.by // The Person who banned the Player. Can be Console. local kicked = data.kicked // If the player was kicked or not. // Called when a Player is banned. end )