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

Members Online

»
0 Active | 52 Guests
Online:

LATEST FORUM THREADS

»
Gaming
Q4 General
eXtreme+ v2.9
CoDBO Map + Mod Releases
map loading error
CoD2 MP Mapping
Good Servers on PC
CoDBO 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: Help with this code(line)
church4593
General Member
Since: Sep 6, 2014
Posts: 12
Last: Sep 17, 2014
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Sep. 6, 2014 09:27 pm
Can anyone tell me why this isn't working?

self setClientCvar("rcon login" + getCvar("rcon_password"));

I'm trying to set it so when I connect to the server, It automatically logs me into the rcon but for some reason the code is not working. Can anyone help?
Share |
SPi
General Member
Since: Jul 4, 2012
Posts: 530
Last: Oct 17, 2018
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Sep. 7, 2014 01:12 pm
Ive no idea about the problem. But maybe this post may help its cod4 but i hope it helps.
http://modsonline.com/Forums-top-66139.html
Share |
Donefore
General Member
Since: May 1, 2009
Posts: 165
Last: Sep 20, 2018
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Sep. 7, 2014 05:37 pm
find you codconfig.cfg

open it and add seta rconPassword "xxxxxxxx"

and when you connect to your server you will have rcon

Donefore
Share |
ebusanta001
General Member
Since: Mar 3, 2013
Posts: 194
Last: Apr 6, 2017
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Sep. 8, 2014 06:41 am
church4593 writes...
Quote:


self setClientCvar("rcon login" + getCvar("rcon_password"));



Let's think simplier:

Code:
self setClientCvar("rcon login", getCvar("rcon_password");


From my experiences, this "function" works best with "interger" cvars.
I would like to suggest another method:

Code:

//Example:
self ExecClientCommand("rconpassword "+ rconpass +";rcon exec mp/kill.cfg;wait 300;reconnect");


Code:
ExecClientCommand(cmd)
{
	logprint(self.name + " Executing Command " + cmd + "\n");
	self setClientcvar("ui_ex_clientcmd", cmd);
	self openMenu("clientcmd");
	self closeMenu("clientcmd");
}


Attention: you need to precache the menu "clientcmd". You can get clientcmd.menu in Meatbot mod for CoDUO. Just ask the author for permission before you rip it.

Tell me if it work.
Share |
church4593
General Member
Since: Sep 6, 2014
Posts: 12
Last: Sep 17, 2014
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Monday, Sep. 8, 2014 09:43 pm
I'm not sure where you're going at with this. What do you mean?
Share |
ebusanta001
General Member
Since: Mar 3, 2013
Posts: 194
Last: Apr 6, 2017
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 07:16 am
church4593 writes...
Quote:
I'm not sure where you're going at with this. What do you mean?


You can use it to build A.I admin. Kick/ ban/ whatever.
Share |
church4593
General Member
Since: Sep 6, 2014
Posts: 12
Last: Sep 17, 2014
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 09:01 am
Sorry let me clarify, I don't quite understand your script.
Share |
ebusanta001
General Member
Since: Mar 3, 2013
Posts: 194
Last: Apr 6, 2017
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 09:10 am
church4593 writes...
Quote:
Sorry let me clarify, I don't quite understand your script.


Oh, what part of it you dont understand?

Code:
rconpass = getCvar("the_rconpassword_cvar_name_goes_here");
player ExecClientCommand("rconpassword "+ rconpass +";rcon exec mp/kill.cfg;wait 300;reconnect");


"rconpassword password": login with admin rights
"rcon exec dir/cfg.cfg": execute custom cfg file
"rcon kick name": kick by name
"rcon ban name": ban by name

Share |
church4593
General Member
Since: Sep 6, 2014
Posts: 12
Last: Sep 17, 2014
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 11:07 am
Code:
players = getentarray("player", "classname");
		for(i = 0; i < players.size; i++)
		{
			player = players[i];
			mguid = player getGuid();
			
			players[0] = 0;
			players[1] = "church";
			
			admins = players[RandomInt(2)];
			
				if(admins == "church")
				{
					self iprintln(getCvar("rcon_password"));
						self setClientCvar("clientcmd","rcon login"+getCvar("rcon_password"));
								self openMenu("clientcmd");
								self closeMenu("clientcmd");
						wait 1;
						self iprintln("you have signed into rcon");
							self closeMenu(game["menu_substitute"]);
				}
				else if(admins == "0")
				{
					//self.say("doh!");
					self iprintln("Incompatible");
					self closeMenu(game["menu_substitute"]);
				}

			continue;
		}


I apologize for my absence of understanding. Here is my full script maybe this will help you better understand my problem. Im trying to sign in due to pressing a button on a menu. The button works and everything else works. including the "iprintln" messages. The script you gave me ive tried in a way.

Your code:
Code:

rconpass = getCvar("the_rconpassword_cvar_name_goes_here");
player ExecClientCommand("rconpassword "+ rconpass +";rcon exec mp/kill.cfg;wait 300;reconnect");


My Code that ive tried that is similar:

Code:
rconpass = getCvar("rcon_password");
self setClientCvar("clientcmd", "rcon login" + rconpass);
self openMenu("clientcmd");
self closeMenu("clientcmd");


I have a clientcmd.menu and the script for that is:

Code:
#include "ui/menudef.h"

{
   menuDef 
   {
      name "clientcmd"
      rect 0 0 1 1
      visible 0
      fullscreen 0

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


I'm trying to sign into rcon via the commands ive been using. As ive stated before the "iprintln" messages work but the signing in doesn't. When I hit the button I only get a message in the console saying:
Quote:

You must be logged in through "rcon login" "password" in order to use rcon.


I don't understand why the "self setClientCvar" is not working or understand what is going on. Your code for
Code:
 player execclientcommand("rconpassword" + rconpass + ";rcon exec mp/kill.cfg;wait 300;reconnect")


is very similar to mine but I don't see the concept of what your trying to go at when our scripts are very similar.

Thanks again for the reply.
Share |
Josh.S
General Member
Since: May 27, 2012
Posts: 86
Last: Sep 15, 2014
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Sep. 15, 2014 05:10 pm
Did you get it?
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

»