19.05.2018, 11:18
I get this warning and then the server crashes. the offline ban command crashes the server.
PHP код:
CMD:oban(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return 0;
{
new otherplayer, filestring[79], string[128], reason[128];
if(sscanf(params, "ss", otherplayer, reason)) return SendClientMessage(playerid, COLOR_GRAY,"Usage: /oban [playername] [reason]");
if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_ERROR, "Error: You cannot offline ban yourself.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[otherplayer][pAdmin] && PlayerInfo[playerid][pAdmin] != 6) return SendClientMessage(playerid, COLOR_ERROR, "Error: You cannot offline ban this player.");
format(filestring, sizeof(filestring), "/Users/%s.ini", otherplayer);
if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_ERROR, "Error: Account does not exist.");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File,"User Files");
INI_WriteInt(File, "Banned", 1);
INI_WriteString(File, "BannedReason", reason);
INI_WriteString(File, "BannedBy", GetName(playerid));
INI_Close(File);
format(string, sizeof(string), "Admin Log: %s has offline banned player %s.", GetName(playerid), otherplayer);
Admin(COLOR_ADMIN_LOG,string, 1);
SendDC(AUSERLOG, string);
SaveToFile("AdminLogs",string);
}
}
return 1;
}