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

Members Online

»
0 Active | 63 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Menu response and dvar values
Phl3x_
General Member
Since: Jun 4, 2011
Posts: 19
Last: Jun 14, 2012
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Monday, Aug. 8, 2011 11:35 am
Hello,

I made a small menu which, when it opens, I want it to send a dvar value to the script. I tried:

Code:
onOpen
{
        scriptMenuResponse dvarString( com_maxfps );
        close fps;
}


But I had no luck. I even tried using "#define FPS dvarString( com_maxfps );" but I still got the same result. The response was simply the name of the function 'dvarString'.

I'd appreciate any help,

thanks
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Monday, Aug. 8, 2011 11:59 am
It is not possible to get clientside cvar/dvars
Share |
Phl3x_
General Member
Since: Jun 4, 2011
Posts: 19
Last: Jun 14, 2012
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Tuesday, Aug. 9, 2011 05:59 am
Ah ok, thanks for the reply.

Is there any way to use 'if' statements in menu scripting? I know you can in black ops, but I don't know about cod4. I just want something like:

Code:
if( dvarInt( com_maxfps ) > 250 )
{
    scriptMenuResponse "fps_too_high";
}


Thanks
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Tuesday, Aug. 9, 2011 08:37 am
Use dvartest.
Share |
Opel
General Member
Since: Dec 18, 2008
Posts: 21
Last: Sep 4, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Tuesday, Aug. 9, 2011 09:22 am
IzNoGoD writes...
Quote:
It is not possible to get clientside cvar/dvars


http://www.itsmods.com/forum/Thread-getting-a-clientdvar.html

I have not tried this but someone made a tutorial about getting clientside dvars. It is for blackops but it looks like it would work for cod4 and others.
Share |
Phl3x_
General Member
Since: Jun 4, 2011
Posts: 19
Last: Jun 14, 2012
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Tuesday, Aug. 9, 2011 12:07 pm
@Opel, thanks for the tutorial, but unfortunately it doesn't work. The response from the menu is just "(dvarString((dvarstring(getting_dvar))))". I don't think functions work within strings :S

@IzNoGoD, interesting... what's the right syntax for using that?

Thanks both of you :)
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Tuesday, Aug. 9, 2011 12:27 pm
textscale GLOBAL_TEXT_SIZE
dvartest "dvar to test goes here"
showDvar { "value on which to show the item" }
textaligny 20

So, like:
textscale GLOBAL_TEXT_SIZE
dvartest "flashbangs"
showDvar { "1" }
textaligny 20
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Aug. 9, 2011 12:40 pm
you can do more with dvar's on a menu-file

1st like iznogod showed (it will show the string if the dvar is "1" ( you can use showDvar & hideDvar ) )
Code:
		itemDef
		{
			name			"login"
			visible		1
			rect			0 0 95 24
			forecolor		.96 .66 .04 .9
			type 			ITEM_TYPE_BUTTON
			text			"@ZOM_UI_LOGIN_CONTINUE"
			textfont		UI_FONT_NORMAL
			textscale		.5
			textaligny		20
			dvartest		"ui_login_status"
			showDvar		
			{ 
				"0";
				"1";
			}
		}

2nd show the text what is in the dvar (instead of "text" use "dvar" to show it in the menu)
Code:
		itemDef
		{
			name			"login_password"
			visible		1
			rect			110 20 180 24
			origin		ORIGIN_PANEL
			type 			ITEM_TYPE_BUTTON
			dvar			"ui_login_password"
			textfont		UI_FONT_NORMAL
			textscale		.35
			textaligny		20
			textstyle		ITEM_TEXTSTYLE_SHADOWED
		}

3rd multi menu (it prints you the text and next to the text the string depending on the dvar)
Code:
		itemDef
		{
			name			"login_status"
			visible		1
			rect			0 0 128 24
			origin		ORIGIN_LOGIN_STATUS
			forecolor		GLOBAL_UNFOCUSED_COLOR
			type			ITEM_TYPE_MULTI
			text			"@ZOM_UI_LOGIN_STATUS"
			textfont		UI_FONT_NORMAL
			textscale		GLOBAL_TEXT_SIZE
			textstyle		ITEM_TEXTSTYLE_SHADOWED
			textalign		ITEM_ALIGN_RIGHT
			textaligny		20
			decoration
			dvar			"ui_login_status"
			dvarFloatList	
			{ 
				"@ZOM_UI_LOGIN_LOGGED_IN" 			0
				"@ZOM_UI_LOGIN_LOGGED_IN_REGISTERED" 	1
				"@ZOM_UI_LOGIN_NOT_LOGGED_IN" 		2
				"@ZOM_UI_LOGIN_NOT_LOGGED_IN_GUID" 		3
				"@ZOM_UI_LOGIN_NOT_LOGGED_IN_USERNAME" 	4
				"@ZOM_UI_LOGIN_NOT_LOGGED_IN_PASSWORD" 	5
				"@ZOM_UI_LOGIN_NOT_LOGGED_IN_REGISTER" 	6
			}
		}

(the multimenu does only work with dvarFLOATlist, INT, BOOL, STRING isnt supported on cod2, might be on cod4)
Share |
Phl3x_
General Member
Since: Jun 4, 2011
Posts: 19
Last: Jun 14, 2012
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Thursday, Aug. 11, 2011 11:18 am
Cheers for the info guys, although I'm not entirely sure how to implement your suggestions. I am looking to be able to get the value of "com_maxfps" and if it's greater than 250, I want to set it back to 250. Just like promod, except it sets their FPS back. Is there a way I can check if the value is greater than 250 and then send a menu response to the script indicating so?

Thanks guys
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Thursday, Aug. 11, 2011 01:49 pm
guess not possible, you might use punkbuster or 3rd party program
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»