Raised This Month: $ Target: $400
 0% 

How to Read Ini File and Hold Values


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheKidz
Senior Member
Join Date: May 2009
Old 08-24-2010 , 19:27   How to Read Ini File and Hold Values
Reply With Quote #1

Im kinda newbie with ini files thing, and i need some help here.
the thing is:
1) Read the File
2) Hold some Lines Readed
3) Cut Something From the Lines Readed
4) Transform it into a Vote

if its possible i wish u guys could explain those things and how to do..
__________________
TheKidz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-24-2010 , 20:16   Re: How to Read Ini File and Hold Values
Reply With Quote #2

For reading a .ini file see my Bot Apology plugin (in my signature).

1,2. You can use parse() on a line to break it up into variables. To use parse the line would need to look like this:

3.
Code:
"thing1" "thing2" "thing3"
4. See the "New Menus Tutorial" in the Code Snippets/Tutorials section.
__________________
fysiks is offline
TheKidz
Senior Member
Join Date: May 2009
Old 08-24-2010 , 20:29   Re: How to Read Ini File and Hold Values
Reply With Quote #3

can you make an example of parse() with your example ? =S
__________________
TheKidz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 20:39   Re: How to Read Ini File and Hold Values
Reply With Quote #4

Quote:
Originally Posted by TheKidz View Post
can you make an example of parse() with your example ? =S
PHP Code:
new szTest[] = "hello my friend";
new 
szHello] , szMy] , szFriend];

parseszTest szHello charsmaxszHello ) , szMy charsmaxszMy ) , szFriend charsmaxszFriend ) );

//Each variable now holds each respective word.

//Or
new szTest[] = "^"hello my^" friend";
new 
szHelloMy] , szFriend];

parseszTest szHelloMy charsmaxszHelloMy ) ,  szFriend charsmaxszFriend ) ); 
__________________
Bugsy is offline
TheKidz
Senior Member
Join Date: May 2009
Old 08-25-2010 , 14:58   Re: How to Read Ini File and Hold Values
Reply With Quote #5

and there is anyway to change set_task time based on cvar number from config file ? =o
__________________
TheKidz is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-25-2010 , 15:11   Re: How to Read Ini File and Hold Values
Reply With Quote #6

Code:
new cvarTime = register_cvar("Time", 10")

new pcvarTime = get_pcvar_num(cvarTime)

set_task(pcvarTime, .....)
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
TheKidz
Senior Member
Join Date: May 2009
Old 08-25-2010 , 15:50   Re: How to Read Ini File and Hold Values
Reply With Quote #7

i mean take the number from the file, and set_task(thenumber, ...)
__________________
TheKidz is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-25-2010 , 16:06   Re: How to Read Ini File and Hold Values
Reply With Quote #8

you could, or you could just put the code i told you in ur code, and then put time "whatever number" here and then it would work.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-25-2010 , 16:20   Re: How to Read Ini File and Hold Values
Reply With Quote #9

Read the value from the file then do:

set_task( str_to_float( szValFromFile ) , ... );
__________________
Bugsy is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 21:51.


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