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

Members Online

»
0 Active | 70 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: Change Player in Object
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Nov. 6, 2010 05:09 pm
Hello guys.[wave]
Can i get 1 Example for change player in object (i write command,player ID and Xmodel Example: /rcon 1 bike)
and if its able to get all xmodel names.

Regards,
OwNeR a.k.a Lineage2Soul
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, Nov. 6, 2010 07:25 pm
dont think anyones gona write u a whole code like that but take a look in the Docs it tells u how to change an entity into an xmodel and you can work off that you have to try things your self to get the hang of all this scripting every post you put your asking for a code try things your self and come back with somthing ill help you but if someone wants to just hand you the code then go for it.
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Nov. 6, 2010 07:50 pm
i think some1 will trust me the code when i will finish all codes i will give him all xmodel codes.
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Nov. 6, 2010 11:50 pm
The xmodel 'codes' are just the xmodel names, which are found in iw_13.iwd.

However, you cannot allow use of all xmodels as you must first precache the models at the very start of the script and it is a waste of resources to precache every model.

I seem to remember a major mod had this feature - I think it was the eXtreme+ mod.

You can use the getentitynumber() function to find the player in a given slot number

~~~~~~~~~~~~~~~~

(I think this question has already been answered in the forum somewhere)
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 12:19 am
try uberpam. YOu might get inspired by the code
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 06:27 am
Sounds like you need to figure out how to do other things before you try adding commands
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 07:50 am
IzNoGoD writes...
Quote:
try uberpam. YOu might get inspired by the code

I have UberPAM mod but i didn't find where are scripts.
I try whit this script:
init()
{
thread bike();
precacheModel("xmodel/prop_bike");
}
grmovje()
{
setCvar("g_bike","");
while(1)
{
if(getCvar("g_bike") != "")
{
movePlayerNum = getCvarInt("g_bike");
players = getentarray("player","classname");
for(i = 0; i < players.size; i++)
{
player = players;

thisPlayerNum = player getEntityNumber();
if(thisPlayerNum == movePlayerNum )

self detachall();
self setmodel("xmodel/prop_bike");
iprintln("You have been changed in Bike By ADMIN!");
self disableweapon();

}
setCvar("g_bike","");
}
wait 0.05;
}
}

When i try it won't work don't know why.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 09:51 am
you are calling a non-existing thread "bike()", and you are not calling the thread "grmovje()"
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 10:12 am
yeah i see i change language cuz first i give name grmovje so its all in name grmovje when i login ingame i write g_grmovje 1 and i get iprintln message i go in 3rd person and i see normal player.
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: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 11:35 am
Here is an example piece that you can mess with:

Code:

main()
{
	// change 'bike01' to the xmodel filename
	precacheModel( "bike01" );

	// setup the cvar
	setCvar( "scr_bike", "" );
	
	// monitor the cvar and when it changes, thread a function
	while(1)
	{
		if( getCvar( "scr_bike" ) != "" )
			thread changeToBike();
	
		wait 0.05;
	}
}

changeToBike()
{
	id = getCvarInt( "scr_bike" );
	setCvar( "scr_bike", "" );
	
	players = getEntArray( "player", "classname" );
	for( i = 0; i < players.size; i++ )
	{
		if( players[i] getEntityNumber() == id )
			players[i] thread transformPlayer();
	}
}

transformPlayer()
{
	if( !isDefined( self.isBike ) )
		self.isBike = false;
		
	self notify( "model_change" );
		
	// if player isn't a bike, make them so
	if( !self.isBike )
	{	
		self.isBike = true;
		
		self hide();
		
		self.bikeModel = spawn( "script_model", ( 0, 0, 0 ) );
		self.bikeModel.origin = self.origin;
		self.bikeModel.angles = ( 0, self.angles[1], 0 );
		self.bikeModel setModel( "bike01" );
		self.bikeModel LinkTo( self );
		
		self thread monitorBike();
		self thread bikeCleanup();
	}
	else
	{
		// 'model_change' notify will reverse bike
		self.isBike = false;
	}
}

monitorBike()
{
	self endon( "disconnect" );
	self endon( "death" );
	self endon( "joined_spectator" );
	self endon( "model_change" );
	
	while(1)
	{
		self.bikeModel.origin = self.origin;
		self.bikeModel.angles = ( 0, self.angles[1], 0 );
		
		wait 0.05;
	}
}

bikeCleanup()
{
	self waittill_any( "disconnect", "death", "joined_spectator", "model_change" );

	self.bikeModel Delete();
	
	waittillframeend;
	
	if( isDefined( self ) )
		self Show();
}

waittill_any( string1, string2, string3, string4, string5 )
{
	assert( isdefined( string1 ) );
	
	if ( isdefined( string2 ) )
		self endon( string2 );

	if ( isdefined( string3 ) )
		self endon( string3 );

	if ( isdefined( string4 ) )
		self endon( string4 );

	if ( isdefined( string5 ) )
		self endon( string5 );
	
	self waittill( string1 );
}
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

»