Page 1 of 1

Weapon mod

Posted: Mon May 18, 2009 7:51 pm
by HeavenBound
Hey...I'm giving players all weapons, but...here's my problem.

Code: Select all

self give all the stuff// obv. not the code

self use ?

I want them to get the weapon they picked in the "choose weapon" menu...Whats the name of that?

Posted: Mon May 18, 2009 8:30 pm
by Rookie One.pl
self useweaponclass pistol
self useweaponclass rifle
self useweaponclass smg
self useweaponclass mg
self useweaponclass grenade
self useweaponclass heavy

Get the Radiant package and install it. In its "docs" subdirectory there's a file called g_allclasses.htm, which lists all the available script comamnds.

Posted: Mon May 18, 2009 8:40 pm
by HeavenBound
Right, I know all that...but if they don't pick say class of rifle...and I put that in, they arent using the weapon they picked. Thats what I want.

Posted: Mon May 18, 2009 9:46 pm
by Rookie One.pl
Ah, I see what you mean. Bad news is that it's impossible to obtain that information easily. You could make a workaround for it with state files and spawn/death tracking, though.

Posted: Mon May 18, 2009 11:45 pm
by HeavenBound
Well as of now, I'm using a custom torso, that

in Weapon_Raise it exec's the script...

Sor where are you? lol

Posted: Tue May 19, 2009 5:48 am
by $oldier Of Ra
I have a custom statefile which detects the class, the model and the name of the weapon. I recall Elgan coming up with this method first, so his AP menu must have the same mechanism.

Posted: Tue May 19, 2009 7:58 pm
by HeavenBound
got xfire or email? or do u just wanna post it, or are u gunna just say that and not give it to me :P

Posted: Wed May 20, 2009 11:00 am
by $oldier Of Ra
I was thinking you could surf to google, search it, download the AP menu mod and take a look for yourself but since it burns so many calories, I'll just post it:

Code: Select all

// WEAPON CHECK


state GET_WEAPON
{
	entrycommands
	{
		activatenewweapon 
	}

	 states
	 {
		//axis
		STG44					: IS_WEAPON_ACTIVE "mainhand" "StG 44"
		MP40					: IS_WEAPON_ACTIVE "mainhand" "MP40"
		PANZERSCHRECK			: IS_WEAPON_ACTIVE "mainhand" "Panzerschreck"
		KAR98					: IS_WEAPON_ACTIVE "mainhand" "Mauser KAR 98K"
		KAR98_SNIPER			: IS_WEAPON_ACTIVE "mainhand" "KAR98 - Sniper"
	//	WALTHER_P38				: IS_WEAPON_ACTIVE "mainhand" "Walther P38"
	//	STIELHANDGRANATE			: IS_WEAPON_ACTIVE "mainhand" "Stielhandgranate"

		//both
		PISTOL_SILENCED			: IS_WEAPON_ACTIVE "mainhand" "Hi-Standard Silenced"
		SHOTGUN				: IS_WEAPON_ACTIVE "mainhand" "Shotgun"
	//	BINOCULARS				: IS_WEAPON_ACTIVE "mainhand" "Binoculars"

		//ally
		BAZOOKA				: IS_WEAPON_ACTIVE "mainhand" "Bazooka"
		SPRINGFIELD				: IS_WEAPON_ACTIVE "mainhand" "Springfield '03 Sniper"

		M1_GARAND				: IS_WEAPON_ACTIVE "mainhand" "M1 Garand"
	//	FRAG_GRENADE			: IS_WEAPON_ACTIVE "mainhand" "Frag Grenade"

		BAR					: IS_WEAPON_ACTIVE "mainhand" "BAR"
	//	COLT_45				: IS_WEAPON_ACTIVE "mainhand" "Colt 45"
		THOMPSON				: IS_WEAPON_ACTIVE "mainhand" "Thompson"

		//other
		STAND					: KILLED
		UNARMED					: default
	}
}

state STG44
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/mp44.tik"
	}

	states
	{
		STAND				: default
	}
}

state MP40
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/mp40.tik"
	}

	states
	{
		STAND				: default
	}
}

state PANZERSCHRECK
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/panzerschreck.tik"
	}

	states
	{
		STAND				: default
	}
}

state KAR98
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/kar98.tik"
	}

	states
	{
		STAND				: default
	}
}

state KAR98_SNIPER
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/KAR98sniper.tik"
	}

	states
	{
		STAND				: default
	}
}

