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

Members Online

»
0 Active | 65 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
subscribe
Author Topic: Rcon Command Mod
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Feb. 2, 2009 08:57 pm
securiity writes...
Quote:
Interesting, Good for you teaching urself like that.

I have a question how does a simple script like the sayall script how does it do so much scripting seems so easy but its really not. I dont get how they do it but okk Lol uhm pedro thanks a lot for ur help wow you did a lot for me Uhm i could possibly get you a redirect . And I could also possibly get you a server for WaW for all ur mods and all . Do you have a Screen name or xfire or anything? also, Right now im working on hud messages like the extreme mod,, below the amo bar and the compass they have eXtreme + (version) and under the amo they have messages so yeah im working on that now.

addition - Wow you think they can make moding easyer right? im trying to get _exmod ex_messages and stuff with localized strings from the extreme mod and putting it in my mod but it dosent work.. youd think they can make it easyer haha
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Monday, Feb. 2, 2009 11:09 pm
The sayall feature is fairly basic from a scripting point of view because it relies largely on built in functionality.

It basically works as follows:

1. grab the cvar

val = getcvar( < name > )

2. check the cvar has content

if(val != "") // not a zero length string

3. if it doesn't print the message

iprintln(val)

iprintln and iprintlnbold are both built in functions for printing stuff to the screen. You can find a scripting reference page in the CoD2 mod tools documentation.

Other things are added like an infinite while loop so that the cvar can be checked repeatedly.

Although this is aimed at CoD4 / WaW, you might find the wiki of interest:

http://wiki.treyarch.com/wiki/Category:Scripting

-----------

Heh, thanks for the offer of the server and stuff, but my clan has a dedicated box. Its just the missing download redirect for CoD:WaW thats holding things up.

Oh, and I already added you to my xfire - |Brothers|-2Lt.Robinson




edited on Feb. 2, 2009 06:12 pm by Pedro699
Share |
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Feb. 3, 2009 12:20 am
ohhhh that was you!?!?!? oh okay great =) uhm if you dont mind maybe you can teach me some scripting over xfire and it will maybe be a lot easyer since its messaging instead of spending time here posting but yeah maybe you can really teach me some stuff because to be honest i dont understand scripting all that much i try but its hard for me kinda so... yeah we can talk on xfire?
Share |
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Feb. 3, 2009 03:37 am
I think i got a code for my admin can u check it?

- I found this code in a folder called svr from a zombie mod but i think part of the mod is server side and at the top of the script it said visit www.aigaming.net if u wanna look at it for me. And what would i name the loacalized string and wat wud i put in it but i think its a complete script

Code:

init()	// 'commands' are based on mod by NC-17, completely re-coded by me :)
{
	if (isDefined(game["gamestarted"]))	  // no changes between rounds..
	{
		if (isDefined(game["adminCommands"]) && game["adminCommands"])
			thread start();

		return;
	}

	if (getCvar("shortversion") == "1.41" || getCvar("shortversion") == "1.51")
		game["gameName"] = "uo";
	else
		game["gameName"] = "cod";

	game["adminCommands"] = svr\utils::cvardef(game["gameName"] + "_admin_commands", 0, 0, 5, "float");

	if (!game["adminCommands"])		return;
	if (game["adminCommands"] < 1)	game["adminCommands"] = 1;

	if (game["gameName"] == "cod")
	{
		game["adminLocalMsg"]	= svr\utils::cvardef("cod_admin_localized", 1, 0, 1, "int");
		game["adminEffect"]["mortar"][0]	= loadfx("fx/explosions/mortarExp_beach.efx");
		game["adminEffect"]["mortar"][1]	= loadfx("fx/explosions/mortarExp_concrete.efx");
		game["adminEffect"]["mortar"][2]	= loadfx("fx/explosions/mortarExp_dirt.efx");
		game["adminEffect"]["mortar"][3]	= loadfx("fx/explosions/mortarExp_mud.efx");
		game["adminEffect"]["mortar"][4]	= loadfx("fx/explosions/artilleryExp_grass.efx");
		game["adminEffect"]["explode"]	= loadfx("fx/explosions/default_explosion.efx");
		game["adminEffect"]["burn"]		= loadfx("fx/fire/character_torso_fire.efx");
		game["adminEffect"]["smoke"]		= loadfx("fx/smoke/grenade_smoke.efx");
		game["deadCowModel"] = "xmodel/cow_dead_1";
	}
	else
	{
		game["adminLocalMsg"]	= false;
		game["adminEffect"]["mortar"][0]	= loadfx("fx/impacts/newimps/minefield.efx");
		game["adminEffect"]["mortar"][1]	= loadfx("fx/impacts/newimps/minefield.efx");
		game["adminEffect"]["mortar"][2]	= loadfx("fx/impacts/dirthit_mortar.efx");
		game["adminEffect"]["mortar"][3]	= loadfx("fx/impacts/newimps/blast_gen3.efx");
		game["adminEffect"]["mortar"][4]	= loadfx("fx/impacts/newimps/dirthit_mortar2daymarked.efx");
		game["adminEffect"]["explode"]	= loadfx("fx/explosions/pathfinder_explosion.efx");
		game["adminEffect"]["smoke"]		= loadfx("fx/tagged/flameout.efx");
		game["adminEffect"]["burn"]		= loadfx("fx/fire/fireheavysmoke.efx");
		game["deadCowModel"] = "xmodel/cow_dead";
		precachemodel("xmodel/cow_standing");	// standing cow for UO only..
	}

	precachemodel(game["deadCowModel"]);

	thread start();
}

