Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 8 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Can somebody help?
Dark323
General Member
Since: Jul 11, 2009
Posts: 2
Last: Aug 2, 2010
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Monday, Aug. 2, 2010 12:45 am
hey im working on a mod and im trying to make this script find out what weapon i picked, i have this in my .menu scriptMenuResponse "thompson_mp";

then in my menus.gsc i have

Code:
if(menu == game["menu_automatics1"] || menu == game["menu_semiautomatics1"] || menu == game["menu_lightmachineguns1"] || menu == game["menu_rifles1"] || menu == game["menu_shotguns1"])
			self thread maps\mp\gametypes\_weaponsystem::setWeaponMenu(response);


then in my setWeaponMenu(response) i have

Code:
setWeaponMenu(response)
{
	for(i=0; i <level.weaponnames.size; i++)
	{
		if(response == level.weaponnames[i])
		{
			self iprintlnbold("working");
		}
		else
		{
			self iprintlnbold("notworking");
		}
	}
}


but its playing the test2notworking... why is it saying my response isnt any of the weapon names? any ideas?
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Aug. 2, 2010 07:34 am
The first part of your code is correct, its the second part that is causing the problem. There is no point transferring an argument to another function if you're not going to use it. In this case, you transferred "response" to the second function, but then you completely abandon it and start using level.weaponnames.

Try this instread:

Code:
setWeaponMenu(response)
{
	switch( response )
	{
		case "thompson_mp":
			self iprintlnBold( "working" );
			break;
	}
}


Add a case for each of your weapons, then do with it as you will.

edited on Aug. 2, 2010 03:34 am by DemonSeed
Share |
Dark323
General Member
Since: Jul 11, 2009
Posts: 2
Last: Aug 2, 2010
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Monday, Aug. 2, 2010 06:46 pm
thank you it works, the reason i tryed the other method is so i didnt have to go threw ALL those cases to make my life easyer but i guess ill use this way thank you.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»