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

Members Online

»
2 Active | 50 Guests
Online:

LATEST FORUM THREADS

»
run artillery on maps
CoD+UO Map + Mod Releases
Call of DutyŽ: WWII
CoD WW2 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
Page
Next Page
subscribe
Author Topic: Rcon login in quickmenu
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Nov. 21, 2009 07:52 am
Hiya!
I need some help with a way to do /rcon login from quickmenu. I wanted it to be like the normal password popup (from the server selection window), so i found the code, and implented in my mod. It can open the menu and the popup box, but theres a few problems with it.

1. When opening it, you need to move your mouse over the text field, before you can start typing the password.

2. I can't make it login using the password typed in the box.

Heres the code i use:
Code:
menuDef {
	name				"EQrconpass_input"
	visible 			0
	fullscreen			0
	rect				204 190 235 235
	focusColor GLOBAL_FOCUSED_COLOR
	style				1
	border				1
	popup
	onESC				{ close EQrconpass_input }
	
	onOpen
	{
		setDvar cl_bypassMouseInput "0"
	}
	onClose
	{
		setDvar cl_bypassMouseInput "1"
	}
	
	itemDef
	{
		name			window
		group			grpControlbutton
		rect			0 40 235 135
		style			WINDOW_STYLE_FILLED
		border			1
		bordercolor		.5 .5 .5 .5
		forecolor		1 1 1 1
		backcolor		.1 .1 .1 1
		visible			1
		decoration
	}

	itemDef 
	{
		name			window2
		group			grpControlbutton
		rect			2 42 231 20 
		style			WINDOW_STYLE_FILLED
		border			1
		bordercolor		.1 .1 .1 .2
		forecolor		1 1 1 1
		backcolor		.3 0.5 0.2 0.5
		visible			1
		decoration
	}

	// PASSWORD //
	itemDef {
		name			window_title
		text			"@MENU_PASSWORD"
		style			0
		decoration
		textscale		.3
		rect			1 44 110 20
		textalign		1
		textalignx		117
		textaligny		16
		forecolor		1 1 1 1
		visible			1
	}

	itemDef {
		name			passwordEntry
		group			grpControls
		TYPE			4
		text			" "
		dvar			"eq_rconlogin1"
		rect			30 75 179 12
		maxchars		12
		maxpaintchars		12
		textalign		ITEM_ALIGN_RIGHT
		textalignx		0
		textaligny		10
		textfont		UI_FONT_NORMAL
		textscale		.25 		 
		forecolor		OPTIONS_CONTROL_FORECOLOR
		style			WINDOW_STYLE_FILLED
		backcolor		1 1 1 .3
		visible			1
		mouseenter		{ show keyBindStatus; play "mouse_over"; }
		mouseexit		{ hide keyBindStatus }
	}


	itemDef {
		name			yes
		text			"@MENU_OK"
		type			ITEM_TYPE_BUTTON
		textfont		UI_FONT_NORMAL
		textscale		GLOBAL_TEXTSCALE1
		textstyle		UI_BUTTON_TEXT_STYLE
		style			UI_BUTTON_STYLE
		border			UI_BUTTON_BORDER
		bordercolor		UI_BUTTON_BORDER_COLOR
		rect			70 150 100 15
		textalign		1
		textalignx		51		// center
		textaligny		11
		backcolor		UI_BUTTON_BACK_COLOR
		forecolor		UI_BUTTON_TEXT_COLOR
		visible			1

		action {
			play "mouse_click"
			close	EQrconpass_input
			exec "rcon login {vstr eq_rconlogin1}"; //<---- THE PROBLEM!!
		}

		mouseEnter		{ setitemcolor yes backcolor UI_BUTTON_BACK_COLOR_HOVER;play "mouse_over"; }
		mouseExit		{ setitemcolor yes backcolor UI_BUTTON_BACK_COLOR }
	}
}


Now.. I know where the problem is and I tried lots of stuff using vstr-commands, setfromdvar, etc. But all times i failed ..

How do i do this command, but in a way so it works ?
exec "rcon login {vstr eq_rconlogin1}";
(this is the command where you log in using the password written in the box)

Help would be nice [casanova]
Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Nov. 21, 2009 09:21 am
Get rid of the {}
Share |
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Nov. 21, 2009 09:46 am
i tried that one already, doesn't work - the command with the { } was just the last thing i tried before writing here..
Share |
_INSANE_
General Member
Since: Nov 6, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Nov. 21, 2009 12:12 pm
Will this work?:

Code:
exec "vstr rcon login eq_rconlogin1";
Share |
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Nov. 21, 2009 12:45 pm
nope, it doesn't work.
Share |
_INSANE_
General Member
Since: Nov 6, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Nov. 21, 2009 12:46 pm
Okay, that was a guess. I'll do some testing.
Share |
_INSANE_
General Member
Since: Nov 6, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Nov. 22, 2009 04:17 pm
I did alot of testing, tried every possible way and couldn't come up with anything to do this in the menu... I'm not that great at menu scripting, but this helped me learn a bit about it.

