Advertisement
errur

noclipbutton.nut

Mar 3rd, 2016
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. DEBUG <- true;
  2.  
  3. function debugPrint( text )
  4. {
  5.     if(DEBUG == false)
  6.         return;
  7.     printl(text);
  8. }
  9.  
  10. function InputUse()     //Name and case is important!! In this case the function is set to run automatically on the Use input.
  11. {
  12.     debugPrint("You pressed the button.");
  13.    
  14.     if(activator.GetClassname() == "player")
  15.     {  
  16.         player <-   activator;      //or just use the activator handle directly bellow
  17.         if(player.IsNoclipping() == true)
  18.         {
  19.             ScriptPrintMessageChatAll("You pressed the button while in noclip!");        
  20.             SendToConsole("noclip");        //this will probably affect all other players!
  21.             EntFireByHandle(player, "SetHealth", "0", 0, player, player);
  22.         }    
  23.         else
  24.         {
  25.             ScriptPrintMessageChatAll("You pressed the button while not noclipping.")
  26.         }
  27.     }
  28.     else
  29.     {
  30.         //Something used the button but it wasn't a player.
  31.     }
  32.     debugPrint("InputUse() has been executed.");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement