Difference between revisions of "CSecurity::ban"

From King Arthur's Gold Wiki
Jump to: navigation, search
Line 1: Line 1:
 
<onlyinclude>
 
<onlyinclude>
Bans the given [[CPlayer]] for the given length of time, in minutes.
+
Bans the given player (by name or [[CPlayer]] reference) for the given length of time, in minutes. Can optionally provide a reason too.
 
</onlyinclude>
 
</onlyinclude>
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
void banPlayer( CPlayer@ player, s32 time_in_minutes )
+
void ban( CPlayer@ player, const s32 minutes )
 +
void ban( CPlayer@ player, const s32 minutes, const string &in reason )
 +
void ban( const string &in username, const s32 minutes )
 +
void ban( const string &in username, const s32 minutes, const string &in reason )
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 13:36, 8 September 2012

Bans the given player (by name or CPlayer reference) for the given length of time, in minutes. Can optionally provide a reason too.

void ban( CPlayer@ player, const s32 minutes )
void ban( CPlayer@ player, const s32 minutes, const string &in reason )
void ban( const string &in username, const s32 minutes )
void ban( const string &in username, const s32 minutes, const string &in reason )

Usage example, in which saying '!banme' in the chat will cause the player that said it to be banned for 10 minutes:

void ProcessChat( CRules@ this, string text, CPlayer@ player ) 
{
  if (text == "!banme")
    getSecurity().ban( player, 10 ); // 10 minute ban
}