BanList Class Reference
Used for kicking and banning players from a server. There is only a single instance of BanList. It is very important to note that you do not ever create this object in script like you would other game play objects. You simply reference it via namespace.
More...
List of all members.
Static Public Member Functions |
static void | add (int uniqueId, string transportAddress, int banLength) |
| Ban a user for banLength seconds.
|
static void | addAbsolute (int uniqueId, string transportAddress, int banTime) |
| Ban a user until a given time.
|
static void | export (string filename) |
| Dump the banlist to a file.
|
static bool | isBanned (int uniqueId, string transportAddress) |
| Is someone banned?
|
static void | removeBan (int uniqueId, string transportAddress) |
| Unban someone.
|
Detailed Description
Used for kicking and banning players from a server. There is only a single instance of BanList. It is very important to note that you do not ever create this object in script like you would other game play objects. You simply reference it via namespace.
For this to be used effectively, make sure you are hooking up other functions to BanList. For example, functions like GameConnection::onConnectRequestRejected( this, msg ) and function GameConnection::onConnectRequest are excellent places to make use of the BanList. Other systems can be used in conjunction for strict control over a server
- See also:
- addBadWord
-
containsBadWords
Member Function Documentation
static void BanList::add |
( |
int |
uniqueId, |
|
|
string |
transportAddress, |
|
|
int |
banLength | |
|
) |
| | [static] |
Ban a user for banLength seconds.
- Parameters:
-
| uniqueId | Unique ID of the player. |
| transportAddress | Address from which the player connected. |
| banLength | Time period over which to ban the player. |
- Example:
function kick(%client)
{
messageAll( 'MsgAdminForce', '\c2The Admin has kicked %1.', %client.playerName);
if (!%client.isAIControlled())
BanList::add(%client.guid, %client.getAddress(), $pref::Server::KickBanTime);
%client.delete("You have been kicked from this server");
}
static void BanList::addAbsolute |
( |
int |
uniqueId, |
|
|
string |
transportAddress, |
|
|
int |
banTime | |
|
) |
| | [static] |
Ban a user until a given time.
- Parameters:
-
| uniqueId | Unique ID of the player. |
| transportAddress | Address from which the player connected. |
| banTime | Time at which they will be allowed back in. |
- Example:
function kick(%client)
{
messageAll( 'MsgAdminForce', '\c2The Admin has kicked %1.', %client.playerName);
if (!%client.isAIControlled())
BanList::addAbsolute(%client.guid, %client.getAddress(), $pref::Server::KickBanTime);
%client.delete("You have been kicked from this server");
}
static void BanList::export |
( |
string |
filename |
) |
[static] |
Dump the banlist to a file.
- Parameters:
-
| filename | Path of the file to write the list to. |
- Example:
BanList::Export("./server/banlist.cs");
static bool BanList::isBanned |
( |
int |
uniqueId, |
|
|
string |
transportAddress | |
|
) |
| | [static] |
Is someone banned?
- Parameters:
-
| uniqueId | Unique ID of the player. |
| transportAddress | Address from which the player connected. |
- Example:
function GameConnection::onConnectRequest( %client, %netAddress, %name )
{
echo("Connect request from: " @ %netAddress);
if(BanList::isBanned(%client.guid, %netAddress))
return "CR_YOUAREBANNED";
if($Server::PlayerCount >= $pref::Server::MaxPlayers)
return "CR_SERVERFULL";
return ;
}
static void BanList::removeBan |
( |
int |
uniqueId, |
|
|
string |
transportAddress | |
|
) |
| | [static] |
Unban someone.
- Parameters:
-
| uniqueId | Unique ID of the player. |
| transportAddress | Address from which the player connected. |
- Example:
-