Raised This Month: $ Target: $400
 0% 

Solved Need Code For CFG FILE


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Begineer Programmer
Member
Join Date: Nov 2021
Old 07-24-2022 , 21:30   Re: Need Code For CFG FILE
Reply With Quote #1

Quote:
Originally Posted by lexzor View Post
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;
            }
        }
    }

    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);
    }

Thx mate !!! <3
Begineer Programmer 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 10:32.


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