Unban command
#1

Can someone explain me why this unban command doesn't work properly?

pawn Код:
CMD:unban(playerid,params[])
{
    if(Logged[playerid] == 1)
    {
        if(PlayerInfo[playerid][Admin] >= 4)
        {
            new Query[200];
            new Queryy[200];
            new playertounban[24];
            if(sscanf(params,"s[24]",playertounban)) return SendClientMessage(playerid,-1,"{F70505}Usage: {FFFFFF}/unban <playername>");
            format(Query, sizeof(Query), "SELECT `Username` FROM `Bans` WHERE Username = '%s' AND Banned = 1 LIMIT 1", playertounban);
            mysql_function_query(mysqlc, Query, false, "", "");
            mysql_store_result();
            if(!mysql_num_rows())
            {
                new string[200];
                format(string, sizeof(string), "Account %s not found or already unbanned.", playertounban);
                mysql_free_result();
                return SendClientMessage(playerid,red,string);
            }
            else if(mysql_num_rows() != 0)
            {
                new pName[24];
                GetPlayerName(playerid,pName,128);
                format(Query, sizeof(Query), "UPDATE `Bans` SET `Banned` = 0 WHERE Username = '%s'", playertounban);
                mysql_function_query(mysqlc, Query, false, "", "");
                mysql_store_result();
               
                format(Queryy, sizeof(Queryy), "UPDATE `playerdata` SET `Banned` = 0 WHERE user = '%s'", playertounban);
                mysql_function_query(mysqlc, Queryy, false, "", "");
               

                new string[200];
                format(string, sizeof(string), "%s has been unbanned by %s (lvl %d) %s (%d)", playertounban, AdminLevelToName(playerid),PlayerInfo[playerid][Admin], pName, playerid);
                SendClientMessageToAll(0x66FF33, string);
                new echos[200];
                format(echos,sizeof(echos),"1,8%s has been unbanned by %s (lvl %d) %s (%d)",playertounban, AdminLevelToName(playerid),PlayerInfo[playerid][Admin], pName, playerid);
                IRC_GroupSay(gGroupID, IRC_ACHANNEL, echos);

            }
        }
    }
    return 1;
}
In basic, i have to set to "0" two different tables from two different fields.

The first, from "Bans" table that i need to set "Banned" to 0, and the second, from "playerdata" table.

Both doesn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)