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

Members Online

»
0 Active | 5 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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 subscribe
Author Topic: Console commands by slot number
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Mar. 12, 2009 03:18 am
How do certain custom made commands, such as burn, do what they do by slot number? I can't figure out how to tell the game to do the action to the player to which the slot number pertains to.

edited on Mar. 11, 2009 11:18 pm by clanhelio
Share |
stealthcod2
General Member
Since: Dec 23, 2008
Posts: 108
Last: Jul 13, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Mar. 12, 2009 11:25 pm
aigaming.net go to forums then cod2 there is a cod rcon mod svr_admin i think. should be on first page one.
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Mar. 14, 2009 04:10 am
There's so much to it lol. Will take me a while
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Mar. 14, 2009 10:22 am
getPlayers(slot, cmd)
{
target = undefined;
players = getentarray("player", "classname");
for (i = 0; i < players.size; i++)
{
if(int(slot) == players getEntityNumber() && isAlive(players) && players.sessionstate == "playing")
{
target = players;
break;
}
}

setcvar(cmd,"");

if(isdefined(target))
target thread doCmd(cmd);

}

doCmd(cmd)
{
switch(cmd)
{
case "burn":
self thread burn(true);
break;
case "cow":
self thread cow();
break;
case "explode":
self thread explode();
break;
case "kill":
self thread kill();
break;
case "disarm":
self thread disarm();
break;
case "lock":
self thread lock(true);
break;
case "unlock":
self thread lock(false);
break;
case "mortar":
self thread mortar();
break;
case "tospec":
self thread tospec();
break;
case "swapteam":
self thread swapteam();
break;
default:
break;
}
}


something i had laying around theres ur player slot i think u can figure the rest out on ur own
Share |
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Mar. 14, 2009 12:28 pm
Code:
getPlayers(slot, cmd)
{
target = undefined;
players = getentarray("player", "classname");
for (i = 0; i < players.size; i++)
{
if(int(slot) == players getEntityNumber() && isAlive(players) && players.sessionstate == "playing")
{
target = players;
break;
}
}

setcvar(cmd,"");

if(isdefined(target))
target thread doCmd(cmd);

}

doCmd(cmd)
{
switch(cmd)
{
case "burn":
self thread burn(true);
break; 
case "cow":
self thread cow();
break;
case "explode":
self thread explode();
break;
case "kill":
self thread kill();
break;
case "disarm":
self thread disarm();
break;
case "lock":
self thread lock(true);
break;
case "unlock":
self thread lock(false);
break;
case "mortar":
self thread mortar();
break;
case "tospec":
self thread tospec();
break;
case "swapteam":
self thread swapteam();
break;
default:
break; 
}
}


Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Apr. 10, 2009 07:46 pm
I got this, and all I wanted from it was the kill and team switch command, so I took that, but the team switching one seems to be bugging. The player's team will switch but their skins will be the same, so you'd have a german with american skins running around...

Code:
swapteam()
{
	_g = getcvar("g_gametype");
	_t = undefined;
	_l = undefined;
	
	if(self.pers["team"] == "axis")
	{
		_t = "allies";
	}
	else if(self.pers["team"] == "allies")
	{
		_t = "axis";
	}
	
	if(self.sessionstate == "playing")
	{
		self.switching_teams = true;
		self.joining_team = _t;
		self.leaving_team = self.pers["team"];
		self suicide();
		
			
	}
	self notify("end_respawn");
	self.pers["team"] = _t;
}


Anything wrong with that?
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Apr. 10, 2009 08:52 pm
Nevermind, had to add extra lines to open the weapon menus
Share |
Restricted Access Topic is Locked 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

»