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 .
#include <zcmd>
CMD:ban(playerid, params[]) //>>:- instante of CMD you also can use COMMAND:
{
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " not authorised!");
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
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
if (P_DATA[ playerid ][ P_Logged ] == 0)
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!");
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 has perminatly banned you! [Reason: %s ]",PlayerName2( playerid ), params[ 1 ]);
new gP_FILE[ 256 ];
format( gP_FILE, 256, "Administration/Users/%s.ini", PlayerName2( params[ 0 ] ));
format( gP_FILE, 256, "Administration/Users/%s.ini",// ---->> the place it should be :
new
iUID = BUD::GetNameUID( PlayerName2( params[ 0 ] ) )
;
BUD::SetIntEntry( iUID, "Banned", 1 ); ---> dont allowed if banned :
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;
}
format( gP_FILE, 256, "Administration/Users/%s.ini",// ---->> the place it should be :
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 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
}
}
SetPVarInt( playerid, "BANNED", BUD::GetIntEntry( UID, "Banned" ) );
if ( GetPVarInt( playerid, "BANNED" ) == 1 )
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 .
For god sake where is the gpci function? and what's the point to get something that is not yours and post here? without even creating enum's variables and such.
Horrible tutorial. |
gcpi = players serial, at his tutorial doesn't have that, as it said.
|