BUD (editing variable for whole offline players)
#7

pawn Код:
// somewhere
new query[100];
format(query, sizeof(query), "SELECT * FROM `players` WHERE `Premium` > 0 AND `Online` = 0");
mysql_tquery(MySQL, query,  "OnPremiumDepleteResponse", "");
then...

pawn Код:
public OnPremiumDepleteResponse()
{
    new numrows = cache_get_row_count();
    if(numrows)
    {
            new tmpstring[5], intval, userid;
       
        new rows, field, idx;
        cache_get_data(rows, field);
       
        while(idx >= rows)
        {
            cache_get_field_content(idx, "UserID", tmpstring, sizeof(tmpstring)), userid = strval(tmpstring));
           
                cache_get_field_content(idx, "VIPExpire", tmpstring, sizeof(tmpstring));
                intval = strval(tmpstring);
           
                intval--;
           
                new query[125];
            format(query, sizeof(query), "UPDATE `players` SET `Expire` = '%d' WHERE `UserID` = '%d'", intval, userid);
                mysql_tquery(MySQL, query,  "", "");
           
            idx++;
        }
    }
    return 1;
}
Untested however it should work fine.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)