INI Question
#1

Hey guys, I have a small question here.

I've recently started modifying one gamemode of mine and added new variables to the players stats (.ini files).
But the thing is, those new variables don't show up in the current registered players. They only appear in the new created players. Is there a way I can update all my players .ini files acounts with the new variables?

I'm sorry if I didn't explain clearly, if you didn't understand the question please tell me so I can try to explain better.
Reply
#2

I assume you've edited the part on OnPlayerConnect, at the registration part.
At least, that would explain why only new users get it.

Try implementing it on the Login fuction too, so let your script scan the .ini file, and if doesn't contains the new lines you want in the user's file, let it write them. also add them to the Logout function or any other stat saving/checking function.
Reply
#3

Quote:
Originally Posted by judothijs
Посмотреть сообщение
I assume you've edited the part on OnPlayerConnect, at the registration part.
At least, that would explain why only new users get it.

Try implementing it on the Login fuction too, so let your script scan the .ini file, and if doesn't contains the new lines you want in the user's file, let it write them. also add them to the Logout function or any other stat saving/checking function.
Yep I edited the registration part aswell as all the stat saving/checking stuf and logout.

Ahmm, I see. I'm going to try that. Implementing it on the login part.

Thanks for remembering me of this. I'll try it and reply back.
Reply
#4

Okey, after some work I've managed to have some spare time for this.

Does anyone know how to scan/open a .ini file and then check if a certain variable exists inside it? (So that I can afterwords create it)

If been working with mysql recently and can't remember a way to do this in ini...

Thank you for any support.
Reply
#5

You just have to add the new variables to all loading/saving parts your script already has for other variables. You don't need to create anything new.
Reply
#6

Yes, I know MadeMan.
But the question is, how can I check if the player has those variables?
Something like:
pawn Код:
if(!fexist("Scriptfiles/Logs/pay.txt")) dini_Create("Scriptfiles/Logs/pay.txt");
but for variables inside .ini files
Reply
#7

Sorry, for double posting/bumping. But this is really urgent :/

I'm using now this:

pawn Код:
-                             if(!dini_Isset(UserFile, "Glassesuse")){
                        dini_IntSet(UserFile, "Glassesuse", 0);
                    }
                    if(!dini_Isset(UserFile, "Hat")){
                        dini_IntSet(UserFile, "Hat", 0);
                    }
                    if(!dini_Isset(UserFile, "Hatuse")){
                        dini_IntSet(UserFile, "Hatuse", 0);
                    }
                    if(!dini_Isset(UserFile, "Guitar")){
                        dini_IntSet(UserFile, "Guitar", 0);
                    }
                    if(!dini_Isset(UserFile, "Guitaruse")){
                        dini_IntSet(UserFile, "Guitaruse", 0);
                    }
But i'm getting alot of error 035: argument type mismatch (argument 1)

Oh and in the early posts when I say variable i mean Key.
Reply
#8

Show how you load/save the other variables.
Reply
#9

Problem solved via PM with MadeMan. Thanks for 'wasting' your time. I'm very grateful.

/request close.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)