Raised This Month: $32 Target: $400
 8% 

[L4D2 & L4D] Hunter Training Map Multiplayer Enabler


Post New Thread Reply   
 
Thread Tools Display Modes
eyeonus
Member
Join Date: Jul 2009
Old 08-22-2010 , 22:34   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #21

Quote:
Originally Posted by McFlurry View Post
PHP Code:
public OnMapStart()
new 
String:map[30];
GetCurrentMap(mapsizeof(map));
if(
StrEqual(map"htmname"false) || StrEqual(map"htmname2"false) || StrEqual(map"htmname3"false))
{
    
//register the command here

That should fix the issue.
Two things:
1) My maps begin with "hunter_training". They are "hunter_training.bsp", "hunter_training_map.bsp", and "hunter_training_c21.bsp". Is it possible to check just for "hunter_training", instead of having to do a check for each map individually?

2) I don't like the idea of making this plugin only work on my maps. Version 1.3.1 is fixed so that the plugin will not interfere with other plugins when it is turned off. I can use your example code to check to see if my map is the one being loaded and turn the plugin off:

PHP Code:
public OnMapStart()
new 
String:map[30];
GetCurrentMap(mapsizeof(map));
if(!
StrContains("hunter_training")) //see if "hunter_training" is in the name of the map
{
   
ServerCommand("l4d2_htm_mp_enable 0");

Assuming the StrContains bit works as I think, the above code would check to see if the map is one of mine, and if not, turn the plugin off. This would mean that the line "l4d2_htm_mp_enable 0" would not be needed in the server.cfg file, but would still allow server admins to enable the plugin on a different map if they wished.

I can see why it is desirable for this plugin to not interfere with other plugins. I can also see instances where a player would want to manually turn on this plugin- for example, if they wish to enable multiplayer training on a different map. On L4D2, such training requires this plugin- or at least one that does everything this one does- unless a listen server is used, in which case this plugin isn't needed in the first place.

To that end, I am thinking of adding a command to the plugin that would run the config that the Live Fire Course uses:

PHP Code:
public start_training(Handle:convar, const String:oldValue[], const String:newValue[]) {
    if (
GetConVarBool(training_toggle)) {
        
ServerCommand("l4d2_htm_mp_enable 1;god 1;vs_max_team_switches 99;sb_all_bot_team 1")
    } else {
        
ServerCommand("l4d2_htm_mp_enable 0")
    } 
Combined with the above, this would make it possible to do training on ANY map manually, and would cause the plugin to only be automatically turned on for HTM.
Attached Files
File Type: sp Get Plugin or Get Source (l4d2htm-multiplayer-enabler-v2.rc1.sp - 254 views - 4.4 KB)

Last edited by eyeonus; 08-22-2010 at 22:50.
eyeonus is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 08-22-2010 , 23:13   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #22

I'm not sure if the new version fixes it properly, you are registering the command on plugin start.
PHP Code:
if(StrContains(map"hunter_training"false))
{
    
RegConsoleCmd("give"give_health);
    
RegConsoleCmd("z_spawn"spawn_zombie);

I suggest this would fix it properly. Also your new version || stands for "or" so if 1 condition meets will go on to perform the action use && which pretty much means and so it will make sure all conditions meet before going on.
__________________

Last edited by McFlurry; 08-22-2010 at 23:37.
McFlurry is offline
Send a message via Skype™ to McFlurry
eyeonus
Member
Join Date: Jul 2009
Old 08-22-2010 , 23:31   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #23

I know C. I know what || and && mean.

As I've said multiple times since the one in which I announced version 1.3.1, this plugin will NOT interfere with any other plugins when it is turned off with "l4d_htm_mp_enable 0". I have verified this.


public Action:give_health(client, args) {
new String:arg[128];
GetCmdArg(1, arg, sizeof(arg));

if (StrEqual(arg, "health")||!GetConVarBool(enable_toggle)) { //Will return "Plugin_Continue" if the argument is "health" or the plugin is turned off.
return Plugin_Continue;
} else {
return Plugin_Handled;
}
}

public Action:spawn_zombie(client, args) {
new String:arg[128];
GetCmdArg(1, arg, sizeof(arg));

if ((StrEqual(arg, "witch")||StrEqual(arg, "tank"))&&(GetConVarBool(enable_toggle))) { //Will return "Plugin_Handled" IFF (the argument is "witch" or "tank") AND the plugin is turned on.
return Plugin_Handled;
} else {
return Plugin_Continue;
}
}
Attached Files
File Type: sp Get Plugin or Get Source (l4d2htm-multiplayer-enabler-v2.rc2.sp - 240 views - 4.4 KB)

Last edited by eyeonus; 08-22-2010 at 23:59.
eyeonus is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 08-23-2010 , 15:42   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #24

Yeah new version works properly, glad to have my cake and eat it too now.
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
eyeonus
Member
Join Date: Jul 2009
Old 08-23-2010 , 16:07   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #25

mmm... cake.
eyeonus is offline
eyeonus
Member
Join Date: Jul 2009
Old 08-23-2010 , 16:26   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #26

I tried enabling "respawn", but apparently it's like noclip- just removing the cheat flag isn't enough for it to work.

I would like to add it to the enabled list, or at least add something that will automatically respawn all survivors when used.

I'd also like to make it so that when all the survivors enter the end safe room, they are jumped back to the start area. If there is a function called when a survivor, or better, all survivors, have entered the end safe room, but have not closed the door, I could have the plugin respawn them at the beginning.
eyeonus is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 08-23-2010 , 17:11   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #27

There's an event that fires when a player enters the checkpoint area.
player_entered_checkpoint
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
eyeonus
Member
Join Date: Jul 2009
Old 08-23-2010 , 18:24   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #28

Quote:
Originally Posted by McFlurry View Post
There's an event that fires when a player enters the checkpoint area.
player_entered_checkpoint
Okay, so if I had the code to respawn survivors, that would enable me to send them back to the start of the map when they enter the end start room. Is there a plugin that has respawning code, or would I have to build it from scratch?
eyeonus is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 08-23-2010 , 18:31   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #29

The TeleportEntity function should be able to teleport players given their client index and the start position that they should be sent to.
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
eyeonus
Member
Join Date: Jul 2009
Old 08-23-2010 , 18:59   Re: [L4D2 & L4D] Hunter Training Map Multiplayer Enabler
Reply With Quote #30

Quote:
Originally Posted by McFlurry View Post
The TeleportEntity function should be able to teleport players given their client index and the start position that they should be sent to.
That would require an excessive amount of work, as it would require me to know the start position of every survivor on every map, which is 20 positions just for one campaign at 4 per map and 5 maps. Especially considering custom campaigns, that just isn't feasible.

The director command "ForceSurvivorPositions" would move all the survivors back to the start point without me needing to know what the start positions are, but has some of it's own drawbacks: I don't know how to make the director do that from a plugin, it affects only all the survivors, and it won't bring any of the survivors back from dead.

The cheat command "respawn" will take the existing survivor to the start position of the map, or, if the character is dead, respawn the character there. Like "noclip", just removing the cheat flag isn't enough to get it to work without "sv_cheats 1", which is why I was asking about the code.

I did a search, and I was able to find Advanced Commands, which can respawn a survivor, but that plugin is friggin' huge and even more badly commented than mine. I'm having trouble figuring out which bits are needed to perform respawning.

(It looks like the line "SDKCall(hRespawn,targets[i]);" is the one that actually does the job, so I'm certain that's needed.)

Last edited by eyeonus; 08-23-2010 at 19:48.
eyeonus is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode