unban command not functioning properly(SQLite)
#3

pawn Код:
CMD:unban(playerid, params[])
{
    if(dAdmin[playerid][USER_ADMIN] != 3) return 0;

    if(isnull(params)) SendClientMessage(playerid, -1, "[USAGE]/unban (name)");
    else if(!(3 <= strlen(params) < MAX_PLAYER_NAME)) SendClientMessage(playerid, -1, "Player name must be between 3-24 characters");
    else
    {
        new name[MAX_PLAYER_NAME], string[128], DBResult:Result;
        format(string, sizeof(string), "SELECT banned FROM users WHERE username = '%e'",name); // %e is for samp 0.3.7
        Result = db_query(Database, string);
        new rows = db_num_rows(Result);
        db_free_result(Result);
        if(rows)
        {
            format(string, sizeof(string), "UPDATE users SET banned = 0 WHERE username = '%e'", name);
            db_free_result(db_query(Database, string));

            format(string, sizeof(string), "Player %s's ban was set to 0.", name);
            print(string);
        }
    }
    return 1;
}
Reply


Messages In This Thread
unban command not functioning properly(SQLite) - by DarkLored - 27.08.2015, 21:57
Re: unban command not functioning properly(SQLite) - by CadSives - 27.08.2015, 22:07
Re: unban command not functioning properly(SQLite) - by Jefff - 27.08.2015, 22:16
Re: unban command not functioning properly(SQLite) - by DarkLored - 28.08.2015, 01:05

Forum Jump:


Users browsing this thread: 1 Guest(s)