Squirrel/Server/Functions/Misc/KickPlayer
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function kicks a player from the server == Syntax == <code>bool KickPlayer( int id )</code> == Arguments == * '''id''' - ID of the player to kick == Example == This wi...) |
m |
||
Line 4: | Line 4: | ||
== Syntax == | == Syntax == | ||
− | <code>bool KickPlayer( | + | <code>bool KickPlayer( player plr )</code> |
== Arguments == | == Arguments == | ||
− | * ''' | + | * '''plr''' - pointer of the player to kick |
== Example == | == Example == | ||
Line 15: | Line 15: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function OnPlayerJoin( | + | function OnPlayerJoin( player ) |
{ | { | ||
− | if ( | + | if ( player.Name != "Bob" ) |
{ | { | ||
− | MessagePlayer( "Your name isn't Bob! Only Bob is allowed on this server!.", | + | MessagePlayer( "Your name isn't Bob! Only Bob is allowed on this server!.", player ); |
− | KickPlayer( | + | KickPlayer( player ); |
} | } | ||
} | } |
Revision as of 20:34, 31 March 2009
This function kicks a player from the server
Syntax
bool KickPlayer( player plr )
Arguments
- plr - pointer of the player to kick
Example
This will kick a player on join if his name is not 'Bob'
function OnPlayerJoin( player ) { if ( player.Name != "Bob" ) { MessagePlayer( "Your name isn't Bob! Only Bob is allowed on this server!.", player ); KickPlayer( player ); } }
Notes
The calls OnPlayerJoin and MessagePlayer were used in in this example. More info about there in the corresponding pages.