• Print

Author Topic: ULX rolled over to the new command system  (Read 16536 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
ULX rolled over to the new command system
« on: September 20, 2009, 08:54:28 pm »
I just moved ULX over to the new command system. Let me know of any issues you will undoubtedly have, since this can pretty much be considered a substantial rewrite of ULX. Also let me know how you like the new system and the permissions that go along with it.  :D
Experiencing God's grace one day at a time.

Offline atomicspark

  • Full Member
  • ***
  • Posts: 196
  • Karma: 12
Re: ULX rolled over to the new command system
« Reply #1 on: September 20, 2009, 09:55:13 pm »
Yay! :D

Now hurry up and port the rest over. :P

Offline NaRyan

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: ULX rolled over to the new command system
« Reply #2 on: September 20, 2009, 11:17:18 pm »
I can't get the ULX menu to work now :(
Typing ulx menu in to console does nothing, just gives a "Invalid command entered. If you need help, please type "ulx help" in your console."
Typing !menu in chat does nothing either.

Ulib r89
ULX r63
« Last Edit: September 20, 2009, 11:24:42 pm by NaRyan »

Offline atomicspark

  • Full Member
  • ***
  • Posts: 196
  • Karma: 12
Re: ULX rolled over to the new command system
« Reply #3 on: September 20, 2009, 11:54:57 pm »
What zee did you do to ULX Jail? Sure you can't kill (the actual command) yourself, but you can still die. When you do, you can't respawn and it's all glitchy. Here, let me help you fix it:

Code: Text
  1. ------------------------------ Jail ------------------------------
  2. function ulx.jail( calling_ply, target_plys, seconds, should_unjail )
  3.         local mdl1 = Model( "models/props_c17/fence01b.mdl" )
  4.         local mdl2 = Model( "models/props_c17/fence02b.mdl" )
  5.         local jail = {
  6.                 { pos = Vector( 35, 0, 60 ), ang = Angle( 0, 0, 0 ), mdl=mdl2 },
  7.                 { pos = Vector( -35, 0, 60 ), ang = Angle( 0, 0, 0 ), mdl=mdl2 },
  8.                 { pos = Vector( 0, 35, 60 ), ang = Angle( 0, 90, 0 ), mdl=mdl2 },
  9.                 { pos = Vector( 0, -35, 60 ), ang = Angle( 0, 90, 0 ), mdl=mdl2 },
  10.                 { pos = Vector( 0, 0, 110 ), ang = Angle( 90, 0, 0 ), mdl=mdl1 },
  11.                 { pos = Vector( 0, 0, -5 ), ang = Angle( 90, 0, 0 ), mdl=mdl1 },
  12.         }
  13.  
  14.         local i = 1
  15.         while i <= #target_plys do
  16.                 local v = target_plys[ i ]
  17.  
  18.                 if not should_unjail then
  19.                         if v.jail then -- They're already jailed
  20.                                 v.jail.unjail()
  21.                         end
  22.  
  23.                         if ulx.getExclusive( v, calling_ply ) then
  24.                                 ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  25.                                 table.remove( target_plys, i )
  26.                         else
  27.                                 if v:InVehicle() then
  28.                                         local vehicle = v:GetParent()
  29.                                         v:ExitVehicle()
  30.                                         vehicle:Remove()
  31.                                 end
  32.  
  33.                                 if v:GetMoveType() == MOVETYPE_NOCLIP then -- Take them out of noclip
  34.                                         v:SetMoveType( MOVETYPE_WALK )
  35.                                 end
  36.  
  37.                                 local pos = v:GetPos()
  38.  
  39.                                 local walls = {}
  40.                                 for _, info in ipairs( jail ) do
  41.                                         local ent = ents.Create( "prop_physics" )
  42.                                         ent:SetModel( info.mdl )
  43.                                         ent:SetPos( pos + info.pos )
  44.                                         ent:SetAngles( info.ang )
  45.                                         ent:Spawn()
  46.                                         ent:GetPhysicsObject():EnableMotion( false )
  47.                                         ent.jailWall = true
  48.                                         table.insert( walls, ent )
  49.                                 end
  50.  
  51.                                 local key = {}
  52.                                 local function unjail()
  53.                                         if not v:IsValid() or not v.jail or v.jail.key ~= key then -- Nope
  54.                                                 return
  55.                                         end
  56.  
  57.                                         for _, ent in ipairs( walls ) do
  58.                                                 if ent:IsValid() then
  59.                                                         ent:DisallowDeleting( false )
  60.                                                         ent:Remove()
  61.                                                 end
  62.                                         end
  63.                                         if not v:IsValid() then return end -- Make sure they're still connected
  64.  
  65.                                         v:DisallowNoclip( false )
  66.                                         v:DisallowSpawning( false )
  67.                                         v:DisallowVehicles( false )
  68.  
  69.                                         ulx.clearExclusive( v )
  70.                                         ulx.setNoDie( v, false )
  71.  
  72.                                         v.jail = nil
  73.                                 end
  74.                                 if seconds > 0 then
  75.                                         timer.Simple( seconds, unjail )
  76.                                 end
  77.  
  78.                                 local function newWall( old, new )
  79.                                         table.insert( walls, new )
  80.                                 end
  81.  
  82.                                 for _, ent in ipairs( walls ) do
  83.                                         ent:DisallowDeleting( true, newWall )
  84.                                         ent:DisallowMoving( true )
  85.                                 end
  86.                                 v:DisallowNoclip( true )
  87.                                 v:DisallowSpawning( true )
  88.                                 v:DisallowVehicles( true )
  89.                                 v.jail = { pos=pos, unjail=unjail, key=key }
  90.                                 ulx.setExclusive( v, "in jail" )
  91.                                 ulx.setNoDie( v, true )
  92.                                 i = i + 1
  93.                         end
  94.                 elseif v.jail then
  95.                         v.jail.unjail()
  96.                         v.jail = nil
  97.                         i = i + 1
  98.                 else
  99.                         table.remove( target_plys, i )
  100.                 end
  101.         end
  102.  
  103.         return #target_plys > 0
  104. end
  105. local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  106. jail:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
  107. jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, forever is 0", ULib.cmds.round, ULib.cmds.optional }
  108. jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  109. jail:defaultAccess( ULib.ACCESS_ADMIN )
  110. jail:help( "Jails target(s)." )
  111. jail:logString( "#1s jailed #2s for #3i seconds" )
  112. jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
  113. jail:oppositeLogString( "#1s unjailed #2s" )
  114. ulx.addToMenu( ulx.ID_MCLIENT, "Jail", "ulx jail" )
  115. ulx.addToMenu( ulx.ID_MCLIENT, "Unjail", "ulx unjail" )
  116.  
  117. local function jailDisconnectedCheck( ply )
  118.         if ply.jail then
  119.                 ply.jail.unjail()
  120.         end
  121. end
  122. hook.Add( "PlayerDisconnected", "ULXJailDisconnectedCheck", jailDisconnectedCheck )

Code: Text
  1. ------------------------------ Jail ------------------------------
  2. function ulx.jail( calling_ply, target_plys, seconds, should_unjail )
  3.         local mdl1 = Model( "models/props_c17/fence01b.mdl" )
  4.         local mdl2 = Model( "models/props_c17/fence02b.mdl" )
  5.         local jail = {
  6.                 { pos = Vector( 35, 0, 60 ), ang = Angle( 0, 0, 0 ), mdl=mdl2 },
  7.                 { pos = Vector( -35, 0, 60 ), ang = Angle( 0, 0, 0 ), mdl=mdl2 },
  8.                 { pos = Vector( 0, 35, 60 ), ang = Angle( 0, 90, 0 ), mdl=mdl2 },
  9.                 { pos = Vector( 0, -35, 60 ), ang = Angle( 0, 90, 0 ), mdl=mdl2 },
  10.                 { pos = Vector( 0, 0, 110 ), ang = Angle( 90, 0, 0 ), mdl=mdl1 },
  11.                 { pos = Vector( 0, 0, -5 ), ang = Angle( 90, 0, 0 ), mdl=mdl1 },
  12.         }
  13.  
  14.         local i = 1
  15.         while i <= #target_plys do
  16.                 local v = target_plys[ i ]
  17.  
  18.                 if not should_unjail then
  19.                         if v.jail then -- They're already jailed
  20.                                 v.jail.unjail()
  21.                         end
  22.  
  23.                         if ulx.getExclusive( v, calling_ply ) then
  24.                                 ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  25.                                 table.remove( target_plys, i )
  26.                         else
  27.                                 if v:InVehicle() then
  28.                                         local vehicle = v:GetParent()
  29.                                         v:ExitVehicle()
  30.                                         vehicle:Remove()
  31.                                 end
  32.  
  33.                                 if v:GetMoveType() == MOVETYPE_NOCLIP then -- Take them out of noclip
  34.                                         v:SetMoveType( MOVETYPE_WALK )
  35.                                 end
  36.  
  37.                                 local pos = v:GetPos()
  38.  
  39.                                 local walls = {}
  40.                                 for _, info in ipairs( jail ) do
  41.                                         local ent = ents.Create( "prop_physics" )
  42.                                         ent:SetModel( info.mdl )
  43.                                         ent:SetPos( pos + info.pos )
  44.                                         ent:SetAngles( info.ang )
  45.                                         ent:Spawn()
  46.                                         ent:GetPhysicsObject():EnableMotion( false )
  47.                                         ent.jailWall = true
  48.                                         table.insert( walls, ent )
  49.                                 end
  50.  
  51.                                 local key = {}
  52.                                 local function unjail()
  53.                                         if not v:IsValid() or not v.jail or v.jail.key ~= key then -- Nope
  54.                                                 return
  55.                                         end
  56.  
  57.                                         for _, ent in ipairs( walls ) do
  58.                                                 if ent:IsValid() then
  59.                                                         ent:DisallowDeleting( false )
  60.                                                         ent:Remove()
  61.                                                 end
  62.                                         end
  63.                                         if not v:IsValid() then return end -- Make sure they're still connected
  64.  
  65.                                         v:DisallowNoclip( false )
  66.                                         v:DisallowSpawning( false )
  67.                                         v:DisallowVehicles( false )
  68.  
  69.                                         ulx.clearExclusive( v )
  70.  
  71.                                         v.jail = nil
  72.                                 end
  73.                                 if seconds > 0 then
  74.                                         timer.Simple( seconds, unjail )
  75.                                 end
  76.  
  77.                                 local function newWall( old, new )
  78.                                         table.insert( walls, new )
  79.                                 end
  80.  
  81.                                 for _, ent in ipairs( walls ) do
  82.                                         ent:DisallowDeleting( true, newWall )
  83.                                         ent:DisallowMoving( true )
  84.                                 end
  85.                                 v:DisallowNoclip( true )
  86.                                 v:DisallowSpawning( true )
  87.                                 v:DisallowVehicles( true )
  88.                                 v.jail = { pos=pos, unjail=unjail, key=key }
  89.                                 ulx.setExclusive( v, "in jail" )
  90.                                 i = i + 1
  91.                         end
  92.                 elseif v.jail then
  93.                         v.jail.unjail()
  94.                         v.jail = nil
  95.                         i = i + 1
  96.                 else
  97.                         table.remove( target_plys, i )
  98.                 end
  99.         end
  100.  
  101.         return #target_plys > 0
  102. end
  103. local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  104. jail:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
  105. jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, forever is 0", ULib.cmds.round, ULib.cmds.optional }
  106. jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  107. jail:defaultAccess( ULib.ACCESS_ADMIN )
  108. jail:help( "Jails target(s)." )
  109. jail:logString( "#1s jailed #2s for #3i seconds" )
  110. jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
  111. jail:oppositeLogString( "#1s unjailed #2s" )
  112. ulx.addToMenu( ulx.ID_MCLIENT, "Jail", "ulx jail" )
  113. ulx.addToMenu( ulx.ID_MCLIENT, "Unjail", "ulx unjail" )
  114.  
  115. local function jailSpawnCheck( ply )
  116.         if ply.jail then
  117.                 ply:SetPos( ply.jail.pos )
  118.         end
  119. end
  120. hook.Add( "PlayerSpawn", "ULXJailSpawnCheck", jailSpawnCheck )
  121.  
  122. local function jailDisconnectedCheck( ply )
  123.         if ply.jail then
  124.                 ply.jail.unjail()
  125.         end
  126. end
  127. hook.Add( "PlayerDisconnected", "ULXJailDisconnectedCheck", jailDisconnectedCheck )
  128.  
  129. local function jailDamageCheck( ent )
  130.         if ent.spawnpointProp then
  131.                 return false
  132.         end
  133. end
  134. hook.Add( "EntityTakeDamage", "ULXJailDamagedCheck", jailDamageCheck, -20 )

PROTIP: Get rid of ulx.setNoDie( v, bool ) in favor of the original jailSpawnCheck( ply ). I'm not sure if jailDamageCheck( ent ) actually does anything, but I threw it back in there.

Offline atomicspark

  • Full Member
  • ***
  • Posts: 196
  • Karma: 12
Re: ULX rolled over to the new command system
« Reply #4 on: September 21, 2009, 01:42:44 am »
I can't get the ULX menu to work now :(
Typing ulx menu in to console does nothing, just gives a "Invalid command entered. If you need help, please type "ulx help" in your console."
Typing !menu in chat does nothing either.

Ulib r89
ULX r63

Code: [Select]
Warning! Called deprecated function ULib.concommand. Use the functions under ULib.cmds.* now
The menu is currently broken and unless you beg a lot, might not be fixed. They're working on a new GUI for ULX, released as XGUI. It also is a WIP and the developer has been busy with real life things. If you really need a working menu, I might suggest reverting back to ULX rev. 61 or using the official release.

Offline NaRyan

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: ULX rolled over to the new command system
« Reply #5 on: September 21, 2009, 04:18:12 am »
Code: [Select]
Warning! Called deprecated function ULib.concommand. Use the functions under ULib.cmds.* now
The menu is currently broken and unless you beg a lot, might not be fixed. They're working on a new GUI for ULX, released as XGUI. It also is a WIP and the developer has been busy with real life things. If you really need a working menu, I might suggest reverting back to ULX rev. 61 or using the official release.

Yeah I went back to the older version of Ulib and ULX (yes I do make backups before installing a "major change" update, rare eh? ;) )
I also tried XGUI before changing back, but I get stuck with the receiving?? data problem.

