Account Check [Donator]
#7

Your query was wrong, and so was the way you were loading the information. mysql_fetch_row_format() would be used if you were planning to split the data with sscanf, or, as the name suggests, the "split" function.

Also, on your SendClientMessage line you listed a %s and a %d. You didn't fill in any variable to replace the %s with, so it made the time your %s and %d was nothing.

pawn Код:
stock CheckAccountDonator(playerid)
{
    new bExpiration;

    format(Query, sizeof(Query), "SELECT * FROM `Donators` WHERE Username = '%s' AND status = 1", GetPName(playerid), GetIP(playerid));
    mysql_query(Query);
   
    mysql_store_result();
    if(mysql_num_rows() >= 1)
    {
        while(mysql_fetch_row())
        {
            mysql_fetch_field_row(Query, "Expiration"); bExpiration = strval(Query);

            if(bExpiration > 0)
            {
                if(gettime() >= bExpiration)
                {
                    format(Query, sizeof(Query), "DELETE FROM `Donators` WHERE Username = %s", GetPName(playerid));
                    mysql_query(Query);
                    SendClientMessage(playerid,-1,"Your time as a Donator has run out and you've been removed from donator status");
                    pData[playerid][DonatorLevel] = 0;
                }
                else
                {
                    new string[100];
                    format(string, sizeof(string),"Welcome Back, %s you've got %d days level as a donator",(bExpiration-gettime())/2592000);
                    SendClientMessage(playerid,-1,string);
                }
            }
        }
    }
    mysql_free_result(); // you need to be calling this!
    return 0;
}
Furthermore, MiGu3X, you're wrong. %d and %i are basically the same thing.
Reply


Messages In This Thread
Account Check [Donator] - by zT KiNgKoNg - 19.05.2013, 18:25
Re: Account Check [Donator] - by zT KiNgKoNg - 20.05.2013, 11:26
Re: Account Check [Donator] - by zT KiNgKoNg - 21.05.2013, 15:05
Re: Account Check [Donator] - by zT KiNgKoNg - 23.05.2013, 13:44
Re: Account Check [Donator] - by MiGu3X - 23.05.2013, 14:37
Re: Account Check [Donator] - by SuperViper - 23.05.2013, 14:50
Re: Account Check [Donator] - by Scenario - 23.05.2013, 14:52

Forum Jump:


Users browsing this thread: 1 Guest(s)