state WALTHER_P38	
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/p38.tik"
	}

	states
	{
		STAND				: default
	}
}

state STIELHANDGRANATE
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/steilhandgranate.tik"
	}

	states
	{
		STAND				: default
	}
}


//Weapons all

state PISTOL_SILENCED				
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/silencedpistol.tik"
	}

	states
	{
		STAND				: default
	}
}

state SHOTGUN														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/shotgun.tik"
	}

	states
	{
		STAND				: default
	}
}


state UNARMED														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "UNARMED"
	}

	states
	{
		GET_WEAPON				: NEW_WEAPON ANIMDONE_TORSO
	}
}
state BINOCULARS														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/binoculars.tik"
	}

	states
	{
		STAND				: default
	}
}

//alies weapons

state BAZOOKA														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/bazooka.tik"
	}

	states
	{
		STAND				: default
	}
}

state SPRINGFIELD														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/springfield.tik"
	}

	states
	{
		STAND				: default
	}
}

state M1_GARAND														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/m1_garand.tik"
	}

	states
	{
		STAND				: default
	}
}

state FRAG_GRENADE														
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/m2frag_grenade.tik"
	}

	states
	{
		STAND				: default
	}
}

state BAR												
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/bar.tik"
	}

	states
	{
		STAND				: default
	}
}

state COLT_45									
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/colt45.tik"
	}

	states
	{
		STAND				: default
	}
}

state THOMPSON											
{
	entrycommands
	{
		exec weapon_limit/weaponis.scr "models/weapons/thompsonsmg.tik"
	}

	states
	{
		STAND				: default
	}
}

Code: Select all

//11/08/2005
// Removed weapon get class 
// added strings

main local.model:

	if(local.model=="UNARMED")
	{
		local.model = "models/weapons/unarmed.tik"
	}

	self.weapon = local.model
	self.DMweapon = local.model
	
	if(level.run["weapons-limiter"] != "1"){end}

	local.drop = waitexec global/settings.scr::getcmd "dropweapons"
	
	if(local.drop != "1")
	{
		self weaponcommand duel notdroppable
	}

	self resetstate

	if(local.model=="models/weapons/unarmed.tik")
	{
		end
	}

	for(local.i = 1 ; local.i <= game.limiter_weapons.size;local.i++)
	{
		local.weapon = waitthread get_weapontik game.limiter_weapons[local.i][1] game.limiter_weapons[local.i][2] 
		local.weaponname = game.limiter_weapons[local.i][1]::game.limiter_weapons[local.i][2] 

		if(local.model == local.weapon[1])
		{
			if(game.limiter_weapons[local.i][2] != "" )
			{

				if(game.game == "AA")
				{
					self take local.model
				}
				else
				{
					self takeall
					self waitexec weapon_limit/secondry_weapons.scr
				}

				self item local.weapon[2] 

				local.print = waitexec global/settings.scr::getcmd "swap-message"

				if(local.print == "1")
				{
					self iprint (game.weapons_strings[1][1] + local.weaponname[1] + game.weapons_strings[2][1] + local.weaponname[2] + game.weapons_strings[3][1]) 1
				}

				//local.weapon_class = waitthread get_weaponclass game.limiter_weapons[local.i][2]
				//self usestuff
				//self useweaponclass local.weapon_class

				self use local.weapon[2]
				end
			}
			else
			{
				local.amount = game.limiter_weapons[local.i][3]

				if(local.amount==""){end}

				local.amount = int local.amount

				if(local.amount==0)
				{

					local.print = waitexec global/settings.scr::getcmd "swap-message"

					/*
					// Dont think this will ever run
					//local.weapon_class = waitthread get_weaponclass game.limiter_weapons[local.i][1]
					if(local.weapon_class == "pistol" || local.weapon_class == "grenade")
					{
						self take local.model

						if(local.print == "1")
						{
							self iprint ("The admin has set that you are not allowed to use the " + local.weaponname[1]) 1
						}
					}
					else
					{
					*/

					if(local.print == "1")
					{
						self iprint (game.weapons_strings[4][1] + local.weaponname[1] + game.weapons_strings[5][1] ) 1
					}

					self thread newgun
					
					//}

					end
				}

				if(level.weapons_inuse[local.model]==NIL)
				{
					level.weapons_inuse[local.model]=0
				}

				level.weapons_inuse[local.model]++
	
				if(level.weapons_inuse[local.model] > local.amount)
				{
					self thread newgun
					self iprint (local.weaponname[1] + game.weapons_strings[6][1] + local.amount + game.weapons_strings[7][1]) 1
					
					self iprint game.weapons_strings[8][1]  1
					
					wait 1

					for(local.w=1;local.w <= game.limiter_weapons.size;local.w++)
					{
						local.weaponname = game.limiter_weapons[local.w][1] 

						if(game.limiter_weapons[local.w][3] != "")
						{
							local.num = int game.limiter_weapons[local.w][3]
			
							if(local.num != 0 )	
							{
								local.name = waitthread get_weapontik game.limiter_weapons[local.w][1] 

								local.say = 1

								if(level.weapons_inuse[local.name[1]] == NIL)
								{
									local.left = local.num 
								}
								else if(level.weapons_inuse[local.name[1]] < local.num)
								{
									local.left = local.num - level.weapons_inuse[local.name[1]]
								}
								else
								{
									local.say = 0
								}
								
								if(local.say == 1)
								{
									self iprint ( "* " + local.weaponname + " " + local.left + game.weapons_strings[9][1] ) 
									wait 1.5
								}
							}
						}
						else
						{
							self iprint ( "* " + local.weaponname ) 
							wait 1.5
						}
			
					}

					end
				}
			}					
		}	
	}
