Advertisement
Guest User

/DoorKick

a guest
Nov 20th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  1. local COMMAND = Clockwork.command:New("DoorKick");
  2.     COMMAND.tip = "Kick a door open!";
  3.     COMMAND.flags = CMD_DEFAULT;
  4.    
  5.     -- Called when the command has been run.
  6.     function COMMAND:OnRun(player, arguments)
  7.             local door = player:GetEyeTraceNoCursor().Entity;
  8.             local trace = player:GetEyeTraceNoCursor();
  9.             local target = trace.Entity;
  10.          
  11.             if ( IsValid(door) and Clockwork.entity:IsDoor(door) ) then
  12.                     if (faction == FACTION_OTA or faction == FACTION_MPF or faction == FACTION_RESISTANCE) then
  13.                                     if (target:GetPos():Distance( player:GetShootPos() ) <= 64) then
  14.                                             if door:GetClass()=="prop_door_rotating" then
  15.    
  16.                                                     player:SetForcedAnimation("kickdoorbaton", 2);
  17.                                                     timer.Simple( .55, function() Clockwork.entity:OpenDoor(target, 0, true, true) end );
  18.                                             else
  19.                                                     Clockwork.player:Notify(player, "This is not a Valid Door!");
  20.                                             end;
  21.                                     else
  22.                                             Clockwork.player:Notify(player, "Door is too far away!");
  23.                                     end;
  24.                     else
  25.                             Clockwork.player:Notify(player, "You are not trained in kicking down doors!");
  26.                     end;
  27.             else
  28.                     Clockwork.player:Notify(player, "This is not a valid door!");
  29.             end;
  30.     end;
  31.    
  32.     COMMAND:Register();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement