26.12.2014, 16:06
my ban code
how do i make ban cmd for offline player and unban cmd for offline player and how to make /fakeban cmd?
Code:
CMD:ban(playerid, params[]) { if (P_DATA[ playerid ][ P_Level ] < 1)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!"); if( params[ 0 ] == playerid )return SendError( playerid, "You can't ban yourself!"); FormMessageForAllEx(playerid,COLOR_GREEN, "Administrator %s 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( params[ 0 ], COLOR_GREY, "Make Ban Appeal at savserver.esy.es",PlayerName2( playerid ), params[ 1 ]); FormMessage( playerid, COLOR_GREEN, "You have banned %s [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; 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; }