start()
{
	level endon("killModThread");
	level endon("killAdminCmd");

	for (;;)
	{
		wait game["adminCommands"];

		burn		= getCvar("burn");
		cow		= getCvar("cow");
		disarm	= getCvar("disarm");
		explode	= getCvar("explode");
		kill		= getCvar("kill");
		lock		= getCvar("lock");
		unlock	= getCvar("unlock");
		mortar	= getCvar("mortar");

		wait .20;

		tospec	= getCvar("tospec");
		swapteam	= getCvar("swapteam");
		say		= getCvar("say");
		saybold	= getCvar("saybold");

		wait .20;

		if (say != "")			thread sayMsg(say, false, "say");
		else if (saybold != "")		thread sayMsg(saybold, true, "saybold");
		else if (tospec != "")		thread getPlayers(tospec, "tospec");
		else if (swapteam != "")	thread getPlayers(swapteam, "swapteam");
		else if (burn != "")		thread getPlayers(burn, "burn");
		else if (cow != "")		thread getPlayers(cow, "cow");
		else if (disarm != "")		thread getPlayers(disarm, "disarm");
		else if (explode != "")		thread getPlayers(explode, "explode");
		else if (kill != "")		thread getPlayers(kill, "kill");
		else if (lock != "")		thread getPlayers(lock, "lock");
		else if (unlock != "")		thread getPlayers(unlock, "unlock");
		else if (mortar != "")		thread getPlayers(mortar, "mortar");
	}
}

getPlayers(_v, _c)
{
	if (isDefined(level.inGetPlayers))
		return;
	level.inGetPlayers = true;

	_t = undefined;

	if (_v == "all" || ((_v == "allies" || _v == "axis") && !(_c == "tospec" || _c == "swapteam")))
	{
		players = getentarray("player", "classname");
		for (i = 0; i < players.size; i++)
		{
			_p = players[i];
			_t = _p svr\utils::getTeam();

			if (isDefined(_t))
			{
				if (isAlive(_p) && _p.sessionstate == "playing" && _v == "all")
					_p threadCmd(_c, true);
				else if (isAlive(_p) && _p.sessionstate == "playing" && _v == _t)
					_p threadCmd(_c, false);
			}
		}
	}
	else if (_v.size <= 2)	   // maximum player slots is only 2 digits..
	{
		for (i = 0; i < _v.size; i++)
		{
			if (!svr\utils::isNumeric(_v[i]))	// prevent k3#a8p as input..
			{
				setCvar(_c, "");
				level.inGetPlayers = undefined;
				return;
			}
		}

		_i = getcvarint(_c);

		players = getentarray("player", "classname");
		for (i = 0; i < players.size; i++)
		{
			_p = players[i];
			_e = _p getEntityNumber();

			if (isAlive(_p) && _p.sessionstate == "playing" && (_e == _i))
				_p threadCmd(_c, false);
		}
	}

	setCvar(_c, "");
	level.inGetPlayers = undefined;

	return;
}

threadCmd(cmd, all)
{
	if (cmd == "tospec")		self thread tospec(all);
	else if (cmd == "swapteam")	self thread swapteam(all);
	else if (cmd == "burn")		self thread burn();
	else if (cmd == "cow")		self thread cow();
	else if (cmd == "disarm")	self thread disarm();
	else if (cmd == "explode")	self thread explode();
	else if (cmd == "kill")		self thread kill();
	else if (cmd == "lock")		self thread lock(true);
	else if (cmd == "unlock")	self thread lock(false);
	else if (cmd == "mortar")	self thread mortar();
}

burn(noMsg)
{
	if (!isPlayer(self) && !isAlive(self))
		return;

	if (!isDefined(noMsg))
		self thread printMsg("burn", &"ADMIN_BURN");

	self.burnedout = false;
	count = 0;
	self.health = 100;
	self thread burnDmg();

	while (self.burnedout == false)
	{
		if (count == 0)
		{
			count = 2.5;
			self thread painSounds();
		}
		else
			count -= .10;

		playfx(game["adminEffect"]["burn"], self.origin);
		wait .05;
		if (game["gameName"] != "uo")
			playfx(game["adminEffect"]["burn"], self.origin);
		wait .05;
	}
	self notify("killTheFlame");

	return;
}

