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: Creating Custom Console Command
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Tuesday, Aug. 3, 2010 09:38 pm
Hi.
Another topic asking for help ^^

What's the deal: I have a server with a Sniper Only mod. Actually it's pretty simple cuz it just won't allow you to choose any weapon but snipers.

My doubt is: Is it possible to create custom console commands? is there a script to do that?

What I need: a script that allows the creation of custom commands for Cod4 console.

like iPrintLnBold ("msg") = scr_say "msg"
is it possible?

Thx for your help.
^^

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: Wednesday, Aug. 4, 2010 06:41 am
Here is an example on how to use custom dvars:

Code:

SetupDvars()
{
	setDvar( "scr_msg", "" );
	
	while(1)
	{
		if( getDvar( "scr_msg" ) != "" )
			thread PrintMessage();
			
		wait 0.05;
	}
}

PrintMessage()
{
	message = getDvar( "scr_msg" );
	setDvar( "scr_msg", "" );
	
	iPrintLnBold( message );
}
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Wednesday, Aug. 4, 2010 11:46 am
Xylozi writes...
Quote:
Here is an example on how to use custom dvars:

Code:

SetupDvars()
{
	setDvar( "scr_msg", "" );
	
	while(1)
	{
		if( getDvar( "scr_msg" ) != "" )
			thread PrintMessage();
			
		wait 0.05;
	}
}

PrintMessage()
{
	message = getDvar( "scr_msg" );
	setDvar( "scr_msg", "" );
	
	iPrintLnBold( message );
}


OMG! Do you have xfire? Need to talk with you!
add me: callofduty4hunter

Question: How to install? Save it in .gsc of course but do I need to edit globallogic? if yes, plz tell me which line to find and what line to add :D

Thank You
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: Wednesday, Aug. 4, 2010 01:12 pm
To implement it into a server without re-compiling the mod.ff, you'll need to make a new IWD file. However first get the _killcam.gsc file, replace this:

Code:
init()
{
	precacheString(&"PLATFORM_PRESS_TO_SKIP");
	precacheString(&"PLATFORM_PRESS_TO_RESPAWN");
	precacheShader("white");
	
	level.killcam = maps\mp\gametypes\_tweakables::getTweakableValue( "game", "allowkillcam" );
	
	if( level.killcam )
		setArchive(true);
}


With this:

Code:
init()
{
	precacheString(&"PLATFORM_PRESS_TO_SKIP");
	precacheString(&"PLATFORM_PRESS_TO_RESPAWN");
	precacheShader("white");
	
	level.killcam = maps\mp\gametypes\_tweakables::getTweakableValue( "game", "allowkillcam" );
	
	thread maps\mp\gametypes\_custom::setupDvars();
	
	if( level.killcam )
		setArchive(true);
}


Now, make the folder structure for the new IWD file, which is:

Code:
maps
	mp 
		gametypes
			_killcam.gsc
			_custom.gsc //This is the custom file


Select the maps folder, and create an Archive (requires a compression program). Pick .ZIP and then type in the entry box:

Code:
z_svr_custom.iwd


Upload this into the same folder as the mod.ff, and it will overwrite the _killcam.gsc in the mod.ff with your new one, and include your new .GSC file.

If you don't think you can do the method above (reference for others if interested), then I did it for you here: http://www.fpsextreme.com/cod4/LiQ.HeaDShOt.zip

edited on Aug. 4, 2010 09:12 am by Xylozi
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Wednesday, Aug. 4, 2010 02:00 pm
Xylozi writes...
Quote:
Here is an example on how to use custom dvars:

Code:

SetupDvars()
{
	setDvar( "scr_msg", "" );
	
	while(1)
	{
		if( getDvar( "scr_msg" ) != "" )
			thread PrintMessage();
			
		wait 0.05;
	}
}

PrintMessage()
{
	message = getDvar( "scr_msg" );
	setDvar( "scr_msg", "" );
	
	iPrintLnBold( message );
}


Hmm. Thx! :D
Check your xfire because im going to talk with u :D
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Monday, Aug. 16, 2010 05:39 pm
Hi
When i try to install the script that you gave me, i have the download loop even when the files are 100% the same.

What should I do??
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

»