Need Help With Weird Problem :/
#1

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?
Reply
#2

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.
Reply
#3

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
Reply
#4

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;
}
Reply
#5

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

No, sorry, this still doesn't work.
Reply
#7

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
Reply
#8

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)