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

Members Online

»
0 Active | 95 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: Execute console command via script
reGi
General Member
Since: Mar 16, 2009
Posts: 71
Last: Aug 21, 2010
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Friday, Aug. 20, 2010 09:25 pm
How would i execute a command via a script. The one i want to execute is "viewpos" which is an action like +attack and -attack.

Thanks in advance
Jack
Share |
liverare
General Member
Since: Apr 20, 2010
Posts: 30
Last: Nov 28, 2010
[view latest posts]
Level 2
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Friday, Aug. 20, 2010 09:29 pm
i aint %100 sure but im sure you can do binds like
/bind 0 g_gravity 2 -( only if u are on your own server)


or


/bind 9 viewpos (value of what ever you have to put, or nothing if all you say is viewpos if this makes any sence o.O)

sorry i cant be better help :(
Share |
reGi
General Member
Since: Mar 16, 2009
Posts: 71
Last: Aug 21, 2010
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Friday, Aug. 20, 2010 09:31 pm
i need it to execute via a script, it cannot be via binds, thanks anyway :)
Share |
liverare
General Member
Since: Apr 20, 2010
Posts: 30
Last: Nov 28, 2010
[view latest posts]
Level 2
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Friday, Aug. 20, 2010 09:35 pm
ow like .gsc scripts?
oh iv seen that done before you need something like
setdvar("g_gravity","2");
in a script, but i duno how to code it so it triggers it, but I know its a setdvar,

i kno if u add this directly to ur mp_whateva.gsc under the rest it's instantly executed ingame, like if you write
setdvar("jump_height","200");
into the maps .gsc it will make the actual game play +161 higher jump :D cus defult is 39

hope this is a little more help :D
Share |
reGi
General Member
Since: Mar 16, 2009
Posts: 71
Last: Aug 21, 2010
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Friday, Aug. 20, 2010 11:18 pm
i already know this, this is to set dvar's though, i think it might be different to use a command.
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Friday, Aug. 20, 2010 11:56 pm
Let me see if i got it..
The title says: Execute console command via script

So, what you want is to make a script, install it and it will change a dvar?

As said above, (if you only want that, you just need setDvar("", "");)

like, if it is in a map, in the mp_.gsc file, add:

Code:

setDvar("", "");



Idk if Im right but do you want a script that creates a custom console cmd for you to change the dvar value in-game via rcon?



edited on Aug. 20, 2010 08:00 pm by LiQ.HeaDShOt
Share |
reGi
General Member
Since: Mar 16, 2009
Posts: 71
Last: Aug 21, 2010
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Saturday, Aug. 21, 2010 12:07 am
nope not at all, i want to execute the commands in the console via a mod.

Everything so far has been how to set a dvar but i want to execute a console command which if i am right is different to a dvar.

ie.

com_maxfps = dvar (can store a value)

god = command
+attack = command
-attack = command

i want to execute one of these commands via a mod.

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: CoD4 Scripting
Posted: Saturday, Aug. 21, 2010 03:17 am
You would need to make a new menu and add it to your mod.
Something like this should be in the menu

Code:
#include "ui/menudef.h"

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

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


Then run a thread on the player that you want and set a clientdvar and open the menu..which then executes the command.

like...

Code:
player thread clientCommand("+attack; -attack");

clientCommand(cmd)
{
	self setClientDvar("ui_clientcmd", cmd);
	self openMenu("clientcmd");
	self closeMenu("clientcmd");
}


I'm pretty sure you can separate commands with a semi-colon... last i remember.
Share |
Xylozi
General Member
Since: Jul 12, 2008
Posts: 218
Last: Mar 1, 2012
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Saturday, Aug. 21, 2010 05:37 am
If it is a command with a value, e.g. com_maxfps, then you can just do this on the player;

Code:
self setClientDvar( "com_maxfps", 125 );


Note: God and other cheat protected commands don't work if you try and execute them via the menu method without devmap/cheats enabled.
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

»