Raised This Month: $ Target: $400
 0% 

door_moving event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 01-05-2011 , 23:42   door_moving event
Reply With Quote #1

There wasn't a lot of documentation available for the door_moving event so the following code will let you see the entity index of the door that's moving when the event is called and the door first begins its motion.

PHP Code:
#include <sourcemod>
#include <sdktools>

#define VERSION "1.0"

public Plugin:myinfo = {
    
name "Door Move",
    
author "databomb",
    
description "temporary plugin for door moving event",
    
version VERSION,
    
url ""
};

public 
OnPluginStart()
{
    
CreateConVar("sm_doormove_version"VERSION"Current version of this plugin"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
HookEvent("door_moving",Event_DoorMove);
}

public 
Action:Event_DoorMove(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
entityidx GetEventInt(event"entindex");
    
    
LogMessage("door move ent idx %i"entityidx);

    return 
Plugin_Continue;

You should also be able to grab the userid of the player who triggered the door move but I wasn't having any luck as they all returned as 0.

What I noticed was that doors that don't slide won't trigger this event, that is, normal doors in houses that pivot along a fixed point do not utilize this event. Anything that slides on a fixed axis seems to trigger the event such as a glass door or cell door.

This event could prove useful in jailbreak servers with rules that cell doors must be open by a certain time. Typically there's a master control button that will trigger multiple door_moving events all at one time so you can easily tell if the cell doors were opened by a certain time. If not you could certainly grab the entity indexes and trigger the events, which would be map-specific, but it's also feasible that triggering all doors on the level could work as well.

These comments probably aren't helpful to anyone right now but maybe someone in the future could use this info for a different plugin.
databomb is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 01-06-2011 , 17:46   Re: door_moving event
Reply With Quote #2

Hooking inputs is better i think.
__________________
FaTony is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-01-2011 , 20:33   Re: door_moving event
Reply With Quote #3

Good call, using the hooking for the open triggers is more versatile because you can hook 'func_door_rotating' as well which cover doors that don't trigger the 'door_moving' event.

HookEntityOutput("func_door", "OnOpen", OnDoorOpenHook);
databomb 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 03:43.


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