Raised This Month: $ Target: $400
 0% 

[SOLVED] Getting argument from vars in file ( like csdm.cfg )


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-03-2009 , 14:18   [SOLVED] Getting argument from vars in file ( like csdm.cfg )
Reply With Quote #1

I have such a line in my csdm.cfg

Code:
remove_objectives = abcd

how can I get the argument "abcd" in my plugin.. I wrote only beginning of such a stock:
PHP Code:
stock csdm_get_remove_objectives()
{    
    static 
ConfigsDir[128], Filename[150], ReadData[512]
    
get_configsdir(ConfigsDir127)
    
format(Filename139"%s/csdm.cfg"ConfigsDir)
    
    if(!
file_exists(Filename))
        return;
    
    static 
len,currline
    
    
while(read_file(FilenamecurrlineReadData511len))
    {
        
// check if the line is empty
        
if (!len)
            continue;
            
        
// here should check does
        // string "remove_objectives" 
        // exists on current line ( currline )
        // and get what's after =

    
}

Any suggestions?

Last edited by Empowers; 04-03-2009 at 16:10.
Empowers is offline
Send a message via ICQ to Empowers
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-03-2009 , 15:09   Re: Getting argument from vars in file ( like csdm.cfg )
Reply With Quote #2

Code:
new szFirst[51], szMiddle[51], szLast[51];
parse( ReadData, szFirst, 50, szMiddle, 50, szLast, 50);
if( equal(szFirst, "remove_objectives") && equal(szMiddle, "=") ){
    //szLast contains what is after the = sign
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-03-2009 , 15:47   Re: Getting argument from vars in file ( like csdm.cfg )
Reply With Quote #3

Wow!
Great code, doing this with only 3 line it's really nice
Thx Emp`
+k

SOLVED
Empowers is offline
Send a message via ICQ to Empowers
Old 04-03-2009, 16:02
Empowers
This message has been deleted by Empowers.
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 02:25.


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