SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/09/2011, 03:19 PM   #1
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 5
Question Need Help With Weird Problem :/

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?
Tigerbeast11 is offline   Reply With Quote
Old 09/09/2011, 09:47 PM   #2
brett7
Gangsta
 
brett7's Avatar
 
Join Date: Nov 2007
Location: samp is #1
Posts: 669
Reputation: 14
Default Re: Need Help With Weird Problem :/

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.
brett7 is offline   Reply With Quote
Old 09/09/2011, 10:02 PM   #3
Kaperstone
Banned
 
Join Date: May 2011
Location: Russia
Posts: 3,004
Reputation: 824
Default Re: Need Help With Weird Problem :/

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
Kaperstone is offline   Reply With Quote
Old 09/09/2011, 10:08 PM   #4
brett7
Gangsta
 
brett7's Avatar
 
Join Date: Nov 2007
Location: samp is #1
Posts: 669
Reputation: 14
Default Re: Need Help With Weird Problem :/

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;
}
brett7 is offline   Reply With Quote
Old 10/09/2011, 10:51 AM   #5
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 5
Default Re: Need Help With Weird Problem :/

OK, I'll change that and see how it goes...
Tigerbeast11 is offline   Reply With Quote
Old 10/09/2011, 11:06 AM   #6
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 5
Default Re: Need Help With Weird Problem :/

No, sorry, this still doesn't work.
Tigerbeast11 is offline   Reply With Quote
Old 10/09/2011, 11:10 AM   #7
IceCube!
High-roller
 
IceCube!'s Avatar
 
Join Date: Aug 2011
Location: Grove Street, Home; Atleast it was before I fucked everything up. Motto: Carpe Diem, Bitch!
Posts: 1,765
Reputation: 230
Default Re: Need Help With Weird Problem :/

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
__________________

Image by Phyzic
Projects (28/01/2017)
Skype: Hewlett_T
None.I'm dead, honest!
IceCube! is offline   Reply With Quote
Old 10/09/2011, 11:16 AM   #8
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 5
Default Re: Need Help With Weird Problem :/

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...
Tigerbeast11 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
Weird problem BuLLeT[LTU] Help Archive 1 09/08/2011 10:35 AM
Hmm.. weird problem with my NEW PC xRyder Everything and Nothing 6 02/03/2011 09:58 PM
Weird Problem Saurik Everything and Nothing 2 18/01/2011 10:39 AM
Very weird NPC problem Swiftz Help Archive 4 17/01/2011 10:31 AM
weird problem armyoftwo Help Archive 0 13/11/2010 04:22 PM


All times are GMT. The time now is 02:51 AM.


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