|
Member
|
07-24-2022
, 21:30
Re: Need Code For CFG FILE
|
#34
|
Quote:
Originally Posted by lexzor
i hope you will understand better
PHP Code:
getCvarValue(const szMap[])
{
new szFile[128], szConfigsDir[128], szMapName[32], iValue;
get_configsdir(szConfigsDir, charsmax(szConfigsDir));
formatex(szFile, charsmax(szFile), "%s/%s_amxx.cfg", szConfigsDir, szMap);
if(file_exists(szFile))
{
new iFile = fopen(szFile, "r");
new szCvar[32], szValue[32], szCfgData[64];
while(fgets(iFile, szCfgData, charsmax(szCfgData)))
{
parse(szData, szCvar, charsmax(szCvar), szValue, charsmax(szValue));
if(equali(szCvar, "mp_maxrounds"))
{
iValue = str_to_num(szValue);
break;
}
}
}
return iValue == 0 ? -1 : iValue;
}
client_command(id)
{
new szMapName[32];
get_mapname(szMapName, charsmax(szMapName));
new iValue = getCvarValue(szMapName);
if(iValue == -1)
{
client_print_color(id, print_team_default, "^4[CVAR]^1 No settings for this map");
}
else
{
client_print_color(id, print_team_default, "^4[CVAR]^1 On this map will pe played^3 %i rounds^1.", iValue);
}
}
|
Thx mate !!! <3
|
|
|
|