Raised This Month: $ Target: $400
 0% 

Solved Need Code For CFG FILE


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-24-2022 , 21:28   Re: Need Code For CFG FILE
Reply With Quote #20

i hope you will understand better
PHP Code:
getCvarValue(const szMap[])
{
    new 
szFile[128], szConfigsDir[128], szMapName[32], iValue;    
    
get_configsdir(szConfigsDircharsmax(szConfigsDir));
    
formatex(szFilecharsmax(szFile), "%s/%s_amxx.cfg"szConfigsDirszMap);

    if(
file_exists(szFile))
    {
        new 
iFile fopen(szFile"r");
        new 
szCvar[32], szValue[32], szCfgData[64];
        
        while(
fgets(iFileszCfgDatacharsmax(szCfgData)))
        {
            
parse(szDataszCvarcharsmax(szCvar), szValuecharsmax(szValue));

            if(
equali(szCvar"mp_maxrounds"))
            {
                
iValue str_to_num(szValue);
                break;
            }
        }

        
fclose(iFile);
    }

    return 
iValue == ? -iValue;
}

client_command(id)
{
    new 
szMapName[32];
    
get_mapname(szMapNamecharsmax(szMapName));

    new 
iValue getCvarValue(szMapName);

    if(
iValue == -1)
    {
        
client_print_color(idprint_team_default"^4[CVAR]^1 No settings for this map");
    }
    else 
    {
        
client_print_color(idprint_team_default"^4[CVAR]^1 On this map will pe played^3 %i rounds^1."iValue);
    }


Last edited by lexzor; 07-24-2022 at 21:33.
lexzor 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 10:32.


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