SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/01/2018, 08:42 AM   #1
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 403
Reputation: 18
Default %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?
ivndosos is offline   Reply With Quote
Old 25/01/2018, 09:29 AM   #2
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default Re: %s.ini file writes twice!

Show your code pal.
Meller is offline   Reply With Quote
Old 25/01/2018, 09:40 AM   #3
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 403
Reputation: 18
Default Re: %s.ini file writes twice!

Which one though..?
ivndosos is offline   Reply With Quote
Old 25/01/2018, 09:43 AM   #4
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,243
Reputation: 525
Default 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?
Sew_Sumi is offline   Reply With Quote
Old 25/01/2018, 09:45 AM   #5
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 403
Reputation: 18
Default Re: %s.ini file writes twice!

As you see in my INI file, there are 2 adminlevel text, how do I prevent that?
ivndosos is offline   Reply With Quote
Old 25/01/2018, 10:14 AM   #6
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default 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.
Meller is offline   Reply With Quote
Old 25/01/2018, 11:53 AM   #7
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 403
Reputation: 18
Default Re: %s.ini file writes twice!

I'll say it again I guess, Which one? I don't know whats causing this problem..
ivndosos is offline   Reply With Quote
Old 25/01/2018, 12:31 PM   #8
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,243
Reputation: 525
Default 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.
Sew_Sumi is offline   Reply With Quote
Old 25/01/2018, 01:17 PM   #9
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 403
Reputation: 18
Default 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;
}
ivndosos is offline   Reply With Quote
Old 25/01/2018, 02:02 PM   #10
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default 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
Meller is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Y_Ini writes two times my stats SecretBoss Scripting Help 0 24/08/2015 03:46 PM
When registering on homehost file writes, on another host not. Beckett Scripting Help 8 27/07/2014 01:21 PM
fwrite writes only 1 line pasha97 Scripting Help 3 20/06/2013 08:25 AM
[PLS HELP]ini writers desn't writes or reads! Nexotronix Help Archive 6 12/04/2011 05:01 PM
[Tuts4Nubs]I wants a cig in ma hand when I writes /smoke!!! Thrarod Help Archive 4 08/04/2010 03:45 PM


All times are GMT. The time now is 12:17 PM.


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