Hi Guys,
I think I found a bug in the function FindMap.
When we use "!setnextmap mapname" with a mapname that doesnt exist the server (cod5) crashes when rotating to that new map.
After looking at the code i found an easy fix:
old code:
public function findMap($search) {
$search = strtolower($search);
if (array_key_exists($search, $this->maps)) {
return $search;
}
foreach ($this->maps as $short => $long) {
if (strtolower($long) == $search) {
return $short;
}
}
if (!preg_match('|^[a-z0-9._-]+$|i', $search)) return false;
return $search;
}
New code:
public function findMap($search) {
$search = strtolower($search);
if (array_key_exists($search, $this->maps)) {
return $search;
}
foreach ($this->maps as $short => $long) {
if (strtolower($long) == $search) {
return $short;
}
}
if (!preg_match('|^[a-z0-9._-]+$|i', $search)) return false;
return false;
}
Changes: last line returns false instead of ($search), the mapname.
This causes the admin mod to say "no such map" when typing a wrong mapname.
And therefor the server no longer crashes.
running standard cod5.
Please update this in the next package.
And keep up the good work!
DFC-NightMare[NL]