15.07.2015, 22:28
how can i ban a offline user?
CMD:oban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128], playername[MAX_PLAYER_NAME], reason[64];
if(sscanf(params, "s[MAX_PLAYER_NAME]s[64]", playername, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /oban [playername] [reason]");
new giveplayerid = ReturnUser(playername);
if(IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid, COLOR_GRAD2, "That player is online, use /ban for online players.");
}
else if(doesAccountExist(playername))
{
OnPlayerOfflineLogin(playername);
if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "That player is already permabanned!");
return 1;
}
if(PlayerInfo[MAX_PLAYERS][pAdmin] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't ban admin accounts!");
return 1;
}
else
{
if(PlayerInfo[MAX_PLAYERS][pBanned] >= 0)
{
PlayerInfo[MAX_PLAYERS][pBanned] = 1;
AddBan(PlayerInfo[MAX_PLAYERS][pIP]);
OnPlayerOfflineSave(playername);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline banned by %s, reason: %s", playername, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), reason);
Log("logs/ban.log", string);
format(string, 128, "AdmCmd: %s (IP:%s) was offline banned by %s, reason: %s", playername, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), reason);
ABroadCast(COLOR_LIGHTRED,string,2);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "That player is already banned!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist.");
}
return 1;
}
/rcon login (pass) /rcon ipban (IP) |