PDA

View Full Version : Door Open


shavit
01-11-2012, 11:50
i want a plugin that will sm_open will open all func_door or func_movinglinear and sm_close will "close" them, thanks!

iGENIUS
01-11-2012, 12:21
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

new iEnt;
new const String:EntityList[][] = { "func_door", "func_movinglinear" };

public OnPluginStart()
{
RegConsoleCmd("sm_open", OnOpenCommand);
RegConsoleCmd("sm_close", OnCloseCommand);
}

public Action:OnOpenCommand(client, args)
{
for(new i = 0; i < sizeof(EntityList); i++)
while((iEnt = FindEntityByClassname(iEnt, EntityList[i])) != -1)
AcceptEntityInput(iEnt, "Open");

return Plugin_Handled;
}

public Action:OnCloseCommand(client, args)
{
for(new i = 0; i < sizeof(EntityList); i++)
while((iEnt = FindEntityByClassname(iEnt, EntityList[i])) != -1)
AcceptEntityInput(iEnt, "Close");

return Plugin_Handled;
}

shavit
01-12-2012, 03:36
Thanks! how to make it will have func_movinglinear too?

iGENIUS
01-12-2012, 05:43
Thanks! how to make it will have func_movinglinear too?

Check above, just updated my post.

shavit
01-12-2012, 07:42
great, thanks!