SA-MP Forums Archive
Y_ini double saving , help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Y_ini double saving , help (/showthread.php?tid=603266)



Y_ini double saving , help - Yaniii - 20.03.2016

Код:
 
enum pInfo
{
    pPass,
    pLevel,
    pExperience,
    pMaxExperience,
	pSexe,
	pAge,
	pOrigine,
	pBanned,
	pArgentBanque,
    pArgentPoche,
	pSkin,
	pFonction,
	pAdminstrator,
	pRegistred,
	Float: pExtX,
	Float: pExtY,
    Float: pExtZ,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
case DIALOG_REGISTER:
  {
  if (!response) return Kick(playerid);
  if(response)
  {
  if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Inscription",""COL_RED"Le mot de passe que vous avez choisi est incorrect\n"COL_WHITE"Tapez votre mot de passe si dessus pour pouvoir s'inscrir.","Inscription","Quitter");
  new INI:File = INI_Open(UserPath(playerid));
  INI_SetTag(File,"data");
  INI_WriteInt(File, "Password", udb_hash(inputtext));
  INI_WriteInt(File,"Admin",0);
  INI_WriteInt(File,"Level",0);
  INI_WriteInt(File,"PE", 0);
  INI_WriteInt(File,"MPE",0);
  INI_WriteInt(File,"ArgentBanque", 0);
  INI_WriteInt(File,"ArgentPoche", 0);
  INI_WriteInt(File,"Sexe", 0);
  INI_WriteInt(File,"Age", 0);
  INI_WriteInt(File,"Origine", 0);
  INI_WriteInt(File,"Ban", 0);
  INI_WriteInt(File,"Skin",0);
  INI_WriteInt(File,"Fonction",0);
  INI_WriteInt(File,"Engistré",0);
  INI_WriteFloat(File,"ExtX",0.0000);
  INI_WriteFloat(File,"ExtY",0.0000);
  INI_WriteFloat(File,"ExtZ",0.0000);
  INI_Close(File);
  ShowPlayerDialog(playerid, DIALOG_SEXE, DIALOG_STYLE_MSGBOX, ""COL_WHITE"Choix Sexe", ""COL_YELLOW"Choisissez le sexe de votre personnage.", "Homme", "Femme");
  }
  }
Код:
public OnPlayerDisconnect(playerid, reason)
{
	
    new Float:X, Float:Y, Float:Z;
	GetPlayerPos(playerid, X, Y, Z);
	PlayerInfo[playerid][pExtX] = X;
	PlayerInfo[playerid][pExtY] = Y;
	PlayerInfo[playerid][pExtZ] = Z;
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File,"PE",PlayerInfo[playerid][pExperience]);
    INI_WriteInt(File,"MPE",PlayerInfo[playerid][pMaxExperience]);
    INI_WriteInt(File,"ArgentBanque",PlayerInfo[playerid][pArgentBanque]);
    INI_WriteInt(File,"ArgentPoche",PlayerInfo[playerid][pArgentPoche]);
	INI_WriteInt(File,"Sexe",PlayerInfo[playerid][pSexe]);
	INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
	INI_WriteInt(File,"Origine",PlayerInfo[playerid][pOrigine]);
	INI_WriteInt(File,"Ban",PlayerInfo[playerid][pBanned]);
	INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
	INI_WriteInt(File,"Fonction",PlayerInfo[playerid][pFonction]);
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdminstrator]);
	INI_WriteInt(File,"Engistré",PlayerInfo[playerid][pRegistred]);
	INI_WriteFloat(File,"ExtX",X);
	INI_WriteFloat(File,"ExtY",Y);
	INI_WriteFloat(File,"ExtZ",Z);
	
    INI_Close(File);
    return 1;
}
Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
	INI_Int("Level",PlayerInfo[playerid][pLevel]);
	INI_Int("PE",PlayerInfo[playerid][pExperience]);
	INI_Int("MPE",PlayerInfo[playerid][pMaxExperience]);
    INI_Int("ArgentBanque",PlayerInfo[playerid][pArgentBanque]);
    INI_Int("ArgentPoche",PlayerInfo[playerid][pArgentPoche]);
    INI_Int("Sexe",PlayerInfo[playerid][pSexe]);
	INI_Int("Age",PlayerInfo[playerid][pAge]);
	INI_Int("Origine",PlayerInfo[playerid][pOrigine]);
	INI_Int("Ban",PlayerInfo[playerid][pBanned]);
	INI_Int("Skin",PlayerInfo[playerid][pSkin]);
	INI_Int("Fonction",PlayerInfo[playerid][pFonction]);
	INI_Int("Admin",PlayerInfo[playerid][pAdminstrator]);
	INI_Int("Engistré",PlayerInfo[playerid][pRegistred]);
	INI_Float("ExtX",PlayerInfo[playerid][pExtX]);
	INI_Float("ExtY",PlayerInfo[playerid][pExtY]);
	INI_Float("ExtZ",PlayerInfo[playerid][pExtZ]);
    return 1;
}

But at 70/100 this happens when i edit my admin grade in the file didn't test to edit another thing
Код:
[data]
Password = 257360544
Admin = 9999
Level = 1
PE = 0
MPE = 3
ArgentBanque = 4500
ArgentPoche = 3500
Sexe = 1
Age = 21
Origine = 2
Ban = 0
Skin = 60
Fonction = 0
Engistré = 1
ExtX = 1724.363769
ExtY = -1855.355957
ExtZ = 13.414062
[data]
Level = 1
PE = 0
MPE = 3
ArgentBanque = 4500
ArgentPoche = 3500
Sexe = 1
Age = 21
Origine = 2
Ban = 0
Skin = 60
Fonction = 0
Admin = 9999
Engistré = 1
ExtX = 1738.516723
ExtY = -1855.158935
ExtZ = 13.414062
[/code]


Re: Y_ini double saving , help - Yaniii - 20.03.2016

up , any help ?


Re: Y_ini double saving , help - Yaniii - 21.03.2016

UP , +RER


Re: Y_ini double saving , help - saffierr - 21.03.2016

Perhaps you're forgetting to put INI_SetTag(); somewhere when you open the UserPath file, re-check it.


Re: Y_ini double saving , help - Yaniii - 21.03.2016

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Perhaps you're forgetting to put INI_SetTag(); somewhere when you open the UserPath file, re-check it.
it's present everywhere so the problem isn't here


Re: Y_ini double saving , help - RanSEE - 21.03.2016

I am guessing you are not allowed to have any kind of spaces between the keys, not sure though.


Re: Y_ini double saving , help - Yaniii - 21.03.2016

how ?


Re: Y_ini double saving , help - AndySedeyn - 21.03.2016

You should reset all the variables set on the player's ID after everything has been saved or before you load anything. Also, you should check whether the player who is disconnecting is logged in or spawned. Otherwise you get faulty data.

And if you actually have a server with +70 players, then why don't you consider using an actual hashing algorithm? udb_hash is easy to crack and thus not secure at all.