only thing is that when I do the opposite command for notarget it does not un-notarget me. The command runs fine, no errors at all yet it is not disabling the notarget.
For setOpposite to work:
- Add a boolean parameter to your command. This is necessary in order to detect if the calling_ply wants to run the opposite version of the command.
example:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- Add this new parameter to your callback function (I called mine "opposite").
function ulx.example( calling_ply, opposite )
- Define the opposite version of your command.
example:setOpposite( "ulx unexample", { nil, true }, "!unexample" )
The second parameter of setOpposite allows you to override the parameters in the callback function. The values in that table (nil, true) correspond to the parameters of the callback (calling_ply, opposite). Use nil if you want to keep the original value. Use anything else to override the original value.
In the case of the example, we want to keep the original value of "calling_ply" but override "opposite" to be true.
You didn't add the boolean parameter to your command so ULX ignores the fact that you're trying to set "should_revoke" to "true" with setOpposite.