GO ILLINI
07-20-2007, 08:31 AM
$lines = file("{$directories['srcds']}/cstrike/cfg/server.cfg");
foreach ($lines as $line_num => $line) {
if(strstr($line,'// END CVAR LISTING'))
{
break;
}
$line = explode(" ", $line,2);
$$line[0] = $line[1];
}
Some of the config file(server.cfg)
hostname "Counter-Strike Server"
rcon_password ""
mp_friendlyfire 0
mp_footsteps 1
mp_autoteambalance 1
mp_autokick 0
mp_flashlight 0
mp_tkpunish 1
mp_forcecamera 0
sv_alltalk 0
sv_pausable 0
sv_cheats 0
sv_consistency 1
sv_allowupload 1
sv_allowdownload 1
sv_maxspeed 320
mp_limitteams 2
Now I want to be able to get the variables like $mplimitteams, but only some of them are created. Im not sure whats going on because i dont get any errors, and some of them work, and some dont.
Thanks,
-Adam
foreach ($lines as $line_num => $line) {
if(strstr($line,'// END CVAR LISTING'))
{
break;
}
$line = explode(" ", $line,2);
$$line[0] = $line[1];
}
Some of the config file(server.cfg)
hostname "Counter-Strike Server"
rcon_password ""
mp_friendlyfire 0
mp_footsteps 1
mp_autoteambalance 1
mp_autokick 0
mp_flashlight 0
mp_tkpunish 1
mp_forcecamera 0
sv_alltalk 0
sv_pausable 0
sv_cheats 0
sv_consistency 1
sv_allowupload 1
sv_allowdownload 1
sv_maxspeed 320
mp_limitteams 2
Now I want to be able to get the variables like $mplimitteams, but only some of them are created. Im not sure whats going on because i dont get any errors, and some of them work, and some dont.
Thanks,
-Adam