Author |
Topic: Force MOD download |
maxxis95 |
General Member Since: Aug 28, 2012 Posts: 55 Last: Sep 17, 2012 [view latest posts] |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
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. |
|
|
|
maxxis95 |
General Member Since: Aug 28, 2012 Posts: 55 Last: Sep 17, 2012 [view latest posts] |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
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. |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
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. |
|
|
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
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.
|
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
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" |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
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. |
|
|
|