AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved Safe room L4D2 (https://forums.alliedmods.net/showthread.php?t=328038)

ricksfishin 10-23-2020 11:55

Safe room L4D2
 
Need plugin or Something where tank can get through Safe room door at start of map, When it's closed
Thanks

Marttt 10-23-2020 23:27

Re: Safe room L4D2
 
You can try this,

https://forums.alliedmods.net/showthread.php?p=2700212

ricksfishin 10-24-2020 11:28

Re: Safe room L4D2
 
Thanks Marttt I am already using that plugin. wanting tank to break through saferoom door for players who might not open the door and just farm tanks. I only have tanks on my server maps'

Marttt 10-24-2020 13:14

Re: Safe room L4D2
 
You mean that the tanks spawns before the saferoom opens?
Well you might just take a look in the Silvers code and force the same behavior on player_spawn (maybe)

Bacardi 10-24-2020 19:37

Re: Safe room L4D2
 
1 Attachment(s)
Now I have test much.

*edit
*edit
*edit
*edit
Updated code.

Checkpoint Exit Door will be forced to open after 30 seconds at round start.
- To get door open automatically, there should be bots or players in team survivor.

PHP Code:

#include <sdktools>

Handle TimerCheckpointDoor;
bool DoOnce;

public 
void OnPluginStart()
{
    
HookEventEx("round_freeze_end"round_freeze_end);
    
HookEventEx("player_first_spawn"player_first_spawn);
}


public 
void round_freeze_end(Event event, const char[] namebool dontBroadcast)
{
    
// when map start

    
DoOnce false;

    if(
TimerCheckpointDoor == null) return;

    
delete TimerCheckpointDoor;
}


public 
void player_first_spawn(Event event, const char[] namebool dontBroadcast)
{
    
// Timer already executed
    
if(DoOnce || TimerCheckpointDoor != null) return;


    
int client GetClientOfUserId(event.GetInt("userid"));
    
    
// Don't check unnecessary events. Only players in team survivor
    
if(client == || !IsClientInGame(client) || GetClientTeam(client) != 2) return;

    
char doorname[30];
    
int door = -1;


    
int entity = -1;
    
    while( (
entity FindEntityByClassname(entity"prop_door_rotating_checkpoint")) != -)
    {
        
//PrintToServer("m_hasUnlockSequence %i,   %i", GetEntProp(entity, Prop_Data, "m_hasUnlockSequence"), entity);
        
GetEntPropString(entityProp_Data"m_iName"doornamesizeof(doorname));
        
        if(
StrEqual(doorname"checkpoint_exit"false))
        {
            
// yes
            
door entity;
            break;
        }
        else if(
StrEqual(doorname"checkpoint_entrance"false))
        {
            
// skip
            
continue;
        }
        else if(
GetEntProp(entityProp_Data"m_hasUnlockSequence") == 1)
        {
            
// empty targetname ex. Look door m_hasUnlockSequence
            
door entity;
            break;
        }
    }


    if(
door == -1) return;


    
SetVariantString("OnOpen !self:Lock::0.1:1");
    
AcceptEntityInput(door"AddOutput");
    
    
SetVariantString("OnUser1 !self:playeropen::0.1:1");
    
AcceptEntityInput(door"AddOutput");

    
SetVariantString("OnUser1 !self:playeropen::1.0:1");
    
AcceptEntityInput(door"AddOutput");
    
    
PrintToChatAll("\x05[SM] \x04Checkpoint Exit Door \x05will be forced open in 30 seconds");

    
DoOnce true;
    
TimerCheckpointDoor CreateTimer(30.0OpenDoorEntIndexToEntRef(door));
}

public 
Action OpenDoor(Handle timerint ref)
{
    
TimerCheckpointDoor null;

    
int door EntRefToEntIndex(ref);

    if(
door != -1)
    {
        for(
int i 1<= MaxClientsi++)
        {
            if(!
IsClientInGame(i) || GetClientTeam(i) != 2) continue;

            
AcceptEntityInput(door"FireUser1"i);
            
PrintToChatAll("\x05[SM] \x04Checkpoint Exit Door \x05will be forced open!");
            break;
        }
    }



ricksfishin 10-25-2020 15:27

Re: Safe room L4D2
 
Bacardi compiled fine I did restart of server and made a few map changes But the door never opened.

Bacardi 10-25-2020 16:21

Re: Safe room L4D2
 
In which map ?
*edit
Ouh, I think it is event round_freeze_end. It works only mp_restartgame.

ricksfishin 10-25-2020 16:58

Re: Safe room L4D2
 
Sorry forgot all maps are finale maps. Tank only server Tried on c2m5_concert,c4m5_milltown_escape and c3m4_plantation

Bacardi 10-25-2020 21:01

Re: Safe room L4D2
 
Ok, good you tell those maps.

- c4m5_milltown_escape map didn't event trigger event player_entered_checkpoint until player step out room.
- some maps don't have targetname.
- and in my previous code, timer work too early. I changed to common, player_spawn event.

Try plugin again, from my previous post.

It should work.

ricksfishin 10-25-2020 22:43

Re: Safe room L4D2
 
Thank you Bacardi works great. If i may ask when you restart game mp_restartgame it doesn't work
And if possible could you change PrintToChatAll to PrintCenterText Exit door will be forced open in 30 seconds.Thanks

Bacardi 10-26-2020 06:00

Re: Safe room L4D2
 
1 Attachment(s)
Ok
- Change event round_freeze_end -> round_start_pre_entity
players spawn before round_freeze_end and round_start

- Change event player_first_spawn -> player_spawn
works now on mp_restartgame

- Change PrintToChatAll -> PrintHintTextToAll
In this game, PrintCenterTextAll font is annoying small, can't read.

- First announce will appear 10 seconds after player spawn.
after 30 seconds second announce appear and open door (if there are players in team survivor, otherwise this will not work)

ricksfishin 10-26-2020 08:38

Re: Safe room L4D2
 
Bacardi Works great thank you very much.


All times are GMT -4. The time now is 05:38.

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