27.03.2014, 15:02
Well, i got some problems with my Offline Ban system. However,the player is banned he can join back the server ,i've tried to find where the problem is but no results -_-
Here is the BanAccount Codes and Command
++ REP
Here is the BanAccount Codes and Command
pawn Код:
CMD:banaccount(playerid, params[])
{
if(!PlayerInfo[playerid][pAdmin]) return Error(playerid, "You are not authorized to use this command!");
new playername[24], length, reason[64];
if(sscanf(params, "s[24]is[64]", playername, length, reason)) return Syntax(playerid, "banaccount", "[playername] [length (days) 0 = perm] [reason]");
new giveplayerid = ReturnUser(playername);
new string[128];
format(STRING, "That player is currently on the server. Use /ban. (ID: %d)", giveplayerid);
if(IsPlayerConnected(giveplayerid)) return Error(playerid, string);
if(!doesAccountExist(playername)) return Error(playerid, "Could not find account specified. Check the name and try again.");
OnPlayerOfflineLogin(playername);
if(PlayerInfo[MAX_PLAYERS][pAdmin] > PlayerInfo[playerid][pAdmin]) return Error(playerid, "You cannot ban a higher level admin.");
new ip[16];
format(ip, sizeof(ip), "%s", PlayerInfo[MAX_PLAYERS][pIP]);
BanAccount(playerid, playername, length, reason, ip);
//PlayerInfo[MAX_PLAYERS][pBanned] = 1;
OnPlayerOfflineSave(playername);
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline banned for %d days by %s, reason: %s (%d-%d-%d)", playername, PlayerInfo[MAX_PLAYERS][pIP], length, GetPlayerNameEx(playerid), reason, month, day, year);
Log("logs/ban.log", string);
return 1;
}
pawn Код:
stock BanAccount(playerid, giveplayerid[24], time, reason[], ip[])
{
new name[24];
if(playerid == 501) format(name, sizeof(name), "Crowley(Anti Cheat)");
else GetPlayerName(playerid, name, sizeof(name));
new curtime = gettime();
new expire;
if(!time)
{
expire = 1577836800;
}
else
{
new Float:banminutes = time * 24 * 60 * 60;
new bantime = floatround(banminutes);
expire = curtime + bantime;
}
new q[400];
format(q, sizeof(q), "INSERT INTO bans (name, reason, ban_time, issue_time, expiry_time, admin, ip) VALUES ('%s', '%s', %d, %d, %d, '%s', '%s')", giveplayerid, reason, time, curtime, expire, name, ip);
mysql_query(q, THREAD_INSERT_BAN);
AddBan(ip);
new string[128];
if(time)
format(string,sizeof(string), "AdmCmd: %s was offline banned for %d days by %s: %s", giveplayerid, time, GetPlayerNameEx(playerid), reason);
else
format(string,sizeof(string), "AdmCmd: %s was offline banned permanently by %s: %s", giveplayerid, name, reason);
ABroadCast(COLOR_LIME, string, 2);
return 1;
}