MySQL Threaded R7 - Small Help.
#8

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Thanks for all of you giving some advice. I've changed a bit of AndreT's code a little bit and added a field on. Would this work?

Also that query does work with the selecting the date as it tells me if the Date they will be unbanned has passed or not returning 1 for passed or 0 for not passed.

http://pastie.org/private/tzztcvzdyjg27smiyjuvw
Sorry I didn't read it all but I noticed one thing immediatly:

pawn Код:
mysql_function_query(MySQLConnection, MySQL, true, "CheckBanned", "is", playerid, plrIP);
That's wrong. Because you say that the function to call is "CheckBanned" but it's not. The function is actually called:

pawn Код:
public OnBanQueryFinish(playerid, ip[])
So, it should be:

pawn Код:
mysql_function_query(MySQLConnection, MySQL, true, "OnBanQueryFinish", "is", playerid, plrIP);
EDIT: Okay I actually just read the function and it's one big mess.

pawn Код:
forward OnBanQueryFinish(playerid, ip[]);
public OnBanQueryFinish(playerid, ip[])
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        new data[12], data2[1];
        cache_get_row(0, 0, data); // Your only selecting date, so how come you actually
        cache_get_row(1, 0, data2); // get two rows of data? Sorry maybe I am just wrong but shouldnt
        new expire = strval(data); // you only have one result? You expect a date to return
        new expirer = strval(data2);
        printf("Extracted unban time %d from string '%s'", expire, data);

        if(expirer == 1)
    {
        printf("Player is NOT Banned - Query Complete"); // Why is the player not banned if you get a 2nd result?
      mysql_format(MySQLConnection, MySQL, "DELETE FROM bans WHERE Name = '%s' LIMIT 1", ip);
      mysql_function_query(MySQLConnection, MySQL, false, "ReturnNull", "i", INVALID_PLAYER_ID); // You don't need to use "ReturnNull", you can simply use ""
        }
        else if(expirer == 0)
    {
        printf("Player is Banned - Query Complete");
            SendFormatMessage(playerid, COLOR_DEFAULT, "You are banned from this server untill %s", dater(expirer, 3));
            Kick(playerid);
            DontShow[playerid] = 1;
            return 1;
        }
    }
    return 1;
}
Man I am scratching my head here haha.
Reply


Messages In This Thread
MySQL Threaded R7 - Small Help. - by Kyle - 11.06.2012, 06:21
AW: MySQL Threaded R7 - Small Help. - by Extremo - 11.06.2012, 06:50
Re: MySQL Threaded R7 - Small Help. - by Kyle - 11.06.2012, 10:24
Re: MySQL Threaded R7 - Small Help. - by Vince - 11.06.2012, 10:27
Re: MySQL Threaded R7 - Small Help. - by Kar - 11.06.2012, 10:31
AW: Re: MySQL Threaded R7 - Small Help. - by Extremo - 11.06.2012, 11:22
Re: MySQL Threaded R7 - Small Help. - by Kyle - 11.06.2012, 11:35
AW: Re: MySQL Threaded R7 - Small Help. - by Extremo - 11.06.2012, 11:40
Re: AW: Re: MySQL Threaded R7 - Small Help. - by Kyle - 11.06.2012, 11:43

Forum Jump:


Users browsing this thread: 2 Guest(s)