So after some Matches with UTComp enabled i figured some new Weapons out that makes new Entrys in the Weapons Table.
New Names but the same Weapons.
Here are my new function and the edited function get_weapon
This is the for the File includes/logspecial.php
Put it before function get_weapon
Code: Select all
function replaceWordsWithNumbers($string)
{
// Mapping (lowercase for compare)
$map = array(
'minigun' => 'Minigun',
'flakcannon' => 'FlakCannon',
'assaultrifle' => 'AssaultRifle',
'rocketlauncher' => 'RocketLauncher',
'biorifle' => 'BioRifle',
'classicsniperrifle' => 'ClassicSniperRifle',
'linkgun' => 'LinkGun',
'lightninggun' => 'LightningGun',
'oldshieldgunutsnd' => 'OldShieldGunUTSnd',
'onsgrenadelauncher' => 'ONSGrenadeLauncher',
'onsminelayer' => 'ONSMineLayer',
'painter' => 'Painter',
'redeemer' => 'Redeemer',
'shieldgun' => 'ShieldGun',
'shockrifle' => 'ShockRifle',
'sniperrifle' => 'SniperRifle',
'grenade launcher' => 'Grenade Launcher',
'ut2004sasniperrifle' => 'UT2004SASniperRifle',
'ut99sasniperrifle' => 'UT99SASniperRifle',
'utcomp_shockrifle' => 'UTComp_ShockRifle',
'utcomp_minigun' => 'UTComp_MiniGun',
'utcomp_assaultrifle' => 'UTComp_AssaultRifle',
'utcomp_linkgun' => 'UTComp_LinkGun',
'utcomp_biorifle' => 'UTComp_BioRifle',
'utcomp_sniperrifle' => 'UTComp_SniperRifle',
'utcomp_flakcannon' => 'UTComp_FlakCannon',
'utcomp_assaultrifle' => 'UTComp_AssaultRifle',
'mybio' => 'Mybio'
);
return preg_replace_callback('/\b([a-zA-Z]+)(\d+)\b/u', function ($matches) use ($map) {
$word = strtolower($matches[1]);
if (isset($map[$word])) {
return $map[$word];
}
// not in the mapping ... get back original string
return $matches[0];
}, $string);
}
And here my modified get_weapon.
you can comment the old one out so, if you get into Problems go one step back and put the old one in.

In my case , i have replaced it.
Code: Select all
function get_weapon($weapon, $monster)
{
global $link, $dbpre, $match, $config, $break;
// Remove custom prefixes
if (strlen($weapon) > 8 && strtolower(substr($weapon, 0, 8)) == "ut2vweap")
$weapon = substr($weapon, 8);
else if (strlen($weapon) > 7 && substr($weapon, 0, 7) == "OLTeams")
$weapon = substr($weapon, 7);
else if (strlen($weapon) > 7 && substr($weapon, 0, 7) == "NewNet_") // NewNet from UTComp
$weapon = substr($weapon, 7);
else if (strlen($weapon) > 7 && substr($weapon, 0, 7) == "newNet_") // newNet from UTCOmp
$weapon = substr($weapon, 7);
else if (strlen($weapon) > 3 && substr($weapon, 0, 3) == "BS_") // UTComp
$weapon = substr($weapon, 3);
else if (strlen($weapon) > 5 && substr($weapon, - 5) == "_3SPN") // Team Arenamaster
$weapon = substr($weapon, 0, - 5);
else if (strlen($weapon) > 8 && substr($weapon, 0, 8) == "Forward_") // Forward_ from UTCOmp
$weapon = substr($weapon, 8);
// Convert improper TAM names
if ($weapon == "DamType_FlakChunk")
$weapon = "DamTypeFlakChunk";
else if ($weapon == "DamType_FlakShell")
$weapon = "DamTypeFlakShell";
else if ($weapon == "DamType_ShockCombo")
$weapon = "DamTypeShockCombo";
else if ($weapon == "DamType_Headshot")
$weapon = "DamTypeHeadshot";
else if ($weapon == "UTComp_SniperRifle")
$weapon = "SniperRifle";
else if ($weapon == "UTComp_MiniGun")
$weapon = "MiniGun";
else if ($weapon == "UTComp_FlakCannon")
$weapon = "FlakCannon";
else if ($weapon == "UT2004SASniperRifle")
$weapon = "SniperRifle";
else if ($weapon == "UTComp_AssaultRifle")
$weapon = "AssaultRifle";
else if ($weapon == "UTComp_LinkGun")
$weapon = "LinkGun";
else if ($weapon == "UT99SASniperRifle")
$weapon = "SniperRifle";
else if ($weapon == "UTComp_ShockRifle")
$weapon = "ShockRifle";
else if ($weapon == "UTComp_BioRifle")
$weapon = "BioRifle";
else if ($weapon == "Mybio")
$weapon = "BioRifle";
if ($match->uttype == 1 && $config["ut99weapons"])
$weapon = "UT99 " . $weapon;
$weapon = replaceWordsWithNumbers($weapon);
$weapons = sql_addslashes($weapon);
$result = sql_queryn($link, "SELECT wp_num,wp_weaptype,wp_secondary FROM {$dbpre}weapons WHERE wp_type='$weapons' LIMIT 1");
if (! $result) {
echo "Error reading weapons table.{$break}\n";
die();
}
if ($row = sql_fetch_row($result)) {
$weaponnum = $row[0];
$weaptype = $row[1];
$weapsec = $row[2];
sql_free_result($result);
} else { // Add new weapon
sql_free_result($result);
if ($monster)
$result = sql_queryn($link, "INSERT INTO {$dbpre}weapons (wp_type,wp_desc,wp_weaptype) VALUES('$weapons','$weapons',3)");
else
$result = sql_queryn($link, "INSERT INTO {$dbpre}weapons (wp_type,wp_desc) VALUES('$weapons','$weapons')");
if (! $result) {
echo "Error adding new weapon.{$break}\n";
die();
}
$weaponnum = sql_insert_id($link);
$weaptype = $weapsec = 0;
}
$ret = array(
$weaponnum,
$weaptype,
$weapsec
);
return $ret;
}
As you can see there some new replace in there. Because UTCOmp uses new Weaponnames I don't know why.
hope it helps.
Skull