How can i change this to R38
#1

Hey
This is a simple code with checks for offline player stats (R5)

pawn Код:
mysql_real_escape_string(_account, account);
    format(Query, sizeof(Query), "SELECT hours,minutes,seconds,RegDate,RegTime,LastOnlineDate,LastOnlineTime,id,Banned,BannedByAdmin,BanReason FROM `players` WHERE `user` = '%s'", account);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        while(mysql_fetch_row_format(Query, "|"))
        {
            mysql_fetch_field_row(i, "hours"); pphours = strval(i);
            mysql_fetch_field_row(i, "minutes"); ppmins = strval(i);
            mysql_fetch_field_row(i, "seconds"); ppsecs = strval(i);
            mysql_fetch_field_row(i, "RegDate"); format(regdate, sizeof(regdate), i);
            mysql_fetch_field_row(i, "RegTime"); format(regtime, sizeof(regtime), i);
            mysql_fetch_field_row(i, "LastOnlineDate"); format(laston, sizeof(laston), i);
            mysql_fetch_field_row(i, "LastOnlineTime"); format(lasttime, sizeof(lasttime), i);
            mysql_fetch_field_row(i, "id"); playeruserid = strval(i);
            mysql_fetch_field_row(i, "Banned"); playerban = strval(i);
            mysql_fetch_field_row(i, "BannedByAdmin"); format(bannedby, sizeof(bannedby), i);
            mysql_fetch_field_row(i, "BanReason"); format(bannedreason, sizeof(bannedreason), i);
        }
        //bla bla something here like sendclientmessage
    }
How do i change this to R38, could someone help me out in this.
Reply
#2

pawn Код:
new cache:result;

    mysql_escape_string(_account, account);
    format(Query, sizeof(Query), "SELECT hours,minutes,seconds,RegDate,RegTime,LastOnlineDate,LastOnlineTime,id,Banned,BannedByAdmin,BanReason FROM `players` WHERE `user` = '%s'", account);
    result = mysql_query(Query);
    if(cache_get_row_count() != 0)
    {
//use cache_get_field_content_int for integer and cache_get_field_content for strings
/*      while(mysql_fetch_row_format(Query, "|"))
        {
            mysql_fetch_field_row(i, "hours"); pphours = strval(i);
            mysql_fetch_field_row(i, "minutes"); ppmins = strval(i);
            mysql_fetch_field_row(i, "seconds"); ppsecs = strval(i);
            mysql_fetch_field_row(i, "RegDate"); format(regdate, sizeof(regdate), i);
            mysql_fetch_field_row(i, "RegTime"); format(regtime, sizeof(regtime), i);
            mysql_fetch_field_row(i, "LastOnlineDate"); format(laston, sizeof(laston), i);
            mysql_fetch_field_row(i, "LastOnlineTime"); format(lasttime, sizeof(lasttime), i);
            mysql_fetch_field_row(i, "id"); playeruserid = strval(i);
            mysql_fetch_field_row(i, "Banned"); playerban = strval(i);
            mysql_fetch_field_row(i, "BannedByAdmin"); format(bannedby, sizeof(bannedby), i);
            mysql_fetch_field_row(i, "BanReason"); format(bannedreason, sizeof(bannedreason), i);
*/

        }
    }
Reply
#3

For getting the dates it would be "cache_get_field_content_int " ?
Reply
#4

cache_get_field_content_int for integer and cache_get_field_content for strings
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)