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

Members Online

»
0 Active | 80 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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Weapons to specified ppl (GUID)
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Monday, Aug. 2, 2010 02:25 pm
Hi..
Another topic asking for help ^^

Here's the "deal": I have a server with a Sniper Only mod. Actually it's pretty simple cuz it just won't allow you to choose any weapon but snipers.

My doubt is: Is it possible to give weapons to specified ppl by GUID (like in BTD)? I mean, is there a script to allow this?

What I need: To know if it's possible to give weapons to specified ppl by GUID and I need the script xD [rocking]

Mod that I use: http://forum.i3d.net/downloads.php?do=file&id=826

Plz help me :)
Very Important o.O
Thank you

edited on Aug. 2, 2010 12:08 pm by LiQ.HeaDShOt

BTW, if you are a scripter, plz comment your script in the lines where I have to fill in the GUID and some other info.

Thank you

Share |
Uzumakibro93
General Member
Since: Sep 6, 2009
Posts: 118
Last: Jul 5, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Monday, Aug. 2, 2010 05:35 pm
Do you mean by using an administrative command? Such as

/rcon set [GUID] [GUN]

?

If so, yes. You can create a script to do so fairly simply, just by running a GUID check upon the function being called. Then, if your GUID matches, it will give you the specified gun. You could also use slot numbers. It would work better :D
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Monday, Aug. 2, 2010 06:58 pm
Uzumakibro93 writes...
Quote:
Do you mean by using an administrative command? Such as

/rcon set [GUID] [GUN]

?

If so, yes. You can create a script to do so fairly simply, just by running a GUID check upon the function being called. Then, if your GUID matches, it will give you the specified gun. You could also use slot numbers. It would work better :D


hmm.. I understand..
but i would like the 2 ways.
When a player spawns, he receives the specified guns and if an admin executes that command, the player with that GUID that is inserted in the command would receive the gun.

Is that possible?
Can you make it?

sry but idk scripting and that's why i'm asking for help :)
Share |
Uzumakibro93
General Member
Since: Sep 6, 2009
Posts: 118
Last: Jul 5, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Monday, Aug. 2, 2010 08:00 pm
I can't promise I'll have much time to work on it, so no... If I do get the time, I'll be sure to tell you. Thank you, Kyle Mulliger.
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Monday, Aug. 2, 2010 08:51 pm
Uzumakibro93 writes...
Quote:
I can't promise I'll have much time to work on it, so no... If I do get the time, I'll be sure to tell you. Thank you, Kyle Mulliger.


Ok.
Anyway thank you.
If someone could help me, please post the script here ^^

Thank you.
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Tuesday, Aug. 3, 2010 01:32 pm
DemonSeed plz give me your oppinion.
I know that you are a great scripter and i would like you to help like you did in the other post. (if you have time ofc.)

Thank you
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Tuesday, Aug. 3, 2010 07:08 pm
Hey guys?
Little help plz??

Realy need help...
Plz!
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: CoD4 Scripting
Posted: Wednesday, Aug. 4, 2010 06:53 am
This script checks the GUID of a player on spawn and if it matches the chosen ones, they are given the special gun. It also allows you to use a custom command (scr_giveWeapon) to give any weapon to any player (uses slot numbers to define player)

Code:

setupWeapons()
{
	// For each seperate guid, add a space between them
	level.allowedGUIDS = "guidONE guidTWO";
	
	// Change "ak47_mp" to the weapon of your choice
	level.specialWeapon = "ak47_mp";
	
	level thread monitorDvar();
	level thread onPlayerConnect();
}

onPlayerConnect()
{
	for(;;)
	{
		level waittill( "connected", player );
		player thread OnSpawn();
	}
}

OnSpawn()
{
	self endon( "disconnect" );
	
	for(;;)
	{
		self waittill( "spawned" );
		
		self thread checkGUID();
	}
}

checkGUID()
{
	self.isSpecial = false;

	allowedGUIDs = strTok( level.allowedGUIDS, " " );
	for( i = 0; i < allowedGUIDs.size; i++ )
	{
		guid = allowedGUIDs[i];
		
		if( ToLower( self GetGUID() ) == ToLower( guid ) )
			self.isSpecial = true;
	}
	
	if( self.isSpecial )
	{
		// Should be primary on spawn
		self TakeWeapon();
		self GiveWeapon( level.specialWeapon );
		self GiveStartAmmo( level.specialWeapon );
	}
}

