Raised This Month: $ Target: $400
 0% 

Read specific part from ini


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 07:27   Read specific part from ini
Reply With Quote #1

Hello. It's my first time trying to use containi so I am not yet very familiar with it, I know it's like that native containi(const source[],const string[]); where source is the ini file and string is the string. The real problem is how can I read only specific text from every line from the ini, in this case the models, and not anything else that goes after them? Any help will be apreciated, thanks!

Code:
public plugin_precache()
{
    new conffile_mdl[200]
    new configdir_mdl[200]
 
    get_configsdir(configdir_mdl,199)
    format(conffile_mdl,199,"%s/models.ini",configdir_mdl)
    if(!file_exists(conffile_mdl))
    {
        log_amx("amxmodx/configs/models.ini is missing!")
        return 0
    }
 
    new lines = file_size(conffile_mdl,1)
    new name[128], len
    new model_path[128]
    for(new i=0;i<=lines;i++)
    {
        read_file(conffile_mdl,i,name,127,len)
        if(equal(name,"")) continue;
        if(!equal(name,";",1)) {
            // log_amx("precache: %s", file)
            format(model_path, charsmax(model_path), "models/player/%s/%s.mdl",name,name)
            precache_model(model_path);
        }
    }
    return PLUGIN_HANDLED;
}

Last edited by DarthMan; 03-01-2017 at 07:28.
DarthMan is offline
 



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 20:43.


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