15.01.2012, 13:37
Okay, the problem is when you receive money in game it doesn't always save, and when it does save - say you get 1299$ the next time you would login you'd have 1300 (It rounds it to the nearest hundred), And the same problem for on saving position - Sometimes it saves your position and sometimes you spawn at the start. (There are not errors)
Here is my saving (on player register)
On player connect and login:
And finally the load user function:
Please help, I cant seem to figure out the problem..
Here is my saving (on player register)
pawn Код:
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Experience",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteInt(File,"Job",0);
INI_WriteFloat(File,"Pos_x",0);
INI_WriteFloat(File,"Pos_y",0);
INI_WriteFloat(File,"Pos_z",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_WriteInt(File,"pGun1",0);
INI_WriteInt(File,"pGun2",0);
INI_WriteInt(File,"pGun3",0);
INI_WriteInt(File,"pGun4",0);
INI_WriteInt(File,"pGun5",0);
INI_WriteInt(File,"pGun6",0);
INI_WriteInt(File,"pGun7",0);
INI_WriteInt(File,"pGun8",0);
INI_WriteInt(File,"pGun9",0);
INI_WriteInt(File,"pGun10",0);
INI_WriteInt(File,"pGun11",0);
INI_WriteInt(File,"pGun12",0);
INI_WriteInt(File,"pGPS",1);
INI_WriteInt(File,"pDeposit",0);
INI_WriteInt(File,"pMaterials",0);
INI_WriteInt(File,"pPackages",0);
INI_WriteInt(File,"pCocaine",0);
INI_Close(File);
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
pawn Код:
function LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Experience",PlayerInfo[playerid][pExp]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Float("Pos_x",PlayerInfo[playerid][pPos_x]);
INI_Float("Pos_y",PlayerInfo[playerid][pPos_y]);
INI_Float("Pos_z",PlayerInfo[playerid][pPos_z]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Team",PlayerInfo[playerid][pTeam]);
INI_Int("Accent",PlayerInfo[playerid][pAccent]);
INI_Int("Job",PlayerInfo[playerid][pJobID]);
INI_Int("Gun1",PlayerInfo[playerid][pGun1]);
INI_Int("Gun2",PlayerInfo[playerid][pGun2]);
INI_Int("Gun3",PlayerInfo[playerid][pGun3]);
INI_Int("Gun4",PlayerInfo[playerid][pGun4]);
INI_Int("Gun5",PlayerInfo[playerid][pGun5]);
INI_Int("Gun6",PlayerInfo[playerid][pGun6]);
INI_Int("Gun7",PlayerInfo[playerid][pGun7]);
INI_Int("Gun8",PlayerInfo[playerid][pGun8]);
INI_Int("Gun9",PlayerInfo[playerid][pGun9]);
INI_Int("Gun10",PlayerInfo[playerid][pGun10]);
INI_Int("Gun11",PlayerInfo[playerid][pGun11]);
INI_Int("Gun12",PlayerInfo[playerid][pGun12]);
INI_Int("GPS",PlayerInfo[playerid][pGPS]);
INI_Int("Deposit",PlayerInfo[playerid][pDeposit]);
INI_Int("Materials",PlayerInfo[playerid][pMaterials]);
INI_Int("Packages",PlayerInfo[playerid][pPackages]);
INI_Int("Cocaine",PlayerInfo[playerid][pCocaine]);
print("Loaded Player Information (Name, Age, Job...)");
return 1;
}