Page 1 of 1

Fix for the suspicious Weaponname Bug :-)

Posted: Fri Apr 03, 2026 4:29 am
by SkullCollector
Since the error with the strange weapon names occurred again, I quickly built a solution for it.
Quickly is an joke....

Code: Select all

function replaceWordsWithNumbers($string) { // Mapping (lowercase for compare) $map = array( 'minigun' => 'Minigun', 'flakcannon' => 'FlakCannon', 'assaultrifle' => 'AssaultRiffle', 'rocketlauncher' => 'RocketLauncher', 'biorifle' => 'BioRifle', 'classicsniperrifle' => 'ClassicSniperRifle', 'linkgun' => 'LinkGun', 'lightninggun' => 'LightningGun', 'oldshieldgunut' => 'OldShieldGunUTSnd', 'onsgrenadelauncher' => 'ONSGrenadeLauncher', 'onsminelayer' => 'ONSMineLayer', 'painter' => 'Painter', 'redeemer' => 'Redeemer', 'shieldgun' => 'ShieldGun', 'shockrifle' => 'ShockRifle', 'sniperrifle' => 'SniperRifle' ); 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); }
Put these in function in your includes/logspecial.php before the function get_weapon

Search in the function for :

Code: Select all

$weapons = sql_addslashes($weapon);
write before that :

Code: Select all

$weapon = replaceWordsWithNumbers($weapon);
after that it looks like this :

Code: Select all

$weapon = replaceWordsWithNumbers($weapon); $weapons = sql_addslashes($weapon);
save the file and you are ready to go.

Skully

Re: Fix for the suspicious Weaponname Bug :-)

Posted: Fri Apr 03, 2026 12:42 pm
by SkullCollector
Found a damn typo :

Change

Code: Select all

'oldshieldgunut' => 'OldShieldGunUTSnd',
into :

Code: Select all

'oldshieldgunutsnd' => 'OldShieldGunUTSnd',
to much coding last few days..
Sorry for that

Skully