BanEx

From SA-MP Wiki

Jump to: navigation, search

BanEx


This function can be used to ban a player who currently is in your server. The ban will be IP-based and include a specified reason, and saved in the samp.ban file in your server's root directory. Ban allows you to ban without a reason, while you can ban and unban IP's using the RCON banip and unbanip commands.


Parameters:
(playerid,reason)
playeridThe ID of the player you want to ban.
reasonThe reason for the ban.
This function does not return a specific value, it's best to simply ignore it.


public OnPlayerCommandText( playerid, cmdtext[] )
{
    if( strcmp( cmdtext, "/banme", true ) == 0 )
    {
        // Bans the player who executed this command and includes a reason ("Request")
        BanEx( playerid, "Request" );
        return 1;
    }
}

For example, this will add this line to the samp.ban if I typed /banme:

127.0.0.1 [15/01/09 | 13:05:23] Mike - Request

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

  • Ban: Ban a player from playing on the server.
  • Kick: Kick a player from the server.
Personal tools
In other languages