burnDmg()
{
	self endon("killTheFlame");

	wait 8;
	self.burnedout = true;

	if (isPlayer(self) && isAlive(self))
	{
		playfx(game["adminEffect"]["smoke"], self.origin);
		self suicide();
	}

	return;
}

cow()
{
	self endon("killTheFlame");

	self thread printMsg("cow", &"ADMIN_COW");

	if (game["gameName"] == "uo")
		self setmodel("xmodel/cow_standing");

	self thread burn(true);
	wait 7.5;
	self setmodel(game["deadCowModel"]);

	return;
}

disarm()
{
	_d = svr\utils::cvardef(game["gameName"] + "_disarm_player_time", 10, 0, 60, "int");
	_c = 0;

	slot = [];
	slot[0] = "primary";
	slot[1] = "primaryb";

	if (game["gameName"] == "uo")
	{
		slot[2] = "pistol";
		slot[3] = "grenade";
		slot[4] = "smokegrenade";
		slot[5] = "satchel";
		slot[6] = "binocular";
	}

	if (!isPlayer(self) && !isAlive(self))
		return;

	self thread printMsg("disarm", &"ADMIN_DISARM");

	while (isAlive(self) && self.sessionstate == "playing" && _c < _d)
	{
		_a = self.angles;

		for (i = 0; i < slot.size; i++)
		{
			_w = self getWeaponSlotWeapon(slot[i]);

			if (_w != "none")
				self dropItem(_w);

			self.angles = _a + (0,randomInt(30),0);
		}

		_c += .50;
		wait .50;
	}

	return;
}

explode()
{
	if (isPlayer(self) && isAlive(self))
	{
		playfx(game["adminEffect"]["explode"], self.origin);
		wait .10;
		self painSounds();
		self suicide();
		self thread printMsg("explode", &"ADMIN_EXPLODE");
	}

	return;
}

kill()
{
	if (isPlayer(self) && isAlive(self))
	{
		self painSounds();
		self suicide();
		self thread printMsg("kill", &"ADMIN_KILL");
	}

	return;
}

lock(lock)
{
	self endon("disconnect");

	if (lock)
	{
		_d = svr\utils::cvardef(game["gameName"] + "_lock_player_time", 10, 0, 60, "int");

		if (!isPlayer(self) || !isAlive(self))
			return;

		self.anchor = spawn("script_origin", self.origin);
		self linkTo(self.anchor);
		self disableWeapon();
		self thread printMsg("lock", &"ADMIN_LOCK");
		self thread shutMenu(_d);
		wait _d;

		if (!isDefined(self) || !isDefined(self.anchor))
			return;

		self unlink();
		self.anchor delete();
		self enableWeapon();
		self thread printMsg("unlock", &"ADMIN_UNLOCK");
	}
	else
	{
		if (!isDefined(self) || !isDefined(self.anchor))
			return;

		self unlink();
		self.anchor delete();
		self enableWeapon();
		self thread printMsg("unlock", &"ADMIN_UNLOCK");
	}

	return;
}

mortar()
{
	self endon("killed_player");

	if (!isDefined(self) || !isAlive(self))
		return;

	self thread printMsg("mortar", &"ADMIN_MORTAR");
	wait 1;

	self.health = 100;

	self thread playSoundAtLocation("mortar_incoming2", self.origin, 1);
	wait .75;

	while (isPlayer(self) && isAlive(self) && self.sessionstate == "playing")
	{
		target = self.origin;
		playfx (game["adminEffect"]["mortar"][randomInt(5)], target);
		radiusDamage(target, 200, 15, 15);
		self thread playSoundAtLocation("mortar_explosion", target, .1 );

		if (self.health < 35)
			self setClientCvar("cl_stance", 2);	   // for uo

		earthquake(0.3, 3, target, 850);
		wait 2;
	}

	return;
}