Oh well who's leg do I have to hu... err Who do I bribe with cookies for the menu to get fixed? :P

Offline [WCA]AIDS

  • Jr. Member
  • **
  • Posts: 58
  • Karma: 7
    • PlanetWCA Forums
Re: ULX rolled over to the new command system
« Reply #6 on: September 21, 2009, 05:24:46 am »
Oh well who's leg do I have to hu... err Who do I bribe with cookies for the menu to get fixed? :P

Mine, err... Me.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX rolled over to the new command system
« Reply #7 on: September 21, 2009, 07:25:15 am »
Ah, forgot to move the menus over. I can do that today. :)
Experiencing God's grace one day at a time.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: ULX rolled over to the new command system
« Reply #8 on: September 21, 2009, 09:21:16 am »
I also tried XGUI before changing back, but I get stuck with the receiving?? data problem.

Oh dear, I thought I pushed the update to fix that a while ago  :-[

I'll push it as soon as I get home from school (2-3 more hours)
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX rolled over to the new command system
« Reply #9 on: September 23, 2009, 02:59:18 pm »
Menus work again. I'm honestly surprised how many of you actually use these menus when we focus so hard on making ULX an amazing console application.

These changes were brought to you while listening to the "American Idiot" album done by Vitamin String Quartet (linky). I like the beat but never liked the words, so this was pure amazing. :D
« Last Edit: September 23, 2009, 03:01:25 pm by Megiddo »
Experiencing God's grace one day at a time.

Offline NaRyan

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: ULX rolled over to the new command system
« Reply #10 on: September 24, 2009, 02:34:54 pm »
Yay!! I won't get moaned at now... *mutters*lazyadmins*mutters*

I prefer the console commands myself, I can never find the option I want in the menu.....  ::)
And by the time I do notice it, I could have typed it 10 times. :)

Offline Kenny_

  • Newbie
  • *
  • Posts: 29
  • Karma: 3
Re: ULX rolled over to the new command system
« Reply #11 on: September 29, 2009, 09:37:38 pm »
I've been having some problems with commands on my dedicated server. Sometimes it takes two or three tries to get a command to work. I haven't seen any errors in either console. It started happening when I updated to the latest versions of ULib and ULX.

Offline atomicspark

  • Full Member
  • ***
  • Posts: 196
  • Karma: 12
Re: ULX rolled over to the new command system
« Reply #12 on: September 29, 2009, 11:22:19 pm »
This happens to me as well *cough* Megiddo *cough*.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX rolled over to the new command system
« Reply #13 on: September 30, 2009, 03:16:32 pm »
Which commands, if any in particular?
One or two, some, all?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Kenny_

  • Newbie
  • *
  • Posts: 29
  • Karma: 3
Re: ULX rolled over to the new command system
« Reply #14 on: September 30, 2009, 03:37:13 pm »
I think it happens with all of them. I've had it happen with ulx noclip and all of the user management commands.

  • Print