14.08.2012, 11:41
(
Последний раз редактировалось M3mPHi$_S3; 23.08.2012 в 11:08.
)
Код:
I knew alot of poeple will commnads "not detailed" that's why i have written all things with fully detailed and have maked it clear And please dont give your worst and bad commands if you dont like it .
Equations :
- Advanced ban command made
- Using zcmd
- Hacker's wont be back
ZCMD is one of fast command maker and you can download this include from "".We will use zcmd for making the commands so add this at the top of your script of filterscript and make sure that you can < zcmd.inc > at your server pawn/Include folder.
pawn Код:
#include <zcmd>
- then we will start up with making the commands of /BAN
pawn Код:
CMD:ban(playerid, params[]) //>>:- instante of CMD you also can use COMMAND:
{
- Then we will see if the player is admin ? or either is he high enough lvl to use this commands so we will put secure :
pawn Код:
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " not authorised!");
pawn Код:
if (P_DATA[ playerid ][ P_Level ] <3) //---> this will get the player information you can change the 3 to any admin lvl with will be asked to have :D
- now we will define that the player's who are not login also can use it they'll need to be logged in
pawn Код:
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
pawn Код:
if (P_DATA[ playerid ][ P_Logged ] == 0)
3 ):-3rd
now if the %s player are logged in and he is admin so the system will send him the useage on how to use it : as
pawn Код:
if ( sscanf( params, "us", params[ 0 ] ,params[ 1 ]) )return SendUsage( playerid, "/ban <id> [reason]" );
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
pawn Код:
if( params[ 0 ] == playerid )return SendError( playerid, "You can't ban yourself!");
pawn Код:
FormMessageForAllEx(playerid,COLOR_RED, "Administrator %s has Perminatly banned %s from the server ! [Reason: %s]",PlayerName2( playerid ), PlayerName2( params[ 0 ] ), params[ 1 ]);
pawn Код:
FormMessage( params[ 0 ], COLOR_RED, "Administrator %s has perminatly banned you! [Reason: %s ]",PlayerName2( playerid ), params[ 1 ]);
- Now we will create the file storage mean we can also make it to ban or un-ban from the file !!!!!
pawn Код:
new gP_FILE[ 256 ];
pawn Код:
format( gP_FILE, 256, "Administration/Users/%s.ini", PlayerName2( params[ 0 ] ));
pawn Код:
format( gP_FILE, 256, "Administration/Users/%s.ini",// ---->> the place it should be :
- Now for making the nameed to be black listed
pawn Код:
new
iUID = BUD::GetNameUID( PlayerName2( params[ 0 ] ) )
;
BUD::SetIntEntry( iUID, "Banned", 1 ); ---> dont allowed if banned :
pawn Код:
new iString[ 256 ],Y,M,D,H,Mi,File:FILE;
getdate( Y, M, D );
gettime( H, Mi );
format( iString, 258, "===============================================\r\n\
Admin: %s\r\n\
Level: %d\r\n\
Player: %s\r\n\
Date: %d/%d/%d at %d:%d\r\n\
Reason: %s\r\n\
===============================================\r\n\r\n\r\n",
PlayerName2( playerid ),
P_DATA[ playerid ][ P_Level ],
PlayerName2( params[ 0 ] ),
D,
M,
Y,
H,
Mi,
params[ 1 ] );
FILE = fopen(SlogBan, io_append);
if (FILE)
{
fwrite(FILE, iString);
fclose(FILE);
}
Ban(params[0]);
return 1;
}
pawn Код:
format( gP_FILE, 256, "Administration/Users/%s.ini",// ---->> the place it should be :
pawn Код:
public OnPlayerConnect( playerid )
{
pawn Код:
new UID = BUD::GetNameUID( PlayerName2( playerid ) );
if ( UID != BUD::INVALID_UID )
{
SetPVarInt( playerid, "BANNED", BUD::GetIntEntry( UID, "Banned" ) );
if ( GetPVarInt( playerid, "BANNED" ) == 1 )
{
FormMessage( playerid, COLOR_RED, "You are Perminattly Banned From This Server.Go away !!!!",0 );
FormMessageForAll( COLOR_WHITE, "[ \"%s\"] with ID [ \"%i\" ] has been kicked from the server! [Reason: Banned Account]",PlayerName2( playerid ), playerid );
SetTimerEx( "KickPlayer", 500, false, "i", playerid ); //-->> no need to tell about this . it's too easy
}
}
- Now here this funtion
pawn Код:
SetPVarInt( playerid, "BANNED", BUD::GetIntEntry( UID, "Banned" ) );
if ( GetPVarInt( playerid, "BANNED" ) == 1 )
pawn Код:
CMD:ban(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
if ( sscanf( params, "us", params[ 0 ] ,params[ 1 ]) )return SendUsage( playerid, "/ban <id> [reason]" );
if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!");
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!"); //---- this will get the %s player account information and if he is amdin so the system will let him to use if not then cant use :
if( params[ 0 ] == playerid )return SendError( playerid, "You can't ban yourself!");
FormMessageForAllEx(playerid,COLOR_RED, "Administrator %s has Perminatly banned %s from the server ! [Reason: %s]",PlayerName2( playerid ), PlayerName2( params[ 0 ] ), params[ 1 ]);
FormMessage( params[ 0 ], COLOR_RED, "Administrator %s banned you! [Reason: %s ]",PlayerName2( playerid ), params[ 1 ]);
FormMessage( playerid, COLOR_YELLOW, "You have banned %s from server [Reason: %s]",PlayerName2( params[ 0 ] ), params[ 1 ]);
new gP_FILE[ 256 ];
format( gP_FILE, 256, "Administration/Users/%s.ini", PlayerName2( params[ 0 ] ));
new
iUID = BUD::GetNameUID( PlayerName2( params[ 0 ] ) )
;
BUD::SetIntEntry( iUID, "Banned", 1 );
new iString[ 256 ],Y,M,D,H,Mi,File:FILE; //--- this wll save the player time/second/date/year also
getdate( Y, M, D );
gettime( H, Mi );
format( iString, 258, "===============================================\r\n\
Admin: %s\r\n\
Level: %d\r\n\
Player: %s\r\n\
Date: %d/%d/%d at %d:%d\r\n\
Reason: %s\r\n\
===============================================\r\n\r\n\r\n",
PlayerName2( playerid ),
P_DATA[ playerid ][ P_Level ],
PlayerName2( params[ 0 ] ),
D,
M,
Y,
H,
Mi,
params[ 1 ] );
FILE = fopen(SlogBan, io_append);
if (FILE)
{
fwrite(FILE, iString);
fclose(FILE);
}
Ban(params[0]);
return 1;
}
public OnPlayerConnect ( playerid )
{
new UID = BUD::GetNameUID( PlayerName2( playerid ) );
if ( UID != BUD::INVALID_UID )
{
SetPVarInt( playerid, "BANNED", BUD::GetIntEntry( UID, "Banned" ) );
if ( GetPVarInt( playerid, "BANNED" ) == 1 )
{
FormMessage( playerid, COLOR_RED, "You are Perminatly Banned From This Server.Go away !!!!",0 );
FormMessageForAll( COLOR_WHITE, "[ \"%s\"] with ID [ \"%i\" ] has been kicked from the server! [Reason: Banned Account]",PlayerName2( playerid ), playerid );
SetTimerEx( "KickPlayer", 500, false, "i", playerid );
}
}
Код:
soory i have some other importante work please accept this codes and bye .