Modme Forums

certain weapons not usable in certain areas

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: maxman5050
how can i make my character not able to enter an area if he has a certain gun


ModmeBot:

Reply By: mathfag


function main():

thread no_gun_area();



Bottom of script:
function autoexec no_gun_area()
{
models_clips = GetEntArray("no_gun_barricade","targetname");

while(1)
	{

	foreach(player in GetPlayers())
		{
		if(player chech_area_gun())
			{
			foreach(mod in models_clips)
				mod SetVisibleToPlayer(player);
			IPrintLn("show models");
			}
		else
			{
			foreach(mod in models_clips) 
				mod SetInvisibleToPlayer(player,1);
			}
		}

	wait 0.05;
	}
}


function chech_area_gun() //self = player
{
guns = array("pistol_standard", "pistol_burst");



foreach(gun in guns)
	{
	if(self HasWeapon(GetWeapon(gun), 1))
		return 1;
	}
return 0;

}



Note:
All script_models/brushmodels with the targetname no_gun_barricadewill show to a player when they posses a gun from the function check_area_gun() and hide if they don't