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

Members Online

»
0 Active | 77 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
Next Page
subscribe
Author Topic: scripting kill triggers/anti-exploits
msto
General Member
Since: Aug 17, 2005
Posts: 17
Last: Jan 24, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 09:37 am
i remember that before the patch was out there was an anti-exploit iwd file for dawnville that killed you if u used the exploit.
just wondering if anyone could talk me through how to make one, as there are several custom maps i would like to put on my server, but there are exploits in them[mad]
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 12:44 pm
You will have to do the same thing IW did when they patched to 1.2 to remove exploits.

It involves modifying the map's main gsc file. Take a look at the GSC files for the patch maps in iw15\maps\mp:

One example (mp_burgundy.gsc), I copy in the complete GSC at the bottom of this thread so you can read online.

The key parts what IW did is the following:

Code:
	level.killtriggers[0] = spawnstruct();
	level.killtriggers[0].origin = (96, 2296, 168);
	level.killtriggers[0].radius = 165;
	level.killtriggers[0].height = 170;


One set of these 4 lines for each zone that you want to control. Obviously for each new one you would increase the index of 0 to 1,2,3... and so on.

There is a command that allows you to display the current position of a player so you can get the location you need for the origin part, but I cannot remember it at the moment.

Finally at the end of the setup of the killtriggers a call to start some thread to watch these zones for players:

Code:
	thread maps\mp\_killtriggers::init();


