pawn Код:
CMD:oban(playerid, params[])
{
new name[25], reason[50];
if(!Logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "You need to be logged in, to use this command");
if(IsSpawn[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You need to be spawned, to use this command");
if(sscanf(params, "s[25]s[50]", name, reason)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: /oban [Name] [Reason]");
if(PlayerInfo[playerid][pAdminLevel] >= 5)
{
new query[128], string[128], time[10], date[10], h, m, s, y, mon, day;
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET Banned='1', Reason='%s', BannedBy='%s', WHERE Username = '%e'", reason, PlayerName(playerid), name);
mysql_tquery(mysql, query, "", "");
gettime(h, m, s);
getdate(y, mon, day);
format(time, sizeof(time), "%d:%d:%d", h, m, s);
format(date, sizeof(date), "%d/%d/%d", day, mon, y);
mysql_format(mysql, query, sizeof(query), "INSERT INTO `baninfo` (user_banned, user_banner, reason, ban_date, ban_time) VALUES ('%e', '%e', '%e', '%s', '%s')", name, PlayerName(playerid), reason, date, time);
mysql_tquery(mysql, query, "", "");
format(string, sizeof(string), "%s %s has offline banned %s [Reason: %s]",AdminLevelName(playerid),PlayerName(playerid),name,reason);
SendClientMessageToAll(COLOR_BLUE,string);
}
else SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
return 1;
}