|
{
new linedata[1024], key[1024], value[1024]
new file = fopen(files, "rt")
while(file && !feof(file))
{
fgets(file, linedata, charsmax(linedata))
replace(linedata, charsmax(linedata), "^n", "")
if(!linedata[0] || linedata[0] == ';')
continue
strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
trim(key)
trim(value)
if(!strcmp(key, "亮度"))
{
formatex(value, charsmax(value), "%s,0", value)
while(value[0] != '0' && strtok(value, light[lightcounst], strlen(light[lightcounst])-1, value, charsmax(value), ','))
{
trim(light[lightcounst])
trim(value)
if(value[0] == '0')
continue
lightcounst ++
}
}
else if(!strcmp(key, "天空贴图")) set_cvar_string("sv_skyname", value)
else
if(!strcmp(key, "天气"))
{
if(!strcmp(value, "下雨"))
{
engfunc(EngFunc_PrecacheSound, rainsound)
engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_rain"))
severthink[0] = 9999.0
raining = true
}
else if(!strcmp(value, "下雪")) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))
}
else if(!strcmp(key, "是否开启雷鸣") && !strcmp(value, "是"))
{
thunder = true
for(new i = 0; i < sizeof thundersound; i ++) engfunc(EngFunc_PrecacheSound, thundersound[i])
}
else
if(!strcmp(key, "雷鸣平均频率"))
{
thundercolddown = str_to_float(value)
severthink[1] = thundercolddown
}
else
if(!strcmp(key, "是否开启闪电") && !strcmp(value, "是"))
{
thunderflash = true
for(new i = 0; i < sizeof flashsound; i ++) engfunc(EngFunc_PrecacheSound, flashsound[i])
g_fxbeam = engfunc(EngFunc_PrecacheModel, "sprites/laserbeam.spr")
engfunc(EngFunc_PrecacheModel, "models/w_ak47.mdl")
}
else
if(!strcmp(key, "闪电平均频率"))
{
flashcolddown = str_to_float(value)
severthink[3] = flashcolddown
}
else if(!strcmp(key, "是否开启雾") && !strcmp(value, "是")) fogent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_fog"))
else if(!strcmp(key, "雾浓度") && fogent) set_keyvalue(fogent, "density", value, weather[2])
else if(!strcmp(key, "雾颜色") && fogent) set_keyvalue(fogent, "rendercolor", value, weather[2])
else
if(!strcmp(key, "是否开启刮风") && !strcmp(value, "是"))
{
severthink[5] = 9999.0
engfunc(EngFunc_PrecacheSound, windsound)
blowwind = true
}
}
}
|
|