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

Members Online

»
0 Active | 110 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
Previous Page Next Page
subscribe
Author Topic: Force MOD download
maxxis95
General Member
Since: Aug 28, 2012
Posts: 55
Last: Sep 17, 2012
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 08:05 am
do you wanna say if i use closegamemenu(), it wont close all other menus (not let you open them) such as chat and teamchat? also, could you pleaaaase give me an example of menu which is filled by a picture? because obv it is only way how to make a picture loads before chosing a team
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 08:10 am
maxxis95 writes...
Quote:
does any of you know how to make a menu which opens on a start which uses that invisible picture? or how to make picture shows when player connects, not when choses a team?


On a 1.0 server, there is no way to do this. What I would do in that case is move it to when a player spawns. They will not be able to see anything because of the missing image shader, so if they have any sense, they will disconnect and try to reconnect again.

EDIT -

I played around with it, and got it to work fine:

Code:
Init()
{

	game["force_download"] = "gfx/custom/empty.tga";
	precacheShader( game["force_download"] );

	level thread onPlayerConnect();
}

onPlayerConnect()
{
	for(;;)
	{
		level waittill( "connecting", player );
		
		player thread onPlayerSpawned();	
	}
}		

onPlayerSpawned()
{
	for( ;; )
	{
		self waittill( "spawned_player" );
		
		self setClientCvar( "cl_allowdownload", 1 );
		
		self runElement();

	}
}

runElement()
{
	if( !isdefined( self.forcedownload ) )
	{
		self.forcedownload = newClientHudElem( self );
		self.forcedownload.horzAlign = "left";
		self.forcedownload.vertAlign = "top";
		self.forcedownload.x = 0;
		self.forcedownload.y = 0;
		self.forcedownload.foreground = true;
		self.forcedownload setShader( game["force_download"], 900, 480 );
	}
}


I adjusted the size of the element to accommodate widescreen monitors. The missing shader now covers the whole screen.

Also, I set it to be in the foreground - nothing shows at all. No compass, nothing.
Share |
maxxis95
General Member
Since: Aug 28, 2012
Posts: 55
Last: Sep 17, 2012
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 08:35 am
I am using 1.3 version and by default it is set to see an image when player chooses team so I don't really know what youre trying to say.

also, i have tried closegamemenu and it works even worse. when using a closemenu, at least i can move but cannot open chat or teamchat or anything but when using closegamemenu, i cant even move, i dont see any screen element such as compass or any else.

do you guys have any idea how to open that menu and be also able to open other menus? -chat/teamchat...

also any idea how to fix that force download? how to load a picture before getting a team? im working on a zombie mod and im using different menus so i dont really have any effect since player who doesn't have mod downloaded, cannot even chose team.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 09:03 am
maxxis95 writes...
Quote:
I am using 1.3 version and by default it is set to see an image when player chooses team so I don't really know what youre trying to say.

also, i have tried closegamemenu and it works even worse. when using a closemenu, at least i can move but cannot open chat or teamchat or anything but when using closegamemenu, i cant even move, i dont see any screen element such as compass or any else.

do you guys have any idea how to open that menu and be also able to open other menus? -chat/teamchat...

also any idea how to fix that force download? how to load a picture before getting a team? im working on a zombie mod and im using different menus so i dont really have any effect since player who doesn't have mod downloaded, cannot even chose team.


This is what I am talking about: you keep saying the code you posted in the OP sets the element on a player when they choose a team. IT DOES NOT! The code tells you when it is supposed to be run - on a connecting player.

If the code ran the element on a player when they chose a team, it would say something entirely different - it would have a function which monitors onJoinedTeam() - which it doesn't.

If you've changed the code to monitor when a player joins a team, then that is the code you should have posted. You did not. You posted code that monitors connecting players.

As for using closemenu, you are misunderstanding what we are talking about. We were talking about doing it when a player connects. You can't run around and type in chat when you are connecitng, can you?

As for how to get this to work, see my edit.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 09:57 am
maxxis95 writes...
Quote:

does anybody know how to make people see that invisible picture when they connect? cause now, they have to choose a team to see it.


Meaning that the menu (the gametype menu, or the teamchooser menu) is in the way of the hud elem.

Try to close the menu, report results.
Press esc after connecting to close the menu.
Share |
z0d
General Member
Since: Apr 29, 2012
Posts: 33
Last: May 8, 2013
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 07:28 pm
I made it. It works this way - I made 2 new menus (serverinfo_sd and ingame). serverinfo_sd is menu which opens first (gives you information about server such as friendly fire, motd and so on and so on). it is basically same as previous one only difference is its name and because of that, players who doesn't have mod downloaded will be automatically moved to specators. when theyre moved to specators, it creates black background with message "you must download mod to play bla bla bla bla" and also because of new ingame menu, they cant press esc and see map main menu is opened. but here comes a problem. i've made it works for players in spectator but what if someone really wants to choose spectator as a team? so im wondering is there any difference (sessionstate or something else) what makes difference between normal spectator who chosed to be a spectator and one who was forced to be a spectator because of missing menu. thats all i need, when someone gives me that variable, ill release it.
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Sep. 8, 2012 10:51 pm
its just a guess:
why not creating a scriptmenu like the serverinfo one, which you must close (and send a menu response) within x minutes or you will be kicked?
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Sep. 9, 2012 03:24 am
serthy writes...
Quote:
its just a guess:
why not creating a scriptmenu like the serverinfo one, which you must close (and send a menu response) within x minutes or you will be kicked?


Yeah, that was were my thinking about this took me: leave everyone connecting in limbo; put a flag on every player which is a boolean true; put a waittill on everyone in Callback_PlayerConnect so no menus open up; those who have the mod download get a welcome menu with an "accept" button which they have to click in order to take the flag off them and notify the waittill so they can continue; all those players who still have the flag defined get kicked.

The unlucky players without the mod download, get a message telling them they are about to get kicked in X number of seconds for not having the mod files and to reconnect to get the download (having had the cl_allowdownload dvar forced on them). This message is hidden to players with the download because the welcome menu obscures it.

I even thought about using the file functions and writing player name and GUID to text file for all those players who have been checked, so that they wont have to go through the process more than once. The second time they connect to the server, or on a map rotate, open the file with their name, check their GUID for players with duplicate names, and if there is a value which says they have been checked, they bypass the limbo status and pass right on to the team menu. No further check needed.

The key to all the above is to intercept the standard menus opening up on player connect. Do that, and any player will be left in space like a spectator, looking out at the map from the global intermission spawnpoint. In those circumstances, you can do anything to them: message them; put a missing shader on them (which I no longer think is necessary); anything you like.

Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Sep. 9, 2012 09:30 am
Normal serverinfo_sd for example gives a scrpitmenuresponse of "close"
Code:

scriptMenuResponse "close";


This means, that if you replace the serverinfo menu with your own custom, which gives a scriptmenuresponse of "close2" or whatever, you can distinguish between players and do NOT need to have them kicked after a certain amount of time. Just monitor whether they "close" or "close2"
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Sep. 9, 2012 11:55 am
I created my own custom menu called "checker". This is what it looks like to a player who has the mod files:



There are different background images for british, russian, or american, depending on what teams there are.

Once I have finished, I will share everything - menu files and images - as a download.

Just working on the file checker, to tell if a player has been checked before. I don't want to inconvenience those who have been checked before. It will be odd to keep checking a player every time they want a game.
Share |
Restricted Access Topic is Locked
Page
Previous 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

»