Difference between revisions of "CSecurity::ban"
From King Arthur's Gold Wiki
Shadlington (Talk | contribs) (Created page with "<onlyinclude> Bans the given CPlayer for the given length of time, in minutes. </onlyinclude> <syntaxhighlight lang="cpp"> void banPlayer( CPlayer@ player, s32 time_in_minute...") |
Shadlington (Talk | contribs) |
||
(4 intermediate revisions by the same user not shown) | |||
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 | + | 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> | ||
Line 11: | Line 14: | ||
{ | { | ||
if (text == "!banme") | if (text == "!banme") | ||
− | + | getSecurity().ban( player, 10 ); // 10 minute ban | |
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | Object method of: [[CSecurity]] | ||
[[Category:Scripting]] | [[Category:Scripting]] | ||
− | [[Category: | + | [[Category:Object Methods]] |
Latest revision as of 12: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 }
Object method of: CSecurity