Unban help
#1

Hello everybody.Today I try to make my own unban but code get bugged anyone can helps me..
pawn Код:
CMD:unban(playerid,params[])
{
    if(pInfo[playerid][pAdmin] < 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,""embed_red"[ERROR] "embed_white"You are not authorized to use this command!");
    new id,Query[250];
    if(sscanf(params,"u",id)) return SendUsage(playerid,"/unban [Player ID / Player Name]","0");

    format(Query,sizeof(Query),"SELECT * FROM `sampbans` WHERE `banusername` = '%s'",pName[id]);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() == 1)
    {
        SendClientMessageEx(playerid,0xFFFFFFF,""embed_orange"[Unban] "embed_white"%s has been unbanned!",pName[id]);
        format(Query,sizeof(Query),"DELETE * FROM `sampbans` WHERE `banusername` = '%s'",pName[id]);
        mysql_query(Query);
        mysql_store_result();
    }
    else if(!mysql_num_rows())
    {
        SendClientMessageEx(playerid,0xFFFFFFF,""embed_orange"[Unban] "embed_white"%s is not in database!",pName[id]);
        mysql_free_result();
    }
    return 1;
}
Problem is when I type /unban Wispo which name is in database it`s says me Unkown Command but when I type /unban Sanady it`s says Sanady is not in database...Anyone can helps me please!?

-Thanks Sanady
Reply
#2

Anyone can help me?
Reply
#3

Sorry for double post but can anyone help me I need help here...
Reply
#4

Here is new update of code but same problem anyone helps me?

pawn Код:
CMD:unban(playerid,params[])
{
    if(pInfo[playerid][pAdmin] < 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,""embed_red"[ERROR] "embed_white"You are not authorized to use this command!");
    new id,Query[250];
    if(sscanf(params,"u",id)) return SendUsage(playerid,"/unban [Player ID / Player Name]","0");

    format(Query,sizeof(Query),"SELECT * FROM `sampbans` WHERE `banusername` = '%s'",pName[id]);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() == 1)
    {
        SendClientMessageEx(playerid,0xFFFFFFF,""embed_orange"[Unban] "embed_white"%s has been unbanned!",pName[id]);
        format(Query,sizeof(Query),"DELETE * FROM `sampbans` WHERE `banusername` = '%s'",pName[id]);
        mysql_query(Query);
    }
    else if(!mysql_num_rows())
    {
        SendClientMessageEx(playerid,0xFFFFFFF,""embed_orange"[Unban] "embed_white"%s is not in database!",pName[id]);
    }
    mysql_free_result();
    return 1;
}
Reply
#5

[In a native language he can understand]
Zaљto i dalje traћiљ pozornost, kada sam ti već objasnio kako to napraviti, i zaљto ne napiљeљ rijeљeno na one probleme koji su rijeљeni?
Now for those who don't understand Balcan languages...
The correct code is:
pawn Код:
CMD:unban(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, ""embed_red"[ERROR] "embed_white"You are not authorized to use this command!");
   
    new id,Query[250];
    if (sscanf(params, "u", id)) return SendUsage(playerid, "/unban [Player ID / Player Name]", "0");
   
    format(Query, 250, "SELECT * FROM `sampbans` WHERE `banusername`='%s'", pName[id]);
    mysql_query(Query);
    mysql_store_result();
   
    new rows = mysql_num_rows();
    mysql_free_result();
   
    if (rows != 0)
    {
        SendClientMessageEx(playerid, 0xFFFFFFF, ""embed_orange"[Unban] "embed_white"%s has been unbanned!", pName[id]);
       
        format(Query, 250, "DELETE * FROM `sampbans` WHERE `banusername`='%s'", pName[id]);
        mysql_query(Query);
    }
    else
    {
        SendClientMessageEx(playerid, 0xFFFFFFF, ""embed_orange"[Unban] "embed_white"%s is not in database!", pName[id]);
    }
    return 1;
}
Now, also check if your query gets executed or if there is an error. Check your mysql logs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)