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

Members Online

»
0 Active | 254 Guests
Online:

LATEST FORUM THREADS

»
New BF2 Mod
BF2 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: My MOD works for first player but no one else??
Webber105
General Member
Since: Aug 2, 2007
Posts: 23
Last: Jul 21, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Sep. 12, 2007 06:56 pm
I made a MOD that monitors you running and makes you go crouch after tiring and it also takes your weapon away while running but not if you melee attack. This MOD works great but only the first player that joins the server after the server is reset. Any future players the MOD does not work.

Any Ideas on how to correct this problem?
[jumping]
Share |
nedgerblansky
General Member
Since: Jan 28, 2005
Posts: 57
Last: Nov 9, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Thursday, Sep. 13, 2007 01:21 am
We need to see your code to help you debug.

It *could* be something that is not threaded but should be.
Share |
Webber105
General Member
Since: Aug 2, 2007
Posts: 23
Last: Jul 21, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Sep. 13, 2007 08:34 am
Code:
onPlayerConnect()
{
	for(;;)
	{
		level waittill("connecting", player);

		player thread onPlayerSpawned();
		self waittill("killed_player");
		player thread onPlayerKilled();
	}
}

I know that if I remove the line self waittill("killed_player");

That works and the MOD works for everyone BUT on respawn my blackscreen does not dissappear.

Here is my respawn code:
Code:
onPlayerSpawned()
{
	self endon("disconnect");
	
weapon1 = self getWeaponSlotWeapon("primary");
weapon2 = self getWeaponSlotWeapon"primaryb");
	
	for(;;)
	{
		
		self waittill("spawned_player");
		self.is_Sprinting = false;
		self.sprint_stamina = level.sprint_time;
		self.old_position = self.origin;
		self openMenu("gocrouch");
		self closeMenu();
		self thread shellshockOnDamage();
		self thread Monitor_Sprint();
		
	}
}

And here is my player killed code:

Code:
onPlayerKilled()
{
	self endon("disconnect");

	for(;;)
	{
		self waittill("killed_player");

		self notify("kill_monitors");
		
		self.blackscreentext = newClientHudElem(self);
		self.blackscreentext.sort = -1;
		self.blackscreentext.archived = false;
		self.blackscreentext.alignX = "center";
		self.blackscreentext.alignY = "middle";
		self.blackscreentext.fontscale = 2.5;
		self.blackscreentext.x = 320;
		self.blackscreentext.y = 220;
		self.blackscreentext.alpha = 0;
		self.blackscreen = newClientHudElem(self);
		self.blackscreen.sort = -2;
		self.blackscreen.archived = false;
		self.blackscreen.alignX = "left";
		self.blackscreen.alignY = "top";
		self.blackscreen.x = 0;
		self.blackscreen.y = 0;
		self.blackscreen.alpha = 0;
		self.blackscreen setShader("black", 640, 480);
		self.blackscreen fadeOverTime(0.1);
		self.blackscreen.alpha = 1;
		saytext = "player.name was killed";
		self waittill("spawned_player");
		self.blackscreen destroy();
		self.blackscreentext destroy();
	}

}	


I was wondering if I should change the player to self in the lines in player connect.



[puke]
Share |
macklebee
General Member
Since: Dec 5, 2006
Posts: 104
Last: Aug 24, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Sep. 13, 2007 09:43 am
Code:
onPlayerConnect()
{
	for(;;)
	{
		level waittill("connecting", player);

		player thread onPlayerSpawned();
		self waittill("killed_player");


What is 'self' in this line? Player? What is calling this thread, 'OnPlayerConnect'? I assume you have setup player as a getentarray?
Share |
nedgerblansky
General Member
Since: Jan 28, 2005
Posts: 57
Last: Nov 9, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Thursday, Sep. 13, 2007 12:06 pm
Yes, that's the problem.

It should be
Code:
player waittill("killed_player");

instead of
Code:
self waittill("killed_player");
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

»