end

get_weapontik local.weapon_one local.weapon_two:
	
	if(level.weaponsinfo == NIL)
	{
		waitthread ( weaponsinfo + game.game )
	}

	for(local.i=1;local.i <= level.weaponsinfo.size;local.i++)
	{
		if(local.weapon_one == level.weaponsinfo[local.i] [2])
		{
			local.weapon_one  = level.weaponsinfo[local.i][1]
		}
		else if(local.weapon_two == level.weaponsinfo[local.i] [2])
		{
			local.weapon_two  = level.weaponsinfo[local.i][1]
		}
	}

end ( local.weapon_one::local.weapon_two )
/*
get_weaponcl/ss local.weapon:
	
	if(level.weaponsinfo == NIL)
	{
		waitthread ( weaponsinfo + game.game )
	}

	for(local.i=1;local.i <= level.weaponsinfo.size;local.i++)
	{
		if(local.weapon == level.weaponsinfo[local.i][2])
		{
			end level.weaponsinfo[local.i] [3]
		}
	}
end
*/

weaponsinfoAA:

	level.weaponsinfo = makearray			
		//Ally weapons									//name						//class								
		"models/weapons/springfield.tik"						"springfield '03 sniper"			"rifle"										
		"models/weapons/bar.tik"							"bar"						"mg"
		"models/weapons/thompsonsmg.tik"						"thompson"					"smg"
		"models/weapons/bazooka.tik"							"bazooka"					"heavy"	
		"models/weapons/m1_garand.tik"							"m1 garand"					"rifle"
		//Axis												
		"models/weapons/kar98.tik"							"kar98"						"rifle"	
		"models/weapons/KAR98sniper.tik"						"kar98 - sniper"				"rifle"	
		"models/weapons/mp40.tik"							"mp40"						"smg"
		"models/weapons/mp44.tik"							"mp44"						"mg"
		"models/weapons/panzerschreck.tik"						"panzerschreck"					"heavy"	
		//both						
		"models/weapons/shotgun.tik"							"shotgun"					"heavy"
	endarray

end

