SA-MP Forums Archive
Need Help With Weird Problem :/ - 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: Need Help With Weird Problem :/ (/showthread.php?tid=282108)



Need Help With Weird Problem :/ - Tigerbeast11 - 09.09.2011

Here is the link to pastebin of my filterscript(credits to Kush):
http://pastebin.com/Dw73H79Q

I need help, it seems whenever I log in or when the server restarts, it adds an extra line to the bottom of the .ini file. This is what it looks like:
Code:
[Data]
IP = 127.0.0.1
Password = hashed#####
Cash = 0
Admin Level = 0
Kills = 0
Deaths = 0
Admin Level = 0
Admin Level = 0
Admin Level = 0
How can I get rid of the 3
Code:
Admin Level = 0
lines at the bottom?


Re: Need Help With Weird Problem :/ - brett7 - 09.09.2011

I'm not quite sure but when you disconnect you don't need to write to the file
Code:
INI_WriteInt(File,"Admin Level",PlayerInfo[playerid][ALevel]);
Because the file sets your admin level when you join.

Also I wouldn't have a space between Admin and Level it may cause problems.


Re: Need Help With Weird Problem :/ - Kaperstone - 09.09.2011

Quote:
Originally Posted by brett7
View Post
I'm not quite sure but when you disconnect you don't need to write to the file
Code:
INI_WriteInt(File,"Admin Level",PlayerInfo[playerid][ALevel]);
Because the file sets your admin level when you join.

Also I wouldn't have a space between Admin and Level it may cause problems.
lol... he is right :P
you dont have to save the admin level when player disconnect..
because its setted when you set his level,so you need it only to load when player connect


Re: Need Help With Weird Problem :/ - brett7 - 09.09.2011

I would just do
Code:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    //INI_WriteInt(File,"Admin Level",PlayerInfo[playerid][ALevel]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_Close(File);
    return 1;
}



Re: Need Help With Weird Problem :/ - Tigerbeast11 - 10.09.2011

OK, I'll change that and see how it goes...


Re: Need Help With Weird Problem :/ - Tigerbeast11 - 10.09.2011

No, sorry, this still doesn't work.


Re: Need Help With Weird Problem :/ - IceCube! - 10.09.2011

Show us how you are saving your file.

Make sure you have
pawn Code:
INI_SetTag(file, "tag"); // tag eing the tag link
That must be above every save or it will save it randomly anywhere in the file with out checking if its already there


Re: Need Help With Weird Problem :/ - Tigerbeast11 - 10.09.2011

Quote:
Originally Posted by IceCube!
View Post
Show us how you are saving your file.

Make sure you have
pawn Code:
INI_SetTag(file, "tag"); // tag eing the tag link
That must be above every save or it will save it randomly anywhere in the file with out checking if its already there
I have given a pastebin link to my script in my first post ^

I have checked and where ever it writes something to a file, I have used the SetTag function. I really don't know why it won't work...