24.09.2016, 11:00
Thank you that all works awesome! However now my ban command isn't working. It bans the player but it doesn't save in the database.
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;
}