PlayerInfo[playerid][pSkillSelected] = 1;
mysql_format(mysql, f_query, sizeof(f_query), "UPDATE playerdata SET SkillSelected='%i' WHERE name='%s'", PlayerInfo[playerid][pSkillSelected], PlayerInfo[playerid][name]);
mysql_tquery(mysql, f_query, "", "");
forward LoadAccount(playerid);
public LoadAccount(playerid)
{
new rows = cache_num_rows();
if(!rows) {
printf("[DATABASE ERROR]: Account does not exist.");
}
else if(rows == 1) {
cache_get_field_content(0, "IP", PlayerInfo[playerid][IP], mysql, 17);
cache_get_field_content(0, "Sex", PlayerInfo[playerid][pSex], mysql);
cache_get_field_content(0, "Age", PlayerInfo[playerid][pAge], mysql);
cache_get_field_content(0, "Medic", PlayerInfo[playerid][pAthelete], mysql);
cache_get_field_content(0, "Mechanic", PlayerInfo[playerid][pMechanic], mysql);
cache_get_field_content(0, "Pilot", PlayerInfo[playerid][pPilot], mysql);
cache_get_field_content(0, "SkillSelected", PlayerInfo[playerid][pSkillSelected]);
}
else if(rows > 1) {
printf("[DATABASE ERROR]: Multiple accounts matching player %d.", playerid);
}
}
if(PlayerInfo[playerid][pSkillSelected] != 1)
{
ShowPlayerDialog(playerid, DIALOG_SKILL, DIALOG_STYLE_LIST, "Select the skill you want your chracter to have","Medic\nAthlete\nPilot\nMechanic","Select","Quit");
print("yeah!");
}
cache_get_field_content(0, "IP", PlayerInfo[playerid][IP], mysql, 17);
cache_get_field_content(1, "Sex", PlayerInfo[playerid][pSex], mysql);
cache_get_field_content(2, "Age", PlayerInfo[playerid][pAge], mysql);
cache_get_field_content(3, "Medic", PlayerInfo[playerid][pAthelete], mysql);
cache_get_field_content(4, "Mechanic", PlayerInfo[playerid][pMechanic], mysql);
cache_get_field_content(5, "Pilot", PlayerInfo[playerid][pPilot], mysql);
cache_get_field_content(6, "SkillSelected", PlayerInfo[playerid][pSkillSelected], mysql);
Dayum! Almost forgot to alter the first parameter. Copy paste fail. Before I tried cache_get_filed_content_int but changed to just cache_get_field_content. So as you are saying it won't affect the code, right?
Note: New to MySQL. EDIT: Your DP, xD EDIT2: Yep I used it at other places. |
PlayerInfo[playerid][pSkillSelected] = cache_get_field_content_int(0, "SkillSelected");
Well cache_get_field_content_int also did not worked. Same problem persists.
|
new string[70];
format(string, sizeof(string),"SELECT * FROM `Users` WHERE `Name` = '%s'",The string containing the name here);
mysql_function_query(1, string,true,"LoadAccount","d",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully logged in!");
IsLogged[playerid] = 1;
mysql_format(mysql, query, sizeof(query), "SELECT * FROM playerdata WHERE Name = '%e' LIMIT 1", PlayerInfo[playerid][name]);
mysql_tquery(mysql, query, "LoadAccount", "d", playerid);
if(GenderSelected[playerid] != 1) ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, "Gender","Please select the gender of your character","Male","Female");
if(PlayerInfo[playerid][pSkillSelected] != 1)
{
ShowPlayerDialog(playerid, DIALOG_SKILL, DIALOG_STYLE_LIST, "Select the skill you want your chracter to have","Medic\nAthlete\nPilot\nMechanic","Select","Quit");
print("yeah!");
}
In callback "LoadAccount" Time Function Status Message 14:41:20 CMySQLResult::GetRowDataByName() ERROR invalid row index ('1') 14:41:20 CMySQLResult::GetRowDataByName() ERROR invalid row index ('2') 14:41:20 CMySQLResult::GetRowDataByName() ERROR invalid row index ('3') 14:41:20 CMySQLResult::GetRowDataByName() ERROR invalid row index ('4') 14:41:20 CMySQLResult::GetRowDataByName() ERROR invalid row index ('5') 14:41:20 CMySQLResult::GetRowDataByName() ERROR invalid row index ('6')
cache_get_field_content(0, "IP", PlayerInfo[playerid][IP], mysql);
cache_get_field_content(1, "Sex", PlayerInfo[playerid][pSex], mysql);
cache_get_field_content(2, "Age", PlayerInfo[playerid][pAge], mysql);
cache_get_field_content(3, "Medic", PlayerInfo[playerid][pAthelete], mysql);
cache_get_field_content(4, "Mechanic", PlayerInfo[playerid][pMechanic], mysql);
cache_get_field_content(5, "Pilot", PlayerInfo[playerid][pPilot], mysql);
cache_get_field_content(6, "SkillSelected", PlayerInfo[playerid][pSkillSelected], mysql);