SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   %s.ini file writes twice! (https://forum.sa-mp.com/showthread.php?t=648590)

ivndosos 25/01/2018 08:42 AM

%s.ini file writes twice!
 
I'm having this weird issue with my ini file

Code:

AdminLevel = 0
[Player Information]
Deaths = 0
Kills = 0
Score = 0
Money = 0
AdminLevel = 0
Password = 2284011421411A104799568D490F01DAB30240E4248DF1981911B727811D6F4D7EDD2EFCE86963BFE8BC4C6E95438E60CA18C6A8C66DB77873DCE268E28BDB4E

That's an example, Does anyone have idea why does it write it twice?

Meller 25/01/2018 09:29 AM

Re: %s.ini file writes twice!
 
Show your code pal.

ivndosos 25/01/2018 09:40 AM

Re: %s.ini file writes twice!
 
Which one though..?

Sew_Sumi 25/01/2018 09:43 AM

Re: %s.ini file writes twice!
 
How do you mean, writes twice? In the example it's single, are you meaning that it's writing 2 files with the same content?

ivndosos 25/01/2018 09:45 AM

Re: %s.ini file writes twice!
 
As you see in my INI file, there are 2 adminlevel text, how do I prevent that?

Meller 25/01/2018 10:14 AM

Re: %s.ini file writes twice!
 
You've only provided with a text of your INI configuration file, we need the actual PAWN code of the writing to see the issue. This is an internal issue, not external.

ivndosos 25/01/2018 11:53 AM

Re: %s.ini file writes twice!
 
I'll say it again I guess, Which one? I don't know whats causing this problem..

Sew_Sumi 25/01/2018 12:31 PM

Re: %s.ini file writes twice!
 
It's your code, and what would be the section writing the files, would be the save file function.

ivndosos 25/01/2018 01:17 PM

Re: %s.ini file writes twice!
 
Code:

    if(dialogid == dlogin)
    {//then
        if(!response) return Kick(playerid);
        if(response)
        {//then
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!strcmp(hashpass,pInfo[playerid][Pass]))
            {//then
                INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
                SetPlayerScore(playerid,pInfo[playerid][Score]);
                GivePlayerMoney(playerid,pInfo[playerid][Money]);
                SendClientMessage(playerid,-1,"{c3c3c3}(INFO) You have successfully logged in! You can start playing now.");
            }
            else
            {//then
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Account","{FF0000}You have entered a wrong password! Please try again.","Login","Quit");//We will tell to them that they've entered an incorrect password
                return 1;
            }
        }
    }
    return 1;
}

Code:

forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Pass],129);
    INI_Int("Admin",pInfo[playerid][Admin]);
    INI_Int("Money",pInfo[playerid][Money]);
    INI_Int("Score",pInfo[playerid][Score]);
    INI_Int("Kills",pInfo[playerid][Kills]);
    INI_Int("Deaths",pInfo[playerid][Deaths]);
    return 1;
}


Meller 25/01/2018 02:02 PM

Re: %s.ini file writes twice!
 
Apparently, you've got no common sense within scripting, let me rephrase this: Post your OnPlayerDisconnect callback.


holy fuck this is retarded


All times are GMT. The time now is 05:44 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.