CMD:ban(playerid, params[])
{
new reason[200], Reason[200], targetid, Days, Query[450], String[200];
if(PlayerInfo[playerid][Admin] >= 2)
{
if(sscanf(params, "uiS[200]", targetid, Days, reason)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/ban (playerid) (days) (reason - optional)");
{
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player offline/invalid.");
{
if(strlen(reason) > 200) return SendClientMessage(playerid, COLOR_RED, "Type a 'ban reason' within 200 characters.");
{
PlayerInfo[targetid][Banned] = 1;
new aName[24];
GetPlayerName(playerid,aName,24);
new pName[24];
GetPlayerName(targetid,pName,24);
new CTS = (gettime() + (86400*Days));
mysql_real_escape_string(reason, Reason);
new IP[16];
GetPlayerIp(targetid, IP, sizeof(IP));
format(Query, sizeof(Query), "INSERT INTO `Bans` (Username, Admin, IP, Reason, Days, Banned, Time) VALUES ('%s', '%s', '%s', '%s', '%d', 1, '%s')", pName, aName, IP, Reason, (CTS+gettime()), InsertTimeStamp());
mysql_function_query(mysqlc, Query, false, "", "");
format(String, sizeof(String), "[BAN] ** %s (%d) has been banned by %s (%d): %s.", pName, targetid, aName, playerid, Reason);
SendClientMessageToAll(pink, String);
new echo[200];
format(echo, sizeof(echo), "0,4[BAN] ** %s (%d) has been banned by %s (%d): %s.",pName, targetid, aName, playerid, Reason);
IRC_GroupSay(gGroupID, IRC_CHANNEL, echo);
PlayerInfo[playerid][PlayersBanned] ++;
new stats[128];
format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAdminBans = TotalAdminBans + 1");
mysql_function_query(mysqlc, stats, false, "", "");
SetPlayerPos(targetid,193.5177,176.2223,1003.0234);
SetPlayerInterior(targetid,3);
//Ban Message
new metin[128];
format(metin, sizeof(metin), "* {FF0000}You have been banned from the server *");
SCM(targetid, -1, metin);
format(metin, sizeof(metin), "* Admin: {FF0000}%s (%d)", aName, playerid);
SCM(targetid, -1, metin);
format(metin, sizeof(metin), "* Date and Time: {FF0000}%s",InsertTimeStamp());
SCM(targetid, -1, metin);
format(metin, sizeof(metin), "* Reason: {FF0000}%s", Reason);
SCM(targetid, -1, metin);
format(metin, sizeof(metin), "* Duration of ban: {FF0000}%s Days", (CTS+gettime()));
SCM(targetid, -1, metin);
format(metin, sizeof(metin), "* If you have been banned wrongfully, visit our forums http://www.bwhsamp.com and appeal at this ban");
SCM(targetid, -1, metin);
SCM(targetid,0xFF0000FF, "* You can screen this ban message (F8) and post it on forum. *");
BanTimer[targetid] = SetTimerEx("BanPlayer",200,false,"d",targetid);
//
}
}
}
}
return 1;
}
format(metin, sizeof(metin), "* Duration of ban: {FF0000}%s Days", (CTS+gettime()));
format(metin, sizeof(metin), "* Duration of ban: {FF0000}%i Days", Days);
format(Query, sizeof(Query), "INSERT INTO `Bans` (Username, Admin, IP, Reason, Days, Banned, Time) VALUES ('%s', '%s', '%s', '%s', '%d', 1, '%s')", pName, aName, IP, Reason, (CTS+gettime()), InsertTimeStamp());
mysql_function_query(mysqlc, Query, false, "", "");
print(Query);
[13:03:05] [DEBUG] mysql_escape_string - source: "boobs", connection: 1, max_len: 200 [13:03:05] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `Bans` (Username, Admin, IP, Reason, Days, Banned, T", callback: "(null)", format: "(null)" [13:03:05] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [13:03:05] [DEBUG] mysql_tquery - scheduling query "INSERT INTO `Bans` (Username, Admin, IP, Reason, Days, Banned, Time) VALUES ('Face9000', 'Face9000', '192.168.1.2', 'boobs', '-1511331726', 1, '5/2/2014 13:3:5')".. |
[13:03:05] sscanf warning: No default value found. [13:03:06] [part] Face9000 has left the server (0:2) |
format(Query, sizeof(Query), "INSERT INTO `Bans` (Username, Admin, IP, Reason, Days, Banned, Time) VALUES ('%s', '%s', '%s', '%s', '%d', 1, '%s')", pName, aName, IP, Reason, CTS, InsertTimeStamp());
mysql_function_query(mysqlc, Query, false, "", "");