• Print

Author Topic: Build & War  (Read 4868 times)

0 Members and 1 Guest are viewing this topic.

Offline Spider

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Build & War
« on: June 10, 2013, 07:23:37 pm »
I was just wondering if there could be a command in ULX that enables and disables both noclip and godmode in sandbox. I mean the sandbox cvar not the ulx command.
Okay, I'm new to editing ulx commands and I kinda just guessed on this one but this is the basic I came up with:
local CATEGORY_NAME = "Admin"


------------------------------ Admin --------------------------
function ulx.build( should_war )
                v:ConCommand("sbox_godmode 1")
                v:ConCommand("sbox_noclip 1")
                v:ChatPrint("The server has been changed to war/build.")
            else
                v:ConCommand("sbox_noclip 0")
      v:ConCommand("sbox_godmode 0")
            end
    end
   
    if not should_war then
        ulx.fancyLogAdmin( calling_ply, "#A Changed the mode of the server",  )
    else
        ulx.fancyLogAdmin( calling_ply, "#A changed the mode of the serverr.", )
    end
end

local build = ulx.command( CATEGORY_NAME, "ulx build", ulx.build, "!build" )
build:addParam{ type=ULib.cmds.PlayersArg }
build:addParam{ type=ULib.cmds.BoolArg, invisible=true }
build:defaultAccess( ULib.ACCESS_SUPERADMIN )
build:setOpposite( "ulx war", {_, _, true}, "!war" )

Sorry its super sloppy and bad, but I hope it helps do some stuff.
Thanks in advance

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Build & War
« Reply #1 on: June 11, 2013, 08:05:08 am »
Untested, but this should be closer to what you want:

Code: Lua
  1. function ulx.build( calling_ply, should_war )
  2.     if not should_war then
  3.         game.ConsoleCommand("sbox_godmode 1\n")
  4.         game.ConsoleCommand("sbox_noclip 1\n")
  5.         ulx.fancyLogAdmin( calling_ply, "#A changed the server to build mode" )
  6.     else
  7.         game.ConsoleCommand("sbox_noclip 0\n")
  8.         game.ConsoleCommand("sbox_godmode 0\n")
  9.         ulx.fancyLogAdmin( calling_ply, "#A changed the server to war mode" )
  10.     end
  11. end
  12.  
  13. local build = ulx.command( "Utility", "ulx build", ulx.build, "!build" )
  14. build:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  15. build:defaultAccess( ULib.ACCESS_SUPERADMIN )
  16. build:setOpposite( "ulx war", {_, true}, "!war" )
Experiencing God's grace one day at a time.

  • Print