how to make ban,and unban cmd for offline player,and how to make /fakeban cmd -
PowerF - 26.12.2014
my ban code
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;
}
how do i make ban cmd for offline player and unban cmd for offline player and how to make /fakeban cmd?
Re: how to make ban,and unban cmd for offline player,and how to make /fakeban cmd -
jackx3rx - 26.12.2014
Fakeban is exactly the same as ban, except it doesn't actually ban them.
So just copy and paste the ban command but remove the function which actually bans them.
Re: how to make ban,and unban cmd for offline player,and how to make /fakeban cmd -
MrCallum - 26.12.2014
Code:
CMD:fakeban
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "You are not authorised to use this command");
{
format(string, sizeof(string), "%s has been banned by %s, reason: %s.", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_RED, string);
}
return 1;
}
}
}
Code:
GetPlayerNameEx(playerid) {
new
sz_playerName[MAX_PLAYER_NAME],
i_pos;
GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
while ((i_pos = strfind(sz_playerName, "_", false, i_pos)) != -1) sz_playerName[i_pos] = ' ';
return sz_playerName;
}
If it does not work PM me then I'll actually do it correctly, I just did it in the small reply box!
Re: how to make ban,and unban cmd for offline player,and how to make /fakeban cmd -
setes7 - 11.01.2015
For fakeban you should add a sendclientmessage which says "Server closed the connection"