AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   .ini (https://forums.alliedmods.net/showthread.php?t=129378)

Temptation 06-12-2010 09:17

.ini
 
Guys, I was wondering how do I make something like in a .ini ?

Example: map.ini

Can someone give me some examples ?

Like I have a plugin which there doesn't have cvar, it changes it cvar from the .ini itself.

Bugsy 06-12-2010 09:26

Re: .ini
 
Do you need to edit this ini manually (notepad or w\e) or are you just looking for an external storage method. Easiest would be to use nvault but with that you cannot modify (without an nvault app) I can also show you have to store info in an ini file.

Alucard^ 06-12-2010 09:59

Re: .ini
 
http://forums.alliedmods.net/showpos...2&postcount=59

That request is fasted coded so maybe don't work, but compile fine... and also is just an example about getting .ini info or creating the file... you have to know also that .ini, .txt, .log or whatever text format is the same thing, the same method.

Also this is only one method, you have another like using fopen, fclose, fgets, fputs.

Just see file.inc

Temptation 06-12-2010 10:56

Re: .ini
 
Quote:

Originally Posted by Bugsy (Post 1206674)
Do you need to edit this ini manually (notepad or w\e) or are you just looking for an external storage method. Easiest would be to use nvault but with that you cannot modify (without an nvault app) I can also show you have to store info in an ini file.

I want you to show me how to store info in an ini file. just like in zombieplague the weapon menu.

Alucard^ 06-12-2010 22:31

Re: .ini
 
I said you...

Code:
write_file(file[], "something");

for example

Temptation 06-13-2010 03:34

Re: .ini
 
Quote:

Originally Posted by Alucard^ (Post 1207263)
I said you...


Code:
write_file(file[], "something");



for example

No, I doesn meant like that.

I don't understand the part which how the zombieplague weapon menu.

is like I don't know how the put the WEAPON_MENU = weapon_m4a1 in the .ini file.

Alucard^ 06-13-2010 03:40

Re: .ini
 
You need to say something more specific... i hate zombie plague so i don't know what you are talking. Show me an example.

Temptation 06-13-2010 05:45

Re: .ini
 
Quote:

Originally Posted by Alucard^ (Post 1207370)
You need to say something more specific... i hate zombie plague so i don't know what you are talking. Show me an example.

There a file called zombieplague.ini:

Code:

[Buy Menu Weapons]
PRIMARY = weapon_galil , weapon_famas , weapon_m4a1 , weapon_ak47 , weapon_sg552 , weapon_aug , weapon_scout , weapon_m3 , weapon_xm1014 , weapon_tmp , weapon_mac10 , weapon_ump45 , weapon_mp5navy , weapon_p90 , weapon_awp , weapon_m249 , weapon_sg550 , weapon_g3sg1
SECONDARY = weapon_glock18 , weapon_usp , weapon_p228 , weapon_deagle , weapon_fiveseven , weapon_elite
ADDITIONAL ITEMS = weapon_hegrenade , weapon_flashbang , weapon_smokegrenade

How do I do this ?

As in just edit in here. to make the changes. Rather than edit in the source code.

Alucard^ 06-13-2010 10:57

Re: .ini
 
Like i said, you can do it with natives that i mentioned (in file.inc)....

Here an example:

Code:
public Function() {     new fileName[192];     get_configsdir(fileName, 191);         add(fileName, 191, "/coolname.ini");         new szLine[192], Data1[32], Data2[32], Data3[32];     new iLine, iLen;         while(read_file(fileName, iLine++, szLine, 191, iLen) )     {         parse(szLine, Data1, 31, Data2, 31, Data3, 31);                 // menu_additem() or whatever you want to add     } }


All times are GMT -4. The time now is 14:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.