Incorrect Saving with Dini -
jameskmonger - 27.12.2010
pawn Код:
if(dialogid == 2) {
if(!response) {
SendClientMessage(playerid, COLOR_RED, "You must register.");
Kick(playerid);
}
if(strval(inputtext)<101 && strval(inputtext)>17) {
new age = strval(inputtext);
pInfo[playerid][Age] = age;
format(string, sizeof(string), "Immigration Officer: Ok, so you are %d years old.", age);
SendClientMessage(playerid, COLOR_WHITE, string);
dini_IntSet(fileLoc, "Age", age);
pInfo[playerid][Step] = 1;
registerPlayer(playerid);
} else {
SendClientMessage(playerid, COLOR_WHITE, "Immigration Officer: ((You must be between the ages of 18-100 to play.))");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Age", "Enter your age in the box below:", "Enter", "Cancel");
}
} else if(dialogid == 4) {
new string2[128];
if(!response) {
SendClientMessage(playerid, COLOR_RED, "You must register.");
Kick(playerid);
}
strcat(string2, inputtext, sizeof(string2));
format(string, sizeof(string), "Immigration Officer: %s accent, it sounds like.", inputtext);
dini_Set(fileLoc, "Accent", inputtext);
strcat(pInfo[playerid][Accent], inputtext);
pInfo[playerid][Registered] = 1;
dini_IntSet(fileLoc, "Registered", 1);
HasJustRegistered[playerid] = true;
SpawnPlayer(playerid);
}
Now, I enter that I have an American accent and am 19 years old, but my stats just say "0 year old male, Accent", when they should say "19 year old male, American Accent"
Re: Incorrect Saving with Dini -
Joe Staff - 27.12.2010
This area seems to be fine, check your player file to make sure it's saving, and if it is, you'll have to give us your stats command.
Re: Incorrect Saving with Dini -
jameskmonger - 27.12.2010
The Username and Password, and "Registered" are all saved fine.
pawn Код:
public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new cash = GetPlayerMoney(targetid);
new atext[20];
if(pInfo[targetid][Sex] == 0) { atext = "Male"; }
else if(pInfo[targetid][Sex] == 1) { atext = "Female"; }
new acctext[30];
format(acctext, sizeof(acctext), "%s", pInfo[playerid][Accent]);
new agetext[20];
format(agetext, sizeof(agetext), "%d", pInfo[targetid][Age]);
new level = pInfo[targetid][Level];
new exp = pInfo[targetid][Experience];
new Float:health;
new name[MAX_PLAYER_NAME];
GetPlayerName(targetid, name, sizeof(name));
GetPlayerHealth(targetid,health);
new Float:px,Float:py,Float:pz;
GetPlayerPos(targetid, px, py, pz);
new coordsstring[256];
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
format(coordsstring, sizeof(coordsstring),"%s, a %s year old %s. %s Accent. Has $%d", name, agetext, atext, acctext, cash);
SendClientMessage(playerid, COLOR_WHITE, coordsstring);
format(coordsstring, sizeof(coordsstring),"Located at x:%f,y:%f,z:%f.", px, py, pz);
SendClientMessage(playerid, COLOR_WHITE, coordsstring);
format(coordsstring, sizeof(coordsstring),"Level %d with %d experience. Health: %f.", level, exp, health);
SendClientMessage(playerid, COLOR_WHITE, coordsstring);
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
}
}
Re: Incorrect Saving with Dini -
Joe Staff - 27.12.2010
Try this, not sure how much it will help
pawn Код:
public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:health;
GetPlayerHealth(targetid,health);
new Float:px,Float:py,Float:pz;
GetPlayerPos(targetid, px, py, pz);
new coordsstring[256];
GetPlayerName(targetid, coordstring, sizeof(coordstring));
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
format(coordsstring, sizeof(coordsstring),"*** %s ***",coordstring);
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
format(coordsstring, sizeof(coordsstring),"%s, a %d year old %s. %s Accent. Has $%d", coordstring, pInfo[targetid][Age],(pInfo[targetid][Sex]==0)?("Male"):("Female"),pInfo[targetid][Accent], GetPlayerMoney(targetid));
SendClientMessage(playerid, COLOR_WHITE, coordsstring);
format(coordsstring, sizeof(coordsstring),"Located at x:%f,y:%f,z:%f.", px, py, pz);
SendClientMessage(playerid, COLOR_WHITE, coordsstring);
format(coordsstring, sizeof(coordsstring),"Level %d with %d experience. Health: %f.", pInfo[targetid][Level], pInfo[targetid][Experience], health);
SendClientMessage(playerid, COLOR_WHITE, coordsstring);
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
}
}
Re: Incorrect Saving with Dini -
jameskmonger - 27.12.2010
Nope, I'm still getting the same error.
Re: Incorrect Saving with Dini -
Souvlaki - 27.12.2010
In your accountname.ini or w/e is age 19 or 0 there?Maybe it's an error on registration.
Re: Incorrect Saving with Dini -
jameskmonger - 28.12.2010
No, it doesn't save the age, or the accent.
Re: Incorrect Saving with Dini -
jameskmonger - 28.12.2010
Here's fileLoc:
pawn Код:
GetPlayerName(playerid, playerName, sizeof(playerName));
format(fileLoc, sizeof(fileLoc), "/Users/%s.ini", playerName);
Re: Incorrect Saving with Dini -
jameskmonger - 28.12.2010
I changed my fileloc to "Users/%s.ini" but it still doesn't save.