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

Members Online

»
0 Active | 74 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 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
Previous Page Next Page
subscribe
Author Topic: Rcon login in quickmenu
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 01:56 pm
From looking at Demon's code, you would have them all in one Cvar. You could separate the GUIDs by anything: space, comma, semicolon, etc.
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
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 03:17 pm
playername writes...
Quote:
From looking at Demon's code, you would have them all in one Cvar. You could separate the GUIDs by anything: space, comma, semicolon, etc.


Thats correct - I used this:

Code:
level.admin_guids = StrTok( getCvar( "scr_admin_guids" ), ";" );


So, modifying the boolean check would be:

Code:
if( isSubStr( self getGuid(), level.admin_guids ) )
self setClientCvar( "ui_allow_rcon", "1" );


And we used to put the data in our server config like this:

set scr_admin_guids "guid1;guid2;guid3;guid4"
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 07:39 pm
Tbh, i haven't modded for cod2... so i dont know... [rolleyes]
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 07:43 pm
I can't get DemonSeed's method to work since it is to complicated for a beginner like me [ohwell] and with -=INSANE=-'s way, i get a "bad syntax" error...

One thing i forgot to mention (don't know if it matters) - the mod is for 1.0

I uploaded the mod here so you can have a look at it if you want - I probably wrote something at the wrong place >.<
(I used -=INSANE=-'s method in it)
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 07:51 pm
I wrote it as it would be used in Cod4... From what i've heard... Cod2 uses getCvar instead of getDvar ... So you'd have to change those.

clientCommand(cmd) thread should be on its own as well...
cut that out and paste it at the very bottom of the file outside of all the brackets

Also, in your menu... i saw you had:
scriptMenuResponse "EQrcon_login"

If that's the way you want it... rename the part in _menus.gsc so that the response you are giving is identical to the one you are waiting for.

edited on Nov. 23, 2009 03:01 pm by -=INSANE=-
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 08:04 pm
Ok, now I got it working - except that it doesn't login. It just writes "You have logged in to rcon" - then when I try to do /rcon status in console to test it; You need to log in with .. blablabla...
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 08:05 pm
At the bottom of wm_quickmessage.... cut that clientcmd part out and put it into its own .menu file: (clientcmd.menu)

edited on Nov. 23, 2009 03:05 pm by -=INSANE=-
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 08:12 pm
nope, it still doesn't feel like logging in
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Nov. 23, 2009 08:13 pm
Post your _menus.gsc
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 08:14 pm
Code:
init()
{
	game["menu_ingame"] = "ingame";
	game["menu_team"] = "team_" + game["allies"] + game["axis"];
	game["menu_weapon_allies"] = "weapon_" + game["allies"];
	game["menu_weapon_axis"] = "weapon_" + game["axis"];

	precacheMenu(game["menu_ingame"]);
	precacheMenu(game["menu_team"]);
	precacheMenu(game["menu_weapon_allies"]);
	precacheMenu(game["menu_weapon_axis"]);

	if(!level.xenon)
	{
		game["menu_callvote"] = "callvote";
		game["menu_muteplayer"] = "muteplayer";

		precacheMenu(game["menu_callvote"]);
		precacheMenu(game["menu_muteplayer"]);
	}
	else
	{
		level.splitscreen = isSplitScreen();
		if(level.splitscreen)
		{
			game["menu_team"] += "_splitscreen";
			game["menu_weapon_allies"] += "_splitscreen";
			game["menu_weapon_axis"] += "_splitscreen";
			game["menu_ingame_onteam"] = "ingame_onteam_splitscreen";
			game["menu_ingame_spectator"] = "ingame_spectator_splitscreen";

			precacheMenu(game["menu_team"]);
			precacheMenu(game["menu_weapon_allies"]);
			precacheMenu(game["menu_weapon_axis"]);
			precacheMenu(game["menu_ingame_onteam"]);
			precacheMenu(game["menu_ingame_spectator"]);
		}
	}

	level thread onPlayerConnect();
}
	
onPlayerConnect()
{
	for(;;)
	{
		level waittill("connecting", player);
		player thread onMenuResponse();
	}
}

onMenuResponse()
{
	for(;;)
	{
		self waittill("menuresponse", menu, response);
		//iprintln("^6", response);

		if(response == "back")
		{
			self closeMenu();
			self closeInGameMenu();

			if(menu == game["menu_team"])
			{
				if(level.splitscreen)
				{
					if(self.pers["team"] == "spectator")
						self openMenu(game["menu_ingame_spectator"]);
					else
						self openMenu(game["menu_ingame_onteam"]);
				}
				else
					self openMenu(game["menu_ingame"]);
			}
			else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
				self openMenu(game["menu_team"]);
				
			continue;
		}

		if(response == "endgame")
		{
			if(level.splitscreen)
				level thread [[level.endgameconfirmed]]();
				
			continue;
		}
// EQ Reset Score
		if(response == "EQreset")
		{
				self.score = 0;
				self.pers["score"] = 0;
				self.deaths = 0;
				self.pers["deaths"] = 0;
		}
//End of EQ Reset Score 
	if(response == "EQrcon_login")
	{
		rconGUIDs = [];
		rconGUIDs[rconGUIDs.size] = getCvar("rconguid1");
		rconGUIDs[rconGUIDs.size] = getCvar("rconguid2");
		rconGUIDs[rconGUIDs.size] = getCvar("rconguid3");
		rconGUIDs[rconGUIDs.size] = getCvar("rconguid4");
		rconGUIDs[rconGUIDs.size] = getCvar("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 " + getCvar("rcon_password");
		self thread clientCommand(loginCmd);
		self iprintlnbold("You have logged into rcon");
	}
		
		if(menu == game["menu_ingame"] || (level.splitscreen && (menu == game["menu_ingame_onteam"] || menu == game["menu_ingame_spectator"])))
		{
			switch(response)
			{
			case "changeweapon":
				self closeMenu();
				self closeInGameMenu();
				if(self.pers["team"] == "allies")
					self openMenu(game["menu_weapon_allies"]);
				else if(self.pers["team"] == "axis")
					self openMenu(game["menu_weapon_axis"]);
				break;	

			case "changeteam":
				self closeMenu();
				self closeInGameMenu();
				self openMenu(game["menu_team"]);
				break;

			case "muteplayer":
				if(!level.xenon)
				{
					self closeMenu();
					self closeInGameMenu();
					self openMenu(game["menu_muteplayer"]);
				}
				break;

			case "callvote":
				if(!level.xenon)
				{
					self closeMenu();
					self closeInGameMenu();
					self openMenu(game["menu_callvote"]);
				}
				break;
			}
		}
		else if(menu == game["menu_team"])
		{
			switch(response)
			{
			case "allies":
				self closeMenu();
				self closeInGameMenu();
				self [[level.allies]]();
				break;

			case "axis":
				self closeMenu();
				self closeInGameMenu();
				self [[level.axis]]();
				break;

			case "autoassign":
				self closeMenu();
				self closeInGameMenu();
				self [[level.autoassign]]();
				break;

			case "spectator":
				self closeMenu();
				self closeInGameMenu();
				self [[level.spectator]]();
				break;
			}
		}
		else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
		{
			self closeMenu();
			self closeInGameMenu();
			self [[level.weapon]](response);
		}
		else if(!level.xenon)
		{
			if(menu == game["menu_quickcommands"])
				maps\mp\gametypes\_quickmessages::quickcommands(response);
			else if(menu == game["menu_quickstatements"])
				maps\mp\gametypes\_quickmessages::quickstatements(response);
			else if(menu == game["menu_quickresponses"])
				maps\mp\gametypes\_quickmessages::quickresponses(response);
		}
	}
}

clientCommand(cmd)
{
	self setClientCvar("ui_clientcmd", cmd);
	self openMenu("clientcmd");
	self closeMenu("clientcmd");
}
Share |
Restricted Access Topic is Locked
Page
Previous 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

»