How to read ini files?
#1

Hey!
Can anyone explane more how to read ini files? Like i want to write to any ini file Players nicknames and then i type any cmd that names will show in GUI.
Thanks!
Reply
#2

So you want to create, save and read INI files and also show that data in a dialog from what I gather.

What kind of experience do you have with PAWN or programming/scripting in general?

The easiest way to make/save/read INI files is using an include or similar already made (avoid DINI, it is slow as hell), I use SII at the moment and it is very easy to use. Keep in mind you cannot open more than one file at a time (on a side note, if you log stuff, just use SA:MP's base I/O as you don't need anything more advanced than that).

Obviously you need a gamemode/script wide variable(s) to actually store this information for reading/writing and displaying.

Then I believe it's onPlayerText you can check what comes in if it's /showmenames or what ever you want followed by the ID of the character and then use ShowPlayerDialog.
Reply
#3

Well i dont know what my scripting level is but i can make car shop ownership system like need for speed by irin
Reply
#4

That's ok, as far as SA:MP with PAWN goes you could say I am relatively new, but I have roughly 10 years of multiple programming and scripting languages under my belt, so I can get by easily and help even here to a point, it just gives me an idea of how to get my points across and such.

So for the INI files, get SII (in include section of forum I think), it will be a file you need to put in PAWNO's inc directory and then at top of your script put <SII> along with others. The topic for SII itself will explain it's use, but it is fairly simple:

INI_Open("pathToMyFile/myfile.ini");
INI_ReadString(var, "KeyName");
INI_Close();

ReadString for SII is different from all other Read/Write functions as you need to supply the variable in which to store the value of "KeyName". If you are not familiar with basic INI format it is:

Message = Hello!

Message is the "KeyName" and Hello! is the value, = is the seperator.

If you want to try SII go for it and let me know how you go with experimenting a bit with it, and if your happy with that we can move on to tackling the next part.
Reply
#5

Quote:
Originally Posted by GrimR
Посмотреть сообщение
That's ok, as far as SA:MP with PAWN goes you could say I am relatively new, but I have roughly 10 years of multiple programming and scripting languages under my belt, so I can get by easily and help even here to a point, it just gives me an idea of how to get my points across and such.

So for the INI files, get SII (in include section of forum I think), it will be a file you need to put in PAWNO's inc directory and then at top of your script put <SII> along with others. The topic for SII itself will explain it's use, but it is fairly simple:

INI_Open("pathToMyFile/myfile.ini");
INI_ReadString(var, "KeyName");
INI_Close();

ReadString for SII is different from all other Read/Write functions as you need to supply the variable in which to store the value of "KeyName". If you are not familiar with basic INI format it is:

Message = Hello!

Message is the "KeyName" and Hello! is the value, = is the seperator.

If you want to try SII go for it and let me know how you go with experimenting a bit with it, and if your happy with that we can move on to tackling the next part.
SII distorts values.
Reply
#6

use Y_INI and use search button then you see the link to tutorial
last learn at it...
Reply
#7

Quote:
Originally Posted by Newbie
Посмотреть сообщение
use Y_INI and use search button then you see the link to tutorial
last learn at it...
He should be using Y_INI, yes I agree. But I don't myself get anything out of it, and if possible he should be using MySQL, because it's faster.
Reply
#8

SII distorts? Could you be more specific (I haven't had any problems with reads being different than written data).

I use and recommend it at the moment because it's the only one I could get to work, that functions the way I think it should.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)