24.09.2016, 08:06
Hey guys my ban system is crashing my server. I can ban a player fine, but anything else crashes it.
Happens with all commands
Here is my ban command that works fine.
And here is the rest of the commands that are broken
Код:
[08:47:42] [Command]: [vR]Yottabyte has used the command /banreason. [08:47:46] [debug] Server crashed while executing vR.amx [08:47:46] [debug] AMX backtrace: [08:47:46] [debug] #0 00000061 in ?? () at <unknown file>:0 [08:47:46] [debug] #1 00000061 in public cmd_banreason () at <unknown file>:0 [08:47:46] [debug] #2 native CallLocalFunction () from samp03svr [08:47:46] [debug] #3 00000a58 in public OnPlayerCommandText (playerid=0, cmdtext[]=@016e8090 "/banreason dwa") at E:\All Folders\Hobbies\Server Hosting\SA-MP\__VR\pawno\include\zcmd.inc:108
Here is my ban command that works fine.
PHP код:
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 1) return 0;
{
new ID, reason[128], str[128], plrIP[16], query[1024], bannedby[50];
if(sscanf(params, "us[100]", ID, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [PlayerID] [Reason]");
if(PlayerInfo[ID][pAdmin] >= PlayerInfo[playerid][pAdmin] && PlayerInfo[ID][pUCAdmin] == 0 && PlayerInfo[playerid][pAdmin] != 6) return SendClientFormattedMessage(playerid, COLOR_RED, "Error: Not enough privilages to ban %s.", GetName(ID), "");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_GREY, "Error: That player is not found.");
format(str, sizeof(str), "[Admin Log]: %s has been banned by Administrator %s. [Reason: %s]", GetName(ID), GetName(playerid), reason);
ABroadCast(COLOR_ADMIN, str, 1);
print(str);
GetPlayerIp(ID, plrIP, sizeof(plrIP));
SaveToFile("BanLog", str);
SendClientMessage(ID,COLOR_RED,"|___________[BAN INFO]___________|");
format(str, sizeof(str), "Your name: %s.",GetName(ID));
SendClientMessage(ID, COLOR_RED, str);
format(str, sizeof(str), "Your ip is: %s.", plrIP);
SendClientMessage(ID, COLOR_RED, str);
format(str, sizeof(str), "You were banned by: %s.",GetName(playerid));
SendClientMessage(ID, COLOR_RED, str);
format(str, sizeof(str), "You were banned for: %s. Make an ban appeal on: www.vexed-rp.com",reason);
SendClientMessage(ID, COLOR_RED, str);
SendClientMessage(ID,COLOR_RED,"|___________[BAN INFO]___________|");
SetTimerEx("UnsetBan", 500, 0, "i", ID);
bannedby = GetName(playerid);
PlayerInfo[ID][pBanned] = 1;
PlayerInfo[ID][pReason] = reason;
PlayerInfo[ID][pBannedBy] = bannedby;
mysql_format(ServerMySQL, query, sizeof(query), "UPDATE `Users` SET pBanned = %d, pBannedBy = '%s', pReason = '%s', WHERE Name='%s'",1,GetName(playerid),reason, GetName(ID));
mysql_tquery(ServerMySQL, query, "", "");
}
return 1;
}
PHP код:
CMD:oban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return 0;
{
new ID, name[128], query[250], reason[128], string[128];
if(sscanf(params, "s[24]s[24]", name, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /offlineban [Player Name] [Reason]");
mysql_format(ServerMySQL, query, sizeof(query), "UPDATE `Users` SET pBanned = %d, pBannedBy = '%s', pReason = '%s' WHERE Name='%s'", 1, GetName(playerid), reason, name);
mysql_tquery(ServerMySQL, query, "", "");
if (!cache_affected_rows(ServerMySQL)) return SendClientMessage(playerid, COLOR_RED, "Error: That player doesn't exist");
format(string,sizeof(string), "*You have successfully banned player %s.", name);
SendClientMessage(playerid, COLOR_ADMIN, string);
format(amsg, sizeof(amsg), "[Admin Log]: %s has offline banned player %s [Reason: %s]", GetName(playerid), name, reason);
ABroadCast(COLOR_ADMIN,amsg, 1);
if(IsPlayerConnected(ID))
{
SetTimerEx("UnsetBan", 500, 0, "i", ID);
}
}
return 1;
}
CMD:unban(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] <= 3) return 0;
new name, query[300], cmdstring[44], string[128];
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_WHITE,"Usage: /unban [Player Name]");
mysql_format(ServerMySQL, query, sizeof(query), "UPDATE `Users` SET pBanned = %d, pBannedBy = '%s', pReason = '%s' WHERE Name='%s'", 1, GetName(playerid), "", GetName(name));
mysql_tquery(ServerMySQL, query, "", "");
if(!cache_affected_rows(ServerMySQL)) return SendClientMessage(playerid, COLOR_RED, "Error: That player doesn't exist");
format(cmdstring, sizeof(cmdstring), "unbanip %s", PlayerInfo[name][pIP]);
SendRconCommand(cmdstring);
SendRconCommand("reloadbans");
format(string,sizeof(string), "*You have successfully unbanned %s.", name);
SendClientMessage(playerid, COLOR_ADMIN, string);
format(amsg, sizeof(amsg), "[Admin Log]: %s has unbanned player %s", GetName(playerid), name);
ABroadCast(COLOR_ADMIN,amsg, 1);
//UnBlockIpAddress( ip_address );
return 1;
}
CMD:banreason(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 3) return 0;
new name, query[128], string[128], reason[128];
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /banreason [Player Name]");
format(query, sizeof(query), "SELECT `pReason` FROM `Users` WHERE `Name` = '%s'", GetName(name));
mysql_query(ServerMySQL, query);
if(cache_num_rows())
{
cache_get_field_content(0, "pReason", reason);
if(!strcmp(reason, "", false, 1))
{
format(string,sizeof(string), "[BAN REASON]: %s was banned for: %s",GetName(name), reason);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(amsg,sizeof(amsg), "[Admin Log]: %s is requesting ban information on %s", GetName(playerid), GetName(name));
}
else
{
SendClientMessage(playerid, COLOR_RED, "Error: That player isn't banned.");
}
}
return 1;
}