cache_get_row storage in array... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: cache_get_row storage in array... (
/showthread.php?tid=450378)
cache_get_row storage in array... -
TheStreetsRP - 12.07.2013
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!
Re: cache_get_row storage in array... -
TheStreetsRP - 12.07.2013
I found the answer in this thread.
https://sampforum.blast.hk/showthread.php?tid=419858