Data from MySQL Database not doing it's job
#2

You seem to misunderstand what data is returned and what the concept of the RestoreData(playerid) callback is. There's no reason for you to declare arrays like this:
pawn Код:
new tempX[MAX_PLAYERS];
This does not only unnecessarily clutter up your stack when done repeatedly, but also is useless, since you do not need to handle the result player-specific here. You just need to declare an array large enough to hold a long number and the null character in case of the balance. An example of this would be:
pawn Код:
new temp[11];
// array 'temp' is empty.
cache_get_field_content(0, "Balance", temp);
// array 'temp' is a string in our way of speaking, similar to what a c string is.
// it may look like this: "1337", which would mean the player has a balance of $1337.
// The array contents are {'1', '3', '3', '7', '\0'} (characters 1,3,3,7 and a null character, remaining 6 array members remain empty).
// To get the number representative of this string, you need to run strval:
pInfo[playerid][Money] = strval(temp);
The situation is similar with the next float. You do not need to create an array for each string, by the way! Following the code I posted, you'd need to load the x, y and z. This can be done using cache_get_field_content and floatstr.
pawn Код:
cache_get_field_content(0, "x", temp);
pInfo[playerid][x] = floatstr(temp);
Reply


Messages In This Thread
Data from MySQL Database not doing it's job - by Shoulen - 03.04.2013, 16:33
Re: Data from MySQL Database not doing it's job - by AndreT - 03.04.2013, 18:13
Re: Data from MySQL Database not doing it's job - by Shoulen - 03.04.2013, 18:35
Re: Data from MySQL Database not doing it's job - by AndreT - 03.04.2013, 19:28
Re: Data from MySQL Database not doing it's job - by Shoulen - 04.04.2013, 15:45
Re: Data from MySQL Database not doing it's job - by Scenario - 04.04.2013, 15:53

Forum Jump:


Users browsing this thread: 1 Guest(s)