07.04.2013, 09:56
For whatever reason, this just doesn't work, it doesn't send any of the messages, nor updates the SQL database.
The only thing that works is kicking and logging.
Thanks.
pawn Код:
BanPlayer(playerid, reason[], adminid)
{
new String[500], PlayerName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME], IP[32], Date[3], Time[3];
getdate(Date[0], Date[1], Date[2]);
gettime(Time[0], Time[1], Time[2]);
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
GetPlayerIp(playerid, IP, 32);
GetPlayerName(adminid, AdminName, MAX_PLAYER_NAME);
if(adminid == -1) { AdminName = "Server"; }
format(String, sizeof(String), "AdmCmd: %s Has been banned by %s. Reason: %s", PlayerName, AdminName, reason);
SendClientMessageToAll(COLOR_RED, String);
SendClientMessage(playerid, COLOR_AAC, "You have been banned from the server.");
SendClientMessage(playerid, COLOR_RED, "If you feel this ban is unfair, please Screen Shot the below information.");
format(String, sizeof(String), "BanInfo: Date: %d:%d:%d || Time: %d:%d || Admin Name: %s || Reason: %s", Date[0], Date[1], Date[2], Time[0], Time[1], AdminName, reason);
SendClientMessage(playerid, COLOR_RED, String);
format(String, sizeof(String), "BanInfo: IP: %s || Player Name : %s || Admin Name: %s || Reason: %s", IP, PlayerName, AdminName, reason);
Log("Logs/BanInfo.log", String);
format(String, sizeof(String), "INSERT INTO `BanInfo`(Username, IPAddress, Reason, AdminName) VALUES (%s, %s, %s, %s)", DB_Escape(PlayerName), IP, reason, DB_Escape(AdminName));
db_query(Database, String);
Kick(playerid);
}
Thanks.