OBan Aint WOrking [SQL]
#3

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
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;
}
You didn't explain the problem, this code seems to work.
Does it ban, doesn't ban at all, or the player can get in after being banned, also show to part where it bans the player if he tried to join.

Also try to take a look at mysql_log at the server folder for any errors.
Reply


Messages In This Thread
OBan Aint WOrking [SQL] - by ReD_HunTeR - 18.01.2015, 12:17
Re: OBan Aint WOrking [SQL] - by Ironboy - 18.01.2015, 12:30
Re: OBan Aint WOrking [SQL] - by xVIP3Rx - 18.01.2015, 12:39
Re: OBan Aint WOrking [SQL] - by ReD_HunTeR - 18.01.2015, 12:45
Re: OBan Aint WOrking [SQL] - by Ironboy - 18.01.2015, 12:49
Re: OBan Aint WOrking [SQL] - by Lordzy - 18.01.2015, 12:57
Re: OBan Aint WOrking [SQL] - by ReD_HunTeR - 18.01.2015, 14:32
Re: OBan Aint WOrking [SQL] - by Ironboy - 18.01.2015, 14:41
Re: OBan Aint WOrking [SQL] - by Lordzy - 18.01.2015, 14:43
Re: OBan Aint WOrking [SQL] - by ReD_HunTeR - 18.01.2015, 14:49

Forum Jump:


Users browsing this thread: 1 Guest(s)