Raised This Month: $ Target: $400
 0% 

Opening doors automatically L4D2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fleepster99
Senior Member
Join Date: Apr 2010
Old 07-18-2010 , 05:58   Opening doors automatically L4D2
Reply With Quote #1

Hi im working on a plugin for l4d2 and im trying to see if there is a way of unlocking all doors in a chapter at the beginning of the map(or maybe at a specific radius of all players)
Unlocking or removing would be fine but the aim is that the doors should be open by the time the survivors gets to them.
Thanks
Fleepster99 is offline
dYZER
Member
Join Date: Jan 2010
Location: Germany
Old 07-18-2010 , 06:19   Re: Opening doors automatically L4D2
Reply With Quote #2

didnt know if this working for doors, but for gascan working like
AcceptEntityInput(entity, "break");
try "use" or "open" "unlock"...

AcceptEntityInput

Syntax: native bool:AcceptEntityInput(dest, const String:input[], activator=-1, caller=-1, outputid=0);
Usage: dest Destination entity index.
input Input action.
activator Entity index which initiated the sequence of actions (-1 for a NULL entity).
caller Entity index from which this event is sent (-1 for a NULL entity).
outputid Unknown.Notes: Invokes a named input method on an entity. After completion (successful or not), the current global variant is re-initalized.
Return: True if successful otherwise false.
Version Added:1.0.0.1946
On error / Errors: Invalid entity index or no mod support.
dYZER is offline
Fleepster99
Senior Member
Join Date: Apr 2010
Old 07-18-2010 , 14:15   Re: Opening doors automatically L4D2
Reply With Quote #3

Quote:
Originally Posted by dYZER View Post
didnt know if this working for doors, but for gascan working like
AcceptEntityInput(entity, "break");
try "use" or "open" "unlock"...

AcceptEntityInput

Syntax: native bool:AcceptEntityInput(dest, const String:input[], activator=-1, caller=-1, outputid=0);
Usage: dest Destination entity index.
input Input action.
activator Entity index which initiated the sequence of actions (-1 for a NULL entity).
caller Entity index from which this event is sent (-1 for a NULL entity).
outputid Unknown.Notes: Invokes a named input method on an entity. After completion (successful or not), the current global variant is re-initalized.
Return: True if successful otherwise false.
Version Added:1.0.0.1946
On error / Errors: Invalid entity index or no mod support.
Thanks for the info but could you give me an example of how i could use this ?
Fleepster99 is offline
Fleepster99
Senior Member
Join Date: Apr 2010
Old 07-18-2010 , 15:01   Re: Opening doors automatically L4D2
Reply With Quote #4

Well i found some code for a similar task
Quote:
new ent20 = -1;
new prev20 = 0;
while ((ent20 = FindEntityByClassname(ent20, "weapon_autoshotgun")) != -1)
Obviously this is to remove the shotgun i tried replacing "weapon_autoshotgun" with prop_rotating_door and it didnt work im not sure that is the right entity name but i cant seem to find anything else in the entity list.
Fleepster99 is offline
dYZER
Member
Join Date: Jan 2010
Location: Germany
Old 07-18-2010 , 15:10   Re: Opening doors automatically L4D2
Reply With Quote #5

PHP Code:
    HookEvent("round_start"Event_RoundStartEventHookMode_PostNoCopy);


public 
Action:Event_RoundStart(Handle:eventString:name[], bool:dontBroadcast)
{
    new 
EntCount GetEntityCount();
    new 
String:EdictName[128];
    for (new 
0<= EntCounti++)
    {
    if (
IsValidEntity(i))
        {
            
GetEdictClassname(iEdictNamesizeof(EdictName));
           
// PrintToServer("EdictName %s",EdictName); //debug list all edicts
            
            
if (StrContains(EdictName"prop_door_rotating"false) != -1)
            {
                
AcceptEntityInput(i"use"); //kill:)  didnt know the command 4 doors
                
continue;
            }
        }    
    }

dYZER is offline
-Absolute-
Member
Join Date: Mar 2010
Old 07-18-2010 , 16:54   Re: Opening doors automatically L4D2
Reply With Quote #6

better this one

PHP Code:
    HookEvent("round_start"Event_RoundStartEventHookMode_PostNoCopy);


public 
Action:Event_RoundStart(Handle:eventString:name[], bool:dontBroadcast)
{

    new 
ent = -1;
    while ((
ent FindEntityByClassname(ent"prop_door_rotating")) !=  -1)                      
    {
                
AcceptEntityInput(ent"open");   
    }
    
ent = -1;
    while ((
ent FindEntityByClassname(ent"func_door")) !=  -1)                      
    {
                
AcceptEntityInput(ent"open");   
    }
    
ent = -1;
    while ((
ent FindEntityByClassname(ent"func_door_rotating")) !=  -1)                      
    {
                
AcceptEntityInput(ent"open");   
    }

-Absolute- is offline
Fleepster99
Senior Member
Join Date: Apr 2010
Old 07-18-2010 , 20:51   Re: Opening doors automatically L4D2
Reply With Quote #7

Thanks for the code but i tried both of your scripts and neither of them made a difference, all doors still remain shut i even tried both scripts as seperate plugins and nothing changed. Im hoping i made some kindof stupid mistake but i dont think i did. Any help please

One thing i just noticed was that all safehouse doors(the end ones) are being closed automatically with your code dYZER and all doors remain the same, with Absolute's code no changes on the doors

*Edit*
Dyzer on your code i replaced "use" with Kill and it kindof worked the problem now is i dont have a safehouse door xD Any clue on how to not remove it?, also i though that door was called prop_door_rotating_checkpoint,so i wonder if its being removed because the entity name is almost identical :S .


*Edit#12*
Finally got it to work guys thanks for your help, Heres the final code for the doors if anyone out there is interested .
Quote:
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);

}

public Action:Event_RoundStart(Handle:event, String:name[], bool:dontBroadcast)
{
new EntCount = GetEntityCount();
new String:EdictName[128];
for (new i = 0; i <= EntCount; i++)
{
if (IsValidEntity(i))
{
GetEdictClassname(i, EdictName, sizeof(EdictName));
// PrintToServer("EdictName %s",EdictName); //debug list all edicts

if (StrContains(EdictName, "prop_door_rotating_checkpoint", false) != -1)
{
AcceptEntityInput(i, "Open"); //kill didnt know the command 4 doors im pretty sure "open doesn't do anything"
continue;
}
else if (StrContains(EdictName, "prop_door_rotating", false) != -1)
{
AcceptEntityInput(i, "Kill"); //kill didnt know the command 4 doors
}
}
}
}

Last edited by Fleepster99; 07-19-2010 at 01:46. Reason: new info
Fleepster99 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 19:17.


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