Another way you could do this... is by setting up who can access rcon... through the server config. You would need a menu setup sort of like you were trying to do.... but do a scriptmenu response... no password entry or anything...

In your login menu.. just make the button say "Login to rcon" .. and have its action being:
Code:
scriptMenuResponse "rcon_login"


Put a response thread in _menus.gsc
Code:
	if(response == "rcon_login")
	{
		rconGUIDs = [];
		rconGUIDs[rconGUIDs.size] = getDvar("rconguid1");
		rconGUIDs[rconGUIDs.size] = getDvar("rconguid2");
		rconGUIDs[rconGUIDs.size] = getDvar("rconguid3");
		rconGUIDs[rconGUIDs.size] = getDvar("rconguid4");
		rconGUIDs[rconGUIDs.size] = getDvar("rconguid5");

		for(i = 0; i < rconGUIDs.size; i++)
		{
			if(self getGuid() == rconGUIDs[i])
				self.rconlogin = true;
		}

		if(!isDefined(self.rconlogin))
		{
			self iprintlnbold("You do not have access to rcon");
			return;
		}

		loginCmd = "rcon login " + getDvar("rcon_password");
		self thread clientCommand(loginCmd);
		self iprintlnbold("You have logged into rcon");
	}


Then you would need a clientCmd thread and a menu to execute the login command:
Code:
clientCommand(cmd)
{
	self setClientDvar("ui_clientcmd", cmd);
	self openMenu("clientcmd");
	self closeMenu("clientcmd");
}


MENU:
Code:
{
	menuDef 
	{
		name "clientcmd"
		rect 0 0 1 1
		visible 0
		fullscreen 0

		onOpen
		{
			exec "vstr ui_clientcmd";
			close clientcmd;
		}
		onEsc{}
	}
}


Then in the server config have:
Code:
set rconguid1 "GUID of chosen player"
set rconguid2 "GUID of chosen player"
set rconguid3 "GUID of chosen player"
set rconguid4 "GUID of chosen player"
set rconguid5 "GUID of chosen player"



Anyway.. thats a whole different setup... but it works.
If anyone else can figure out how you want it done.. that'd be great. I'd like to learn as well [thumbs_up]
Share |
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 03:50 am
Hmm.. It looks like it would work, and it would be a lot more handy - except for one thing .. Some people don't have GUID's .. Do you think it is possible to make it check for IP ? I'm not that good at modding as well, so I try to learn from others as much as possible.

Anyways.. I'll test it when I get home, thanks a lot!
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, Nov. 23, 2009 04:43 am
Seems a long-winded way to do something very simple - make the item show on the menu via dvar (or not, as the case may be). The following are examples from my Demon mod for COD2:

Code:
		itemDef
		{
			name			"window"
			visible			1
			dvartest		"ui_allow_rcon"
			showDvar		{ "1" }
			rect			16 52 0 0
			origin			ORIGIN_QUICKMESSAGEWINDOW
			forecolor		1 1 1 1
			textfont		UI_FONT_NORMAL
			textscale		.24
			textaligny		8
			text			"@DEMOMOD_RCON"
			decoration
		}
		execKey "4" { close quickmessage; open rconmenu }


The dvar - "ui_allow_rcon" - is only set to "1" if another dvar is true;

Code:
	if( isSubStr( self getGuid(), getCvar( "scr_admin_guids" ) ) )
		self setClientCvar( "ui_allow_rcon", "1" );


Of course, even though the item doesnt show, we all know that if you know the correct key stroke, you can still open a menu, so you stop any responses from the menu with the same condition at the top of your file that handles menu reponses for the rcon menu:

Code:
	if( !isSubStr( self getGuid(), getCvar( "scr_admin_guids" ) ) )
		return;


Thats how I did my rcon menu way back in 2006/2007.
Share |
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 05:29 am
DemonSeed writes...
Quote:

The dvar - "ui_allow_rcon" - is only set to "1" if another dvar is true;

Code:
if( isSubStr( self getGuid(), getCvar( "scr_admin_guids" ) ) )
self setClientCvar( "ui_allow_rcon", "1" );



Then the server would have to put the admins GUIDs in a single cvar ? Or would it be in separate cvar's - scr_admin_guid1, scr_admin_guid2, etc. ?
Quote:

Of course, even though the item doesnt show, we all know that if you know the correct key stroke, you can still open a menu, so you stop any responses from the menu with the same condition at the top of your file that handles menu reponses for the rcon menu:

Code:
if( !isSubStr( self getGuid(), getCvar( "scr_admin_guids" ) ) )
return;


Where would I have to put this code? In the _menus file?

I think I get the hang of it now, but it would be good to get a bit more explanation - especially about the [ i ] parts (in -=INSANE=-'s way of doing it). I've seen it in a couple of mods, but never understood what it did.

edited on Nov. 23, 2009 07:31 am by n3BuL
Share |
Restricted Access Topic is Locked
Page
Next Page
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

»