swapteam(all)
{
	_g = getcvar("g_gametype");
	_t = undefined;
	_l = undefined;

	if (self.pers["team"] == "axis")
	{
		_t = "allies";
		_l = (&"ADMIN_ALLIES");
	}
	else if (self.pers["team"] == "allies")
	{
		_t = "axis";
		_l = (&"ADMIN_AXIS");
	}

	if (all)
	{
		if (game["adminLocalMsg"])
			self iprintlnbold(&"ADMIN_SWAPTEAMS");
		else
			self iprintlnbold("^3Swapping Allies-to-Axis, Axis-to-Allies^7");
	}
	else
	{
		if (game["adminLocalMsg"])
			self iprintlnbold(&"ADMIN_MOVING", _l);
		else
			self iprintlnbold("^3You are being moved to " + _t + "^7");
	}
	wait 2.5;

	if (self.sessionstate == "playing")
	{
		self.autobalance = true;			// for uo
		self.switching_teams = true;			// for cod-2
		self.joining_team = _t;				// for cod-2
		self.leaving_team = self.pers["team"];	// for cod-2
		self suicide();
	}

	self notify("end_respawn");
	self.pers["team"] = _t;

	if (game["gameName"] == "uo")
		self.pers["teamTime"] = (gettime() / 1000);

	self.pers["weapon"] = undefined;
	self.pers["weapon1"] = undefined;
	self.pers["weapon2"] = undefined;
	self.pers["spawnweapon"] = undefined;
	self.pers["savedmodel"] = undefined;
	self.nextroundweapon = undefined;

	// this function is different, depending on uo/cod-2
	if (game["gameName"] == "uo" && (_g == "hq" || _g == "re" || _g == "sd"))
		svr\utils::specPermissions();

	self setClientCvar("ui_weapontab", "1");			// for uo
	self setClientCvar("ui_allow_weaponchange", "1");	// for cod-2
	self setClientCvar("g_scriptMainMenu", game["menu_weapon_" + _t]);
	self openMenu(game["menu_weapon_" + _t]);

	if (!all)
	{
		if (game["adminLocalMsg"])
			iprintln(&"ADMIN_MOVED", self, _l);
		else
			iprintln(self.name + "^3 was moved to " + _t + "^7");
	}

	return;
}

toSpec(all)
{
	_l = undefined;

	if (game["adminLocalMsg"])
	{
		_l = (&"ADMIN_SPEC");
		self iprintlnbold(&"ADMIN_MOVING", _l);
	}
	else
		self iprintlnbold("^3You are being moved to Spectator^7");

	wait 1;

	self closeMenu();

	// this function is different, depending on uo/cod-2
	self svr\utils::spawnSpectator();

	if (!isDefined(level.noGtSupport) && !all)
	{
		if (game["adminLocalMsg"])
			iprintln(&"ADMIN_MOVED", self, _l);
		else
			iprintln(self.name + "^3 was moved to Spectator^7");
	}

	return;
}

sayMsg(_m, _b, _c)	// message, bold, cvar
{
	setCvar(_c, "");

	if (_b)
	{
		iprintlnbold(_m + "^7");

		_s = svr\utils::cvardef(game["gameName"] + "_admin_msg_scroll", 0, 0, 6, "float");

		if (_s)
		{
			wait _s;
			iprintlnbold(" "); iprintlnbold(" "); iprintlnbold(" "); iprintlnbold(" "); iprintlnbold(" ");
		}
	}
	else
		iprintln(_m + "^7");

	return;
}

printMsg(cmd, loc)
{
	if (game["adminLocalMsg"] && isDefined(loc))
		_m = loc;
	else
		_m = svr\utils::cvardef(game["gameName"] + "_admin_msg_" + cmd, "", "", "", "string");

	if (isDefined(_m))
	{
		_a = svr\utils::cvardef(game["gameName"] + "_admin_msg_area", 1, 1, 2, "int");

		if (_a == 1)	self iprintln(_m);
		else			self iprintlnbold(_m);
	}

	return;
}

PlaySoundAtLocation(sound, location, iTime)
{
	org = spawn("script_model", location);
	wait 0.05;
	org show();
	org playSound(sound);
	wait iTime;
	org delete();

	return;
}

painSounds()
{
	_t = self svr\utils::getTeam();
	if (!isDefined(_t))
		return;

	if (_t == "axis")
		_n = "german_1";
	else
		_n = "american_1";

	_s = "generic_pain_" + _n;
	self playSound(_s);

	return;
}

shutMenu(_d)
{
	_c = 0;

	while (isPlayer(self) && isAlive(self) && self.sessionstate == "playing")
	{
		self closeMenu();
		self.health = 100;

		if (_c < _d)	_c += 0.10;
		else			break;

		wait .10;
	}

	return;
}


edited on Feb. 2, 2009 10:47 pm by securiity
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Tuesday, Feb. 3, 2009 01:23 pm
I don't know if it has missing bits as I haven't had a full look through it.

The first thing I'd point out is that its designed for CoD1 and UO - you'll have to modify the fx and models to match those in CoD2.

Easiest thing to do is to include it in your mod and thread the init function.
Share |
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Feb. 3, 2009 08:31 pm
ok thanks
Share |
Garthogg
General Member
Since: Jan 29, 2008
Posts: 21
Last: Feb 6, 2009
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 09:07 pm
I prefer this one[wink]

Awe v3.0 beta
Share |
Restricted Access Topic is Locked
Page
Previous 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

»