mysql_tquery - No callback specified, skipping result saving
#3

This is an example of threaded (non-lagging) way:

pawn Код:
forward LoadUserData(playerid, dbid);
public LoadUserData(playerid, dbid){
    //this stock takes the ID passed to it and queries the user table
    //it then stores info in the player enum
    new query[128], rows, fields;
    mysql_format(mysql, query, sizeof(query), "SELECT * FROM `user` WHERE `id` = %i LIMIT 1;", dbid);
    mysql_tquery(mysql, query, "OnUserDataLoaded", "d", playerid);
}

forward OnUserDataLoaded(playerid);
public OnUserDataLoaded(playerid) {
    if(!cache_get_row_count(mysql)) {
        SendClientMessage(playerid, COLOR_RED, "--------------------------------------------------------");
        SendClientMessage(playerid, COLOR_RED, "An error occurred loading user information. Please try again.");
        SendClientMessage(playerid, COLOR_RED, "If the problem persists, contact system administrators.");

        SetTimerEx("DelayedKick", 1000, false, "i", playerid);
       
        return false;
    }
   
    User[playerid][id] = cache_get_field_content_int(0, "id");  //user id
    cache_get_field_content(0, "username", User[playerid][username], mysql, 24);    //username
    User[playerid][id] = cache_get_field_content_int(0, "level");  //level
    User[playerid][pass] = 0; //password..never going to need this really so overwritten
    cache_get_field_content(0, "timestamp", User[playerid][timestamp], mysql, 10);    //timestamp
    GetPlayerIp(playerid, User[playerid][ip_address], 16);  //set ip address
   
    return true;
}
Reply


Messages In This Thread
mysql_tquery - No callback specified, skipping result saving - by Jonesy96 - 01.06.2016, 17:45
Re: mysql_tquery - No callback specified, skipping result saving - by Konstantinos - 01.06.2016, 17:54
Re: mysql_tquery - No callback specified, skipping result saving - by Misiur - 01.06.2016, 17:57
Re: mysql_tquery - No callback specified, skipping result saving - by Jonesy96 - 01.06.2016, 18:45

Forum Jump:


Users browsing this thread: 1 Guest(s)