The complete code from IW for reference:
Code:
main()
{
	maps\mp\mp_burgundy_fx::main();
	maps\mp\_load::main();

	setExpFog(0.00015, 0.7, 0.85, 1.0, 0);
	ambientPlay("ambient_france");

	game["allies"] = "american";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["american_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";

	setcvar("r_glowbloomintensity0","1");
	setcvar("r_glowbloomintensity1","1");
	setcvar("r_glowskybleedintensity0",".25");

	if((getcvar("g_gametype") == "hq"))
	{
		level.radio = [];
		level.radio[0] = spawn("script_model", (768.8, 58.1, 83.1));
		level.radio[0].angles = (0, 295, 0);

		level.radio[1] = spawn("script_model", (428.8, 994.9, 0.1));
		level.radio[1].angles = (0, 70, 0);

		level.radio[2] = spawn("script_model", (1978.9, 2085.63, 0.864801));
		level.radio[2].angles = (0.851713, 120.007, 0.491852);

		level.radio[3] = spawn("script_model", (1030.3, 442.3, 151.9));
		level.radio[3].angles = (0, 13, 0);

		level.radio[4] = spawn("script_model", (226.6, 2515.6, 56));
		level.radio[4].angles = (0, 126, 0);

		level.radio[5] = spawn("script_model", (-415.364, 2474.61, -1.73221));
		level.radio[5].angles = (355.978, 180, -1.30946);
	}

	level.killtriggers[0] = spawnstruct();
	level.killtriggers[0].origin = (96, 2296, 168);
	level.killtriggers[0].radius = 165;
	level.killtriggers[0].height = 170;

	level.killtriggers[1] = spawnstruct();
	level.killtriggers[1].origin = (88, 2696, 200);
	level.killtriggers[1].radius = 165;
	level.killtriggers[1].height = 140;

	level.killtriggers[2] = spawnstruct();
	level.killtriggers[2].origin = (552, 2686, 200);
	level.killtriggers[2].radius = 150;
	level.killtriggers[2].height = 140;

	level.killtriggers[3] = spawnstruct();
	level.killtriggers[3].origin = (1144, 2000, 125);
	level.killtriggers[3].radius = 165;
	level.killtriggers[3].height = 230;

	level.killtriggers[4] = spawnstruct();
	level.killtriggers[4].origin = (1144, 1328, 147);
	level.killtriggers[4].radius = 205;
	level.killtriggers[4].height = 200;

	level.killtriggers[5] = spawnstruct();
	level.killtriggers[5].origin = (1444, 1948, 108);
	level.killtriggers[5].radius = 27;
	level.killtriggers[5].height = 12;

	level.killtriggers[6] = spawnstruct();
	level.killtriggers[6].origin = (144, 734, 130);
	level.killtriggers[6].radius = 35;
	level.killtriggers[6].height = 12;

	level.killtriggers[7] = spawnstruct();
	level.killtriggers[7].origin = (452, 981, 132);
	level.killtriggers[7].radius = 16;
	level.killtriggers[7].height = 12;

	thread maps\mp\_killtriggers::init();
}
Share |
msto
General Member
Since: Aug 17, 2005
Posts: 17
Last: Jan 24, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 05:24 pm
k ty v much for your help [jumping]
dont suppose anyone can remember the command needed to find your coordinates can they?[confused]
Share |
HyBr!d
General Member
Since: Sep 26, 2004
Posts: 560
Last: Sep 25, 2015
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 05:29 pm
if you are at the exploit spot type /viewpos in the console for your position in coordinates
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 05:57 pm
To help you with the fine tuning of the killzones you might also want to temporarily run a modified killtrigger script that instead of killing the player displays a console message.

Place the following code in the maps main gsc at the end or in a separate gsc if you know a little scripting. (It is a copy from the IW stock files but with the self suicide line replaced with a println to the console. If you know how you could also instead play a sound while in the killzone area to make it even easier to fine tune the maps.

Code:
init()
{
	if(isdefined(level.killtriggers))
	{
		for(i = 0; i < level.killtriggers.size; i++)
		{
			killtrigger = level.killtriggers[i];
			killtrigger.origin = (killtrigger.origin[0], killtrigger.origin[1], (killtrigger.origin[2] - 16));
		}

		playerradius = 16;

		for(;;)
		{
			players = getentarray("player", "classname");
			counter = 0;
			
			for(i = 0; i < players.size; i++)
			{
				player = players[i];
				
				if(isdefined(player) && isdefined(player.pers["team"]) && player.pers["team"] != "spectator" && player.sessionstate == "playing")
				{
					player checkKillTriggers();
					counter++;
					
					if(!(counter % 4))
					{
						wait .05;
						counter = 0;
					}
				}
			}
			
			wait .05;
		}
	}
}

checkKillTriggers()
{
	playerradius = 16;
	
	for(i = 0; i < level.killtriggers.size; i++)
	{
		killtrigger = level.killtriggers[i];
		diff = killtrigger.origin - self.origin;
	
		if((self.origin[2] >= killtrigger.origin[2]) && (self.origin[2] <= killtrigger.origin[2] + killtrigger.height))
		{
	        diff2 = (diff[0], diff[1], 0);
	
	        if(length(diff2) < killtrigger.radius + playerradius)
	        {
				// self suicide();
				println("^1You are in an killtrigger spot");
				return;
	        }
		}
	}
}


Instead of the call to "thread maps\mp\_killtriggers::init();" replace it with "thread init();" or alternatively with "thread maps\mp\checkkilltriggers::init();" if for example you pasted the the above code in a file called checkkilltriggers.gsc. Once you are ready to deploy the map you switch back to the original script that kills the player in exploit places.


You can display the a mini console which is much easier to watch for that with something like /con_minicon 1. I do not have access to my notes atm.
Share |
msto
General Member
Since: Aug 17, 2005
Posts: 17
Last: Jan 24, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 06:32 pm
This is my current gsc. doesnt seem to work tho when i test it locally :(
is it because i have put it in a separate iwd?
-------
main()
{

maps\mp\mp_kalsingrad_v2_fx::main();
maps\mp\_load::main();

setExpFog(0.00028, .58, .57, .57, 0);
ambientPlay("ambient_mp_kalsingrad_v2");

game["allies"] = "russian";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["russian_soldiertype"] = "coats";
game["german_soldiertype"] = "winterlight";


{
level.killtriggers[0] = spawnstruct();
level.killtriggers[0].origin = (1040, 53, 204);
level.killtriggers[0].radius = 100;
level.killtriggers[0].height = 48;

thread maps\mp\_killtriggers::init();

}
}

-----
also do u know if it would b possible to make this a serverside only iwd -would that still work?

edited on Jun. 28, 2006 02:36 pm by msto
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 07:17 pm
make sure the modified gsc actually gets called, Best to insert a "println("^1Its the right script"); " in your main function.

You need to ensure that the gsc is in a iwd that is referenced later than the one where the original gsc is in, e.g. zzzzzzzzzzzzzzzzzzzzzzzzzzz_moddedgsc.iwd when a maps iwd is called zzz_aaaaaaa.iwd
Share |
msto
General Member
Since: Aug 17, 2005
Posts: 17
Last: Jan 24, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 07:56 pm
k it works now, ty for your help and patience. [jumping]
think it was the zzz part, and also the radius value wasnt great.

last question: will it work as a purely serverside iwd, or will i have to make it available as a client download?
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jun. 28, 2006 09:13 pm
I think it should work server side only though I am not running my own server so not really good about it. Just place the new zzz..iwd on a server and see if on a virgin PC that connects to it if the iwd gets downloaded.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Jun. 30, 2006 03:27 am
also, I believe the {} around the killtrigers code are redundant, if that's the code you are using. meaning, they can be removed.
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

»