• Print

Author Topic: setOpposite  (Read 5358 times)

0 Members and 1 Guest are viewing this topic.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
setOpposite
« on: May 07, 2015, 11:03:48 pm »
Can someone help me figure out what I'm doing wrong with the setOpposite?  It seems to put the true value in the groups slot when it should be putting it in the 4th argument (not counting calling_ply).   Perhaps I'm just confused because it's late and I'm tired, but I can't figure it out for my life.

Code: Lua
  1. function ulx.restrict( calling_ply, type, target, groups, should_remove )
  2.  
  3. end
  4. local restrict = ulx.command( CATEGORY_NAME, "ulx restrict", ulx.restrict )
  5. restrict:addParam{ type=ULib.cmds.StringArg, hint="type", completes=urs.types.restrictions, ULib.cmds.restrictToCompletes }
  6. restrict:addParam{ type=ULib.cmds.StringArg, hint="target or group" }
  7. restrict:addParam{ type=ULib.cmds.StringArg, hint="groups", ULib.cmds.takeRestOfLine, ULib.cmds.optional }
  8. restrict:setOpposite( "ulx unrestrict", {_, _, _, _, true}, "!unrestrict" )
« Last Edit: May 07, 2015, 11:11:36 pm by Aaron113 »

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: setOpposite
« Reply #1 on: May 07, 2015, 11:12:48 pm »
Okay, change to my question.  Why is it now returning nil?  It was either returning nil or going in groups.  I figured out that you guys include calling_ply.  So that issue is fixed, but now it is always nil for should_remove.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: setOpposite
« Reply #2 on: May 07, 2015, 11:34:06 pm »
Theres no function or anything for should_remove, thats probably why?
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: setOpposite
« Reply #3 on: May 08, 2015, 12:52:02 am »
If I remember right, you need to add should_remove as a boolean parameter. I believe I did something like this for setOpposite on some of my own commands:
Code: [Select]
restrict:addParam{ type=ULib.cmds.BoolArg, invisible=true }
« Last Edit: May 08, 2015, 12:53:58 am by Decicus »
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: setOpposite
« Reply #4 on: May 08, 2015, 04:29:33 am »
What decicus says.
You're only passing your function 4 parameters, but it's expecting 5.
SetOpposite isn't a variable that's passed to the function.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: setOpposite
« Reply #5 on: May 08, 2015, 08:07:22 am »
You guys are exactly right.  I must have been tired.  I could have easily figured that out myself.  I have never used it until now and it doesn't work how I was expecting it to heh.

  • Print