09.06.2014, 20:34
Hi, so my MySQL server is reading from the Database just fine (SELECT * FROM and stuff are working just fine). But my problem is that when I try to load something and store it into a variable, it doesn't load.
Load the info from the Database
What runs before the loading
What runs the above
The error I am getting.
Image of my database where it is loading from.
Load the info from the Database
pawn Код:
forward LoadAccount(playerid);
public LoadAccount(playerid)
{
cache_get_row(0, 2, PlayerInfo[playerid][Password]);
cache_get_row(0, 3, PlayerInfo[playerid][pIp]);
PlayerInfo[playerid][pAge] = cache_get_row_int(0, 4);
cache_get_row(0, 5, PlayerInfo[playerid][pSex]);
cache_get_row(0, 6, PlayerInfo[playerid][pRace]);
PlayerInfo[playerid][pSkin] = cache_get_row_int(0, 7);
PlayerInfo[playerid][posx] = cache_get_row_float(0, 8);
PlayerInfo[playerid][posy] = cache_get_row_float(0, 9);
PlayerInfo[playerid][posz] = cache_get_row_float(0, 10);
return 1;
}
pawn Код:
forward LoginPlayer(playerid);
public LoginPlayer(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
//SCM(playerid, COLOR_RED, "Ran - Loginplayer");
TextDrawHideForPlayer(playerid, LoginRegister1);
TextDrawHideForPlayer(playerid, LoginRegister2);
TextDrawHideForPlayer(playerid, LoginRegister3);
TextDrawHideForPlayer(playerid, LoginRegister4);
TextDrawHideForPlayer(playerid, LoginRegister5);
TextDrawHideForPlayer(playerid, LoginRegister6);
TextDrawHideForPlayer(playerid, LoginRegister7);
TextDrawHideForPlayer(playerid, LoginRegister8);
format(msg, sizeof(msg), "~w~Welcome ~n~~y~ %s", GetNameEx(playerid));
GameTextForPlayer(playerid, msg, 5000, 1);
LoadAccount(playerid);
SpawnPlayer(playerid);
}
else
{
ShowDialog(playerid, Show:<Login>,DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay", "{FFFFFF}Welcome to {08088A}Eastside Gaming Roleplay. {FFFFFF}We {04B404}did {FFFFFF}find youe account in our database.\nPlease enter the password you have associated with this account.\nThat password was not the correct one.", "Login", "Quit");
}
return 1;
}
pawn Код:
Dialog:Login(playerid, response, listitem, inputtext[])
{
if (response)
{
if(isnull(inputtext))
{
ShowDialog(playerid, Show:<Login>,DIALOG_STYLE_INPUT,"{08088A}Eastside Gaming Roleplay", "{FFFFFF}Welcome to {08088A}Eastside Gaming Roleplay. {FFFFFF}We {04B404}did {FFFFFF}find youe account in our database.\nPlease enter the password you have associated with this account.\nThat password was not the correct one.", "Login", "Quit");
}
new escapedPlayerName[MAX_PLAYER_NAME], escapepass[100];
mysql_real_escape_string(inputtext, escapepass);
mysql_real_escape_string(PlayerInfo[playerid][pName], escapedPlayerName);
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `name` = '%s' AND `password` = '%s' LIMIT 0,1", escapedPlayerName, escapepass);
mysql_function_query(handle, query, true, "LoginPlayer", "i", playerid);
}
else
{
Kick(playerid);
}
return 1;
}
The error I am getting.
pawn Код:
[21:06:05] [ERROR] cache_get_row_int - invalid datatype
[21:06:05] [WARNING] CMySQLResult::GetRowData - invalid row ('0') or field index ('10')
[21:06:05] [ERROR] cache_get_row_float - invalid datatype