monitorDvar()
{
	setDvar( "scr_giveWeapon", "" );
	
	while(1)
	{
		if( getDvar( "scr_giveWeapon" ) != "" )
			thread giveWeapon();
			
		wait 0.05;
	}
}

giveWeapon()
{
	// When typing in the command, do /rcon scr_giveWeapon PLAYERID WEAPONNAME
	string = strTok( getDvar( "scr_giveWeapon" ), " " );
	setDvar( "scr_giveWeapon", "" );
	
	if( !isDefined( string[0] ) ||!isDefined( string[1] ) )
		return;
	
	players = getEntArray( "player", "classname" );
	for( i = 0; i < players.size; i++ )
	{
		player = players[i];
	
		if( player getEntityNumber() == int( string[0] ) )
		{	
			player TakeWeapon();
			player giveWeapon( string[1] );
			player giveStartAmmo( string[1] );
		}
	}
}
Share |
LiQ.HeaDShOt
General Member
Since: Jun 1, 2010
Posts: 51
Last: Feb 21, 2011
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Wednesday, Aug. 4, 2010 11:44 am
Xylozi writes...
Quote:
This script checks the GUID of a player on spawn and if it matches the chosen ones, they are given the special gun. It also allows you to use a custom command (scr_giveWeapon) to give any weapon to any player (uses slot numbers to define player)

Code:

setupWeapons()
{
	// For each seperate guid, add a space between them
	level.allowedGUIDS = "guidONE guidTWO";
	
	// Change "ak47_mp" to the weapon of your choice
	level.specialWeapon = "ak47_mp";
	
	level thread monitorDvar();
	level thread onPlayerConnect();
}

onPlayerConnect()
{
	for(;;)
	{
		level waittill( "connected", player );
		player thread OnSpawn();
	}
}

OnSpawn()
{
	self endon( "disconnect" );
	
	for(;;)
	{
		self waittill( "spawned" );
		
		self thread checkGUID();
	}
}

checkGUID()
{
	self.isSpecial = false;

	allowedGUIDs = strTok( level.allowedGUIDS, " " );
	for( i = 0; i < allowedGUIDs.size; i++ )
	{
		guid = allowedGUIDs[i];
		
		if( ToLower( self GetGUID() ) == ToLower( guid ) )
			self.isSpecial = true;
	}
	
	if( self.isSpecial )
	{
		// Should be primary on spawn
		self TakeWeapon();
		self GiveWeapon( level.specialWeapon );
		self GiveStartAmmo( level.specialWeapon );
	}
}

monitorDvar()
{
	setDvar( "scr_giveWeapon", "" );
	
	while(1)
	{
		if( getDvar( "scr_giveWeapon" ) != "" )
			thread giveWeapon();
			
		wait 0.05;
	}
}

giveWeapon()
{
	// When typing in the command, do /rcon scr_giveWeapon PLAYERID WEAPONNAME
	string = strTok( getDvar( "scr_giveWeapon" ), " " );
	setDvar( "scr_giveWeapon", "" );
	
	if( !isDefined( string[0] ) ||!isDefined( string[1] ) )
		return;
	
	players = getEntArray( "player", "classname" );
	for( i = 0; i < players.size; i++ )
	{
		player = players[i];
	
		if( player getEntityNumber() == int( string[0] ) )
		{	
			player TakeWeapon();
			player giveWeapon( string[1] );
			player giveStartAmmo( string[1] );
		}
	}
}


thx!! I <3 u! :D :D :D
Question: Can i add like:

// Change "ak47_mp" to the weapon of your choice
level.specialWeapon = "ak47_mp";
level.specialWeapon = "ak74u_mp";

If there are two weapons, can i add this 2nd line?

Question: How do I install it? Do I have to edit globallogic?
If yes, plz tell me which line to find and what line to add..
Thank You
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: CoD4 Scripting
Posted: Wednesday, Aug. 4, 2010 01:13 pm
To add a second weapon would require a little re-scripting, so if you just listed all the weapons you want given, I can add it to the script.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»