u should use the stripos function to check if the are more names
Example:
PHP
private function only_plugin_findWeapon($search) {
$weapons = array(
'm40a3','m21','remington700','dragunov','barrett',
'colt45','beretta','deserteaglegold','deserteagle','usp',
'ak47', 'g36c', 'g3','m14','m4','m16','mp44',
'mp5','ak74u','p90','uzi','skorpion',
'saw','rpd','m60e4',
'm1014','winchester1200',
'frag','flash','frag_grenade_short','smoke','concussion',
'artillery','c4','claymore','cobra','gl','rpg','destructible'
);
$found = false;
foreach ($weapons as $weapon) {
$weaponLong = $this->mod->getLongWeaponname($weapon);
if (stripos($weaponLong, $search) !== false) {
if ($found != false) return false;
$found = array("short" => $weapon , "long" => $weaponLong);
}
}
return $found;
}
Alles anzeigen