weaponsinfoBT:

	level.weaponsinfo = makearray	
		"models/weapons/bazooka.tik"							"bazooka"					"heavy"	
		"models/weapons/bar.tik"							"bar"						"mg"
		"models/weapons/DeLisle.tik"							"delisle"					"rifle"
		"models/weapons/enfield.tik"							"lee-enfield"					"rifle"
		"models/weapons/enfield_lite.tik"						"lee-enfield"					"rifle"
		"models/weapons/G43.tik"							"g 43"						"rifle"
		"models/weapons/Gr_W_MineDetector.tik"						"minensuchgerat"				"grenade"
		"models/weapons/It_W_Breda.tik"							"breda"						"mg"
		"models/weapons/It_W_Carcano.tik"						"carcano"					"rifle"	
		"models/weapons/It_W_Carcano_lite.tik"						"carcano"					"rifle"	
		"models/weapons/It_W_Moschetto.tik"						"moschetto"					"smg"
		"models/weapons/kar98.tik"							"mauser kar 98k"				"rifle"
		"models/weapons/KAR98sniper.tik"						"kar98 - sniper"				"rifle"
		"models/weapons/kar98_lite.tik"							"mauser kar 98k"				"rifle"
		"models/weapons/kar98_mortar.tik"						"gewehrgranate"					"rifle"
		"models/weapons/Mosin_Nagant_Rifle.tik"						"mosin nagant rifle"				"rifle"	
		"models/weapons/Mosin_Nagant_Rifle_lite.tik"					"mosin nagant rifle"				"rifle"	
		"models/weapons/mp40.tik"							"mp40"						"smg"
		"models/weapons/m1_garand.tik"							"m1 garand"					"rifle"
		"models/weapons/mp44.tik"							"mp44"						"mg"
		"models/weapons/m1_garand_lite.tik"						"m1 garand"					"rifle"
		"models/weapons/panzerschreck.tik"						"panzerschreck"					"heavy"
		"models/weapons/ppsh_smg.tik"							"ppsh smg"					"smg"
		"models/weapons/shotgun.tik"							"shotgun"					"heavy"
		"models/weapons/springfield.tik"						"springfield '03 sniper"			"rifle"	
		"models/weapons/sten.tik"							"sten mark ii"					"smg"
		"models/weapons/svt_rifle.tik"							"svt 40"					"rifle"
		"models/weapons/thompsonsmg.tik"						"thompson"					"smg"
		"models/weapons/Uk_W_L42A1.tik"							"enfield l42a1"					rifle
		"models/weapons/Uk_W_Piat.tik"							"piat"						"heavy"
		"models/weapons/Uk_W_Vickers.tik"						"vickers-berthier"				"mg"
		"models/weapons/US_W_MineDetector.tik"						"minedetector"					"grenade"	
	endarray
end

weaponsinfoSH:

	level.weaponsinfo = makearray			
		"models/weapons/bar.tik"							"bar"						"mg"
		"models/weapons/bazooka.tik"							"bazooka"					"heavy"
		"models/weapons/kar98.tik"							"kar98"						"rifle"
		"models/weapons/KAR98sniper.tik"						"kar98 - sniper"				"rifle"
		"models/weapons/m1_garand.tik"							"m1 garand"					"rifle"
		"models/weapons/mp40.tik"							"mp40"						"smg"
		"models/weapons/mp44.tik"							"mp44"						"mg"
		"models/weapons/panzerschreck.tik"						"panzerschreck"					"heavy"
		"models/weapons/shotgun.tik"							"shotgun"					"heavy"
		"models/weapons/springfield.tik"						"springfield '03 sniper"			"rifle"	
		"models/weapons/thompsonsmg.tik"						"thompson"					"smg"
		"models/weapons/enfield.tik"							"lee-enfield"					"rifle"		
		"models/weapons/G43.tik"							"g 43"						"rifle"	
		"models/weapons/Mosin_Nagant_Rifle.tik"						"mosin nagant rifle"				"rifle"	
		"models/weapons/ppsh_smg.tik"							"ppsh smg"					"smg"
		"models/weapons/sten.tik"							"sten mark ii"					"smg"
		"models/weapons/svt_rifle.tik"							"svt 40"					"rifle"	
		"models/weapons/kar98_mortar.tik"						"gewehrgranate"					"rifle"	
	endarray
end 

newgun:
	//local.dmteam= self.dmteam
	self primarydmweapon ""
	self spectator
	self stufftext "pushmenu SelectPrimaryWeapon"
	//self join_team local.dmteam
end



setup_stuff:

	local.weapons = makearray			
		//Ally weapons				
		"Springfield '03 Sniper"												
		"bar"						
		"Thompson"					
		"bazooka"					
		"m1_garand					
		//Axis														
		"kar98"						
		"KAR98 - Sniper"					
		"mp40"						
		"mp44"						
		"Panzerschreck"					
		//both						
		"shotgun"					
	endarray

	for(local.i=1;local.i <= local.weapons.size;local.i++)
	{
		local.name = local.weapons[local.i][1]
		level.weapons_inuse[local.name] = 0
	}

end
Force the get_weapon state whenever you need to check for the player's weapons.

Posted: Wed May 20, 2009 8:19 pm
by Rookie One.pl
$oldier Of Ra wrote:I was thinking you could surf to google, search it, download the AP menu mod and take a look for yourself but since it burns so many calories, I'll just post it:
Use http://lmgtfy.com next time. Usally gets the message across. :)