updateAllowed(){ classname = undefined; // if not class bassed and weapon limiter enabled, create an array to add the weapon names used only for this game if(!level.ex_wepo_class && level.ex_wepo_limiter) level.ex_wlim_names = []; switch(level.ex_wepo_class) { case 1: classname = "pistol"; break; // pistol only case 2: classname = "sniper"; break; // sniper only case 3: classname = "mg"; break; // mg only case 4: classname = "smg"; break; // smg only case 5: classname = "rifle"; break; // rifle only case 6: classname = "boltrifle"; break; // bolt action rifle only case 7: classname = "shotgun"; break; // shotgun only case 8: classname = "rl"; break; // panzerschreck only case 9: classname = "boltsniper"; break; // bolt action+snipers } for(i = 0; i < level.weaponnames.size; i++) { weaponname = level.weaponnames[i]; if(level.ex_wepo_class) { // check if it matches the class based weapon if(isWeaponType(weaponname, classname)) level.weapons[weaponname].allow = 1; else level.weapons[weaponname].allow = 0; // check frag grenade if(level.ex_wepo_allow_frag && level.weapons[weaponname].classname == "nade") level.weapons[weaponname].allow = 1; else if(level.weapons[weaponname].classname == "nade") level.weapons[weaponname].allow = 0; // check smoke grenade if(level.ex_wepo_allow_smoke && level.weapons[weaponname].classname == "smoke") level.weapons[weaponname].allow = 1; else if(level.weapons[weaponname].classname == "smoke") level.weapons[weaponname].allow = 0; // check if allowed pistol if(level.ex_wepo_class != 1 && level.ex_wepo_sidearm && isWeaponType(weaponname, "pistol")) level.weapons[weaponname].allow = 1; cvarvalue = level.weapons[weaponname].allow; } else cvarvalue = drm_getCvarInt(level.weapons[weaponname].server_allowcvar); // if not class based weapons and weapon limiter enabled if(!level.ex_wepo_class && level.ex_wepo_limiter) { // check to see whether this weapon limit is zero, not available! if(level.weapons[weaponname].limit == 0) cvarvalue = 0; // if it is allowed and is game allies and axis, then add it to the weapons in use array if((isWeaponType(weaponname, game["allies"]) || isWeaponType(weaponname, game["axis"])) && cvarvalue) level.ex_wlim_names[level.ex_wlim_names.size] = weaponname; // add the cvarvalue to the weapons array level.weapons[weaponname].cvarvalue = cvarvalue; } if(level.weapons[weaponname].allow != cvarvalue) { level.weapons[weaponname].allow = cvarvalue; thread updateAllowedAllClients(weaponname); } }}
isWeaponType(weapon, type){ if(!isDefined(weapon)) return false; switch(type) { case "turret": switch(weapon) { case "mg42_bipod_duck_mp": case "mg42_bipod_prone_mp": case "mg42_bipod_stand_mp": case "mobile_mg42": case "30cal_duck_mp": case "30cal_prone_mp": case "30cal_stand_mp": case "mobile_30cal": return true; default: return false; } case "rocket": switch(weapon) { case "panzerfaust_mp": case "panzerschreck_allies": case "panzerschreck_mp": return true; default: return false; } break; case "common": switch(weapon) { case "panzerfaust_mp": case "panzerschreck_mp": case "panzerschreck_allies": case "binoculars_mp": case "shotgun_mp": return true; default: return false; } // Check if weapon is a grenade case "grenade": switch(weapon) { case "frag_grenade_american_mp": case "frag_grenade_british_mp": case "frag_grenade_german_mp": case "frag_grenade_russian_mp": case "fire_mp": case "gas_mp": return true; default: return false; } // Check if weapon is smoke grenade case "smokegrenade": switch(weapon) { case "smoke_grenade_american_mp": case "smoke_grenade_american_blue_mp": case "smoke_grenade_american_green_mp": case "smoke_grenade_american_orange_mp": case "smoke_grenade_american_pink_mp": case "smoke_grenade_american_red_mp": case "smoke_grenade_american_yellow_mp": case "smoke_grenade_american_fire_mp": case "smoke_grenade_american_gas_mp": case "smoke_grenade_british_mp": case "smoke_grenade_british_blue_mp": case "smoke_grenade_british_green_mp": case "smoke_grenade_british_orange_mp": case "smoke_grenade_british_pink_mp": case "smoke_grenade_british_red_mp": case "smoke_grenade_british_yellow_mp": case "smoke_grenade_british_fire_mp": case "smoke_grenade_british_gas_mp": case "smoke_grenade_german_mp": case "smoke_grenade_german_blue_mp": case "smoke_grenade_german_green_mp": case "smoke_grenade_german_orange_mp": case "smoke_grenade_german_pink_mp": case "smoke_grenade_german_red_mp": case "smoke_grenade_german_yellow_mp": case "smoke_grenade_german_fire_mp": case "smoke_grenade_german_gas_mp": case "smoke_grenade_russian_mp": case "smoke_grenade_russian_blue_mp": case "smoke_grenade_russian_green_mp": case "smoke_grenade_russian_orange_mp": case "smoke_grenade_russian_pink_mp": case "smoke_grenade_russian_red_mp": case "smoke_grenade_russian_yellow_mp": case "smoke_grenade_russian_fire_mp": case "smoke_grenade_russian_gas_mp": return true; default: return false; } // Check if weapon is a rifle case "rifle": switch(weapon) { case "enfield_mp": case "g43_mp": case "kar98k_mp": case "m1carbine_mp": case "m1garand_mp": case "mosin_nagant_mp": case "svt40_mp": return true; default: return false; } // Check if weapon is a bolt action rifle case "boltrifle": switch(weapon) { case "mosin_nagant_mp": case "kar98k_mp": case "enfield_mp": return true; default: return false; } // Check if weapon is a semi automatic rifle case "semirifle": switch(weapon) { case "g43_mp": case "m1garand_mp": case "svt40_mp": return true; default: return false; } // Check if weapon is smg case "smg": switch(weapon) { case "greasegun_mp": case "mp40_mp": case "sten_mp": case "thompson_mp": case "ppsh_mp": case "pps42_mp": return true; default: return false; } // Check if weapon is mg case "mg": switch(weapon) { case "mp44_mp": case "bar_mp": case "bren_mp": case "mobile_30cal": case "mobile_mg42": case "ppsh_mp": return true; default: return false; } // Check if weapon is sniper case "sniper": switch(weapon) { case "mosin_nagant_sniper_mp": case "springfield_mp": case "kar98k_sniper_mp": case "enfield_scope_mp": case "g43_sniper": return true; default: return false; } // Check if weapon is rocket launcher case "rl": switch(weapon) { case "panzerschreck_mp": case "panzerschreck_allies": return true; default: return false; } // Check if weapon is shotgun case "shotgun": switch(weapon) { case "shotgun_mp": return true; default: return false; } // Check if weapon is pistol case "pistol": switch(weapon) { case "colt_mp": case "luger_mp": case "tt30_mp": case "webley_mp": return true; default: return false; } // Check if weapon is knife case "knife": switch(weapon) { case "knife_mp": return true; default: return false; } // Check if weapon is american case "american": switch(weapon) { case "frag_grenade_american_mp": case "smoke_grenade_american_mp": case "colt_mp": case "knife_mp": case "mobile_30cal": case "fire_mp": case "gas_mp": case "m1carbine_mp": case "m1garand_mp": case "greasegun_mp": case "thompson_mp": case "bar_mp": case "springfield_mp": case "shotgun_mp": case "panzerschreck_allies": case "enfield_mp": return true; default: return false; } // Check if weapon is british case "british": switch(weapon) { case "frag_grenade_british_mp": case "smoke_grenade_british_mp": case "webley_mp": case "knife_mp": case "mobile_30cal": case "fire_mp": case "gas_mp": case "m1garand_mp": case "enfield_mp": case "sten_mp": case "bren_mp": case "thompson_mp": case "enfield_scope_mp": case "panzerschreck_allies": case "shotgun_mp": return true; default: return false; } // Check if weapon is russian case "russian": switch(weapon) { case "frag_grenade_russian_mp": case "smoke_grenade_russian_mp": case "tt30_mp": case "knife_mp": case "mobile_30cal": case "fire_mp": case "gas_mp": case "mosin_nagant_mp": case "svt40_mp": case "pps42_mp": case "ppsh_mp": case "mosin_nagant_sniper_mp": case "panzerschreck_allies": case "shotgun_mp": return true; default: return false; } // Check if weapon is german case "german": switch(weapon) { case "frag_grenade_german_mp": case "smoke_grenade_german_mp": case "luger_mp": case "knife_mp": case "mobile_mg42": case "fire_mp": case "gas_mp": case "kar98k_mp": case "g43_mp": case "g43_sniper": case "mp40_mp": case "mp44_mp": case "kar98k_sniper_mp": case "panzerschreck_mp": case "shotgun_mp": return true; default: return false; } // Check if weapon is boltsniper (modded 18122007) case "boltsniper": switch(weapon) { case "mosin_nagant_sniper_mp": case "springfield_mp": case "kar98k_sniper_mp": case "enfield_scope_mp": case "mosin_nagant_mp": case "kar98k_mp": case "enfield_mp": return true; default: return false; } } return false;}