cache_get_row storage in array...
#1

Hi. Having a problem with storing results of cache_get_row into my array. Here is what I'm doing.

Код:
enum example { logUserid, logText[8] };
new Example[MAX_PLAYERS][example];

public OnPlayerConnect(playerid) {
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    format(query, sizeof(query), "SELECT userID, bypass FROM users WHERE username = '%s'", name);
    mysql_function_query(mysql, query, true, "LoginUserCheck", "i", playerid);
}

forward LoginUserCheck(playerid);
public LoginUserCheck(playerid) {
    new rows, fields, query[128];
    cache_get_data(rows, fields);
    if(!rows) return KickPlayer(playerid, "No account. You suck, go away!");
    Example[playerid][logUserid] = cache_get_row_int(0, 0);
    cache_get_row(0, 1, Example[playerid][logBypass], mysql);
    printf("%i %s", Example[playerid][logUserid], Example[playerid][logBypass]);
    return 1;
}
The print is showing the correct user ID. If I change
Код:
cache_get_row(0, 1, Example[playerid][logBypass], mysql);
to
Код:
cache_get_row(0, 1, tmp, mysql);
and print it then it is correct.. So it has something to do with storing in my array. What gives?

Would appreciate any help. It's gotta be something dumb I'm doing. Thanks guys!
Reply
#2

I found the answer in this thread. https://sampforum.blast.hk/showthread.php?tid=419858
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)