SA-MP Forums Archive
mysql unban command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mysql unban command (/showthread.php?tid=514279)



mysql unban command - Copfan5 - 20.05.2014

I am not asking for a script. All I need is to know how I check if an account is in the database as mysql_num_rows was removed. I also do NOT want to go to an old version of the mysql plugin.


Re: mysql unban command - guitardude01 - 20.05.2014

I have this same issue! And also wondering how to get this working.


Re: mysql unban command - awsomedude - 20.05.2014

pawn Код:
new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        //Banned
    }
    else
    {
        //Not Banned
    }



Re: mysql unban command - DobbysGamertag - 21.05.2014

Quote:
Originally Posted by awsomedude
Посмотреть сообщение
pawn Код:
//code...
Why use that method when using:

pawn Код:
cache_num_rows();
is the same?

How are you un-banning? using DELETE or UPDATE?


Re: mysql unban command - Copfan5 - 21.05.2014

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Why use that method when using:

pawn Код:
cache_num_rows();
is the same?

How are you un-banning? using DELETE or UPDATE?
I am using update as of now. If needed I can make a new table for the bans in order to delete. Which option is better? Thanks!


Re: mysql unban command - Copfan5 - 21.05.2014

Still does not work! Any help would be greatly appreciated.


Re: mysql unban command - Copfan5 - 23.05.2014

Bump!


Re: mysql unban command - SilentSoul - 23.05.2014

You should use cache_num_rows() as DobbysGamertag said.
pawn Код:
new query[126];
format(query, sizeof(query), "SELECT * FROM bantable WHERE BannedName = '%s' AND status = 1", GetPlayerNameEx(playerid));//Firstly we should select everything from your ban table however you named it.
mysql_tquery(mysql, query,"BanResults","i",playerid); //now we added a call back to check if this name is banned or not,


forward BanResults(playerid);
public BanResults(playerid)
{
    if(cache_num_rows(mysql) >=1)
    {
        //if this name was found.
    }
    else
    {
    //cannot find
    }
    return 1;
}
EDIT: This is a fast example taken from my gamemode, don't copy and paste you should modify it first!