/ban /kick /warning /say |
FUTURE UPDATES: * Create levels system " 1 - VIP, 2 - ADMIN, 3 - OWNER * Create for levels commands * Add commands for admins
// ========================================================================== //
/*
oAdmin - organe. Admin system
v1.0
Administrator commands:
- /ban - ban selected player.
- /kick - kick selected player.
- /warning - give warning for player.
- /say - Say text for all players.
This is not last system version
*/
// ========================================================================== //
#include < a_samp >
#include < zcmd >
#include < sscanf >
new Admin[ MAX_PLAYERS ];
new Warning[ MAX_PLAYERS ];
public OnPlayerSpawn( playerid )
{
if( Admin[ playerid ] == 1 )
{
new string[ 100 ];
format( string, 100, "{FF0000}Administrator %s spawned", pName( playerid ) );
SendClientMessageToAll( -1, string );
}
return 1;
}
/* Administrator commands */
COMMAND:ban( playerid, params[ ] )
{
new ID;
if( Admin[ playerid ] == 1 ) return 0;
if( sscanf( params, "us", ID, params ) ) return SendClientMessage( playerid, -1, "{FFFF00}Use example: /ban [ NAME or ID ] [ REASON ].");
if( !IsPlayerConnected( ID ) ) return SendClientMessage( playerid, -1, "{FFFF00}Selected playerid not connected.");
else
{
new string[ 100 ];
format( string, 100, "[ BAN ]: Admin [ %s ] banned [ %s ].", pName( playerid ), pName( ID ) );
SendClientMessageToAll( -1, string );
format( string, 100, "{FF0000}[] %s ", params );
SendClientMessageToAll( -1, string );
Ban( ID );
}
return 1;
}
COMMAND:kick( playerid, params[ ] )
{
new ID;
if( Admin[ playerid ] == 1 ) return 0;
if( sscanf( params, "us", ID, params ) ) return SendClientMessage( playerid, -1, "{FFFF00}Use example: /kick [ NAME or ID ] [ REASON ].");
if( !IsPlayerConnected( ID ) ) return SendClientMessage( playerid, -1, "{FFFF00}Selected playerid not connected.");
else
{
new string[ 100 ];
format( string, 100, "[ KICK ]: Admin [ %s ] kicked [ %s ].", pName( playerid ), pName( ID ) );
SendClientMessageToAll( -1, string );
format( string, 100, "{FF0000}[] %s ", params );
SendClientMessageToAll( -1, string );
Kick( ID );
}
return 1;
}
COMMAND:say( playerid, params[ ] )
{
if( Admin[ playerid ] == 1 ) return 0;
if( sscanf( params, "s", params ) ) return SendClientMessage( playerid, -1, "{FFFF00)Use example: /say [ TEXT ].");
else
{
new string[ 100 ];
format( string, 100, "Admin [ %s ]: %s", pName( playerid ), params );
SendClientMessageToAll( -1, string );
}
return 1;
}
COMMAND:warning( playerid, params[ ] )
{
new ID;
if( Admin[ playerid ] == 1 ) return 0;
if( sscanf( params, "us", ID, params ) ) return SendClientMessage( playerid, -1, "{FFFF00}Use example: /warning [ NAME or ID ] [ REASON ].");
if( !IsPlayerConnected( ID ) ) return SendClientMessage( playerid, -1, "{FFFF00}Selected player not connected.");
else
{
new string[ 100 ];
format( string, 100, "Admin [ %s ] give warning for [ %s ].", pName( playerid ), pName( ID ) );
SendClientMessageToAll( -1, string );
format( string, 100, "{FF0000}[] %s", params );
SendClientMessageToAll( -1, string );
}
if( Warning[ playerid ] > 5 )
{
SendClientMessage( playerid, -1, "Sorry, but you banned for 5 warnings.");
SendClientMessage( playerid, -1, "For unban please wisit: ");
Ban( playerid );
}
return 1;
}
stock pName(playerid)
{
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,playerName,sizeof(playerName));
return playerName;
}
COMMAND:kick(playerid, params[ ] ) { new ID; if( Admin[ playerid ] == 1 ) return 0; if( sscanf( params, "us", ID, params ) ) return SendClientMessage( playerid, -1, "{FFFF00}Use example: /kick [ NAME or ID ] [ REASON ]."); if( !IsPlayerConnected( ID ) ) return SendClientMessage( playerid, -1, "{FFFF00}Selected playerid not connected."); else { new string[ 100 ]; format( string, 100, "[ KICK ]: Admin [ %s ] kicked [ %s ].", pName( playerid ), pName( ID ) ); SendClientMessageToAll( -1, string ); format( string, 100, "{FF0000}[] %s ", params ); SendClientMessageToAll( -1, string ); Kick( ID ); } return 1; }
CMD:kick(playerid, params[]) { new ID; if( Admin[ playerid ] == 1 ) return 0; if( sscanf( params, "us", ID, params ) ) return SendClientMessage( playerid, -1, "{FFFF00}Use example: /kick [ NAME or ID ] [ REASON ]."); if( !IsPlayerConnected( ID ) ) return SendClientMessage( playerid, -1, "{FFFF00}Selected playerid not connected."); else { new string[ 100 ]; format( string, 100, "[ KICK ]: Admin [ %s ] kicked [ %s ].", pName( playerid ), pName( ID ) ); SendClientMessageToAll( -1, string ); format( string, 100, "{FF0000}[] %s ", params ); SendClientMessageToAll( -1, string ); Kick( ID ); } return 1; }