03.04.2013, 16:33
Hi!
I've got this very strange problem, so I run a query that gets a row of user data (limited to 1 row in the query) and I then use the data from that to assign variables to the active logged in user. However, when I set the player variables (which I've setup using an Enumerator) it doesn't seem to read it, I'm not sure what I'm doing wrong, I'm new to this MySQL Plugin (The new gStylez script, or whatever his new name is).
Here is my query:
Here is my RestoreData callback.
Yet the variables are not taking an effect, even when I print them they come out as 0, I thought it might have something to do with the fact that they're all integers and cache_get_field_content is for strings but I'm not sure whether or not that would have an effect on it.
If you have any idea please let me know.
Thank you so much.
Kind Regards
Shoulen
I've got this very strange problem, so I run a query that gets a row of user data (limited to 1 row in the query) and I then use the data from that to assign variables to the active logged in user. However, when I set the player variables (which I've setup using an Enumerator) it doesn't seem to read it, I'm not sure what I'm doing wrong, I'm new to this MySQL Plugin (The new gStylez script, or whatever his new name is).
Here is my query:
pawn Код:
format(string, sizeof(string), "SELECT * FROM `playerinfo` WHERE `userName` LIKE '%s' LIMIT 1", pname);
mysql_function_query(connectionHandler, string, true, "RestoreData", "i", playerid);
pawn Код:
forward RestoreData(playerid);
public RestoreData(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(!rows)
{
SendClientMessage(playerid, COLOR_FAIL, "Unknown Error Occured!");
} else {
new tempX[MAX_PLAYERS], tempY[MAX_PLAYERS], tempZ[MAX_PLAYERS], tempBalance[MAX_PLAYERS], tempSkin[MAX_PLAYERS];
cache_get_field_content(0, "Balance", tempBalance[playerid]);
cache_get_field_content(0, "x", tempX[playerid]);
cache_get_field_content(0, "y", tempY[playerid]);
cache_get_field_content(0, "z", tempZ[playerid]);
cache_get_field_content(0, "skin", tempSkin[playerid]);
pInfo[playerid][x] = floatstr(tempX);
pInfo[playerid][y] = floatstr(tempX);
pInfo[playerid][z] = floatstr(tempX);
pInfo[playerid][Money] = strval(tempBalance[playerid]);
pInfo[playerid][Skin] = strval(tempSkin[playerid]);
SetSpawnInfo(playerid, 0, pInfo[playerid][Skin], pInfo[playerid][x], pInfo[playerid][y], pInfo[playerid][z], 1, 0, 0, 0, 0, 0, 0);
pLogged[playerid] = 1;
SpawnPlayer(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pInfo[playerid][Money]);
}
}
If you have any idea please let me know.
Thank you so much.
Kind Regards
Shoulen