codjumper + unlock all weapons
Moderator: Core Staff
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
I have no problem with people editing it, I just erm, would prefer to know what they have edited and why. There is nothing worse than seeing a whole load of gibberish added to a mod you are suppose to be working on. A lot of the stuff just well doesn't make much sense and because it is lots of variables, it is hard to find where they lead to and what they do.
I will be looking at both the edited version of the mod and the RAW modwarfare files.
			
			
									
									I will be looking at both the edited version of the mod and the RAW modwarfare files.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
- 
				Jeffro
- CJ Donator 
- Posts: 157
- Joined: April 21st, 2006, 9:58 pm
- Location: Netherlands
- Contact:
- 
				Jeffro
- CJ Donator 
- Posts: 157
- Joined: April 21st, 2006, 9:58 pm
- Location: Netherlands
- Contact:
MY EDITS:
Yes I know this is the same as codjumper for cod2 but it should work. Why it doesn't... I don't know.
Addes full position calculation code also from the cod2 mod.
The actual mod. Has been made in a way to enable air loading but disable air saving. (needed for jump maps and such later on.)
Thats all I did.
			
			
									
									
						Code: Select all
doHUDMessages()
{
	self waittill("spawned_player");
	self iprintlnbold("Don't die so fast.");
	if(!isdefined(self.pers["cj_hudmsg"]))
	{
		wait 1;
		self iprintlnbold("Welcome to this server.");
		self iprintlnbold("Don't block other people.");
		wait 3;
		self iprintlnbold("Take turns when doing jumps!");
		wait 3;
		self iprintlnbold("Listen to the admins!");
		wait 6;
		self iprintlnbold("Use the Melee key (Default V) to save.");
		wait 6;
		self iprintlnbold("Use the Use key (Default F) to load.");
		self.pers["cj_hudmsg"] = true;
	}
}
Addes full position calculation code also from the cod2 mod.
Code: Select all
positions(range)
{
	if(!range)
		return true;
	// Get all players and pick out the ones that are playing
	allplayers = getentarray("player", "classname");
	players = [];
	for(i = 0; i < allplayers.size; i++)
	{
		if(allplayers[i].sessionstate == "playing")
			players[players.size] = allplayers[i];
	}
	// Get the players that are in range
	sortedplayers = sortByDist(players, self);
	// Need at least 2 players (myself + one team mate)
	if(sortedplayers.size<2)
		return false;
	// First player will be myself so check against second player
	distance = distance(self.saved_origin, sortedplayers[1].origin);
	if( distance <= range )
		return true;
	else
		return false;
}
sortByDist(points, startpoint, maxdist, mindist)
{
	if(!isdefined(points))
		return undefined;
	if(!isdefineD(startpoint))
		return undefined;
	if(!isdefined(mindist))
		mindist = -1000000;
	if(!isdefined(maxdist))
		maxdist = 1000000; // almost 16 miles, should cover everything.
	sortedpoints = [];
	max = points.size-1;
	for(i = 0; i < max; i++)
	{
		nextdist = 1000000;
		next = undefined;
		for(j = 0; j < points.size; j++)
		{
			thisdist = distance(startpoint.origin, points[j].origin);
			if(thisdist <= nextdist && thisdist <= maxdist && thisdist >= mindist)
			{
				next = j;
				nextdist = thisdist;
			}
		}
		if(!isdefined(next))
			break; // didn't find one that fit the range, stop trying
		sortedpoints[i] = points[next];
		// shorten the list, fewer compares
		points[next] = points[points.size-1]; // replace the closest point with the end of the list
		points[points.size-1] = undefined; // cut off the end of the list
	}
	sortedpoints[sortedpoints.size] = points[0]; // the last point in the list
	return sortedpoints;
}
Code: Select all
_MeleeKey()
{
	self endon("end_saveposition_threads");
	self endon("disconnect");
	for(;;)
	{
		if(self meleeButtonPressed())
			{
				catch_next = false;
	
				for(i=0; i<=0.10; i+=0.01)
				{
					if(catch_next && self meleeButtonPressed())
					{
						wait 0.1;
						if(self isOnground())
						{
							self thread savePos();
							wait 1;
							break;
						}
					}
					else if(!(self meleeButtonPressed()))
						catch_next = true;
	
					wait 0.01;
				}
			}
		
		wait 0.05;
	}
}
_UseKey()
{
	self endon("end_saveposition_threads");
	self endon("disconnect");
	for(;;)
	{
		if(self useButtonPressed())
		{
			catch_next = false;
			for(i=0; i<=0.10; i+=0.01)
			{
				if(catch_next && self useButtonPressed())
				{
					wait 0.1;
					self thread loadPos();
					wait 1;
					break;
				}
				else if(!(self useButtonPressed()))
					catch_next = true;
				wait 0.01;
			}
		}
		wait 0.05;
	}
}
loadPos()
{
	//thread positions();
	
	if(!isDefined(self.saved_origin))
		{
		self iprintlnbold("^1T^7here is no previous position to load.");
		return;
		}
	else
	{
		if(self positions(55))
			{
			self iprintlnbold("^1P^7osition Occupied.");
			self iprintlnbold("^1P^7lease Wait.");
			return;
			}
		else
			{
			self setPlayerAngles(self.saved_angles); // angles need to come first
			self setOrigin(self.saved_origin);
			self iprintln("^2P^7revious position loaded.");
			}
	}
}
savePos()
{
	self.saved_origin = self.origin;
	self.saved_angles = self.angles;
	self iprintln("^2P^7osition saved.");
}
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
- 
				Jeffro
- CJ Donator 
- Posts: 157
- Joined: April 21st, 2006, 9:58 pm
- Location: Netherlands
- Contact:
 Oops xD
 Oops xDStupid of me

Well thread it then ^_^
Also can we do Localized strings again so we can make this stuff a little easier

edit: so this would work?

Code: Select all
setup()
{
	for(;;)
	{
		level waittill("connecting", player);
		player thread _MeleeKey();
		player thread _UseKey();
		player thread doHUDMessages();
		player checkGrenade();
	}
}
- 
				Jeffro
- CJ Donator 
- Posts: 157
- Joined: April 21st, 2006, 9:58 pm
- Location: Netherlands
- Contact:
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
I usually add this towards the end. I also know beta testers are having problems with it atm, so we shall wait.Jeffro wrote:Also can we do Localized strings again so we can make this stuff a little easier
congratulations on getting it working


Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
- 
				Jeffro
- CJ Donator 
- Posts: 157
- Joined: April 21st, 2006, 9:58 pm
- Location: Netherlands
- Contact:
- 
				[SoE]_Zaitsev  
- Core Staff 
- Posts: 14220
- Joined: October 21st, 2004, 7:17 pm
- Location: Holland
- Contact:
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London





 
														
