• Print

Author Topic: How would I do this?  (Read 4212 times)

0 Members and 1 Guest are viewing this topic.

Offline lamb201

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
How would I do this?
« on: September 19, 2013, 01:29:35 pm »
Ok, so I was trying to make a command like !respected to promote someone to that rank, it worked however I cannot make an opposite of this command - it just wont work here it is:
Code: Lua
  1. function ulx.addrespected( calling_ply, target_ply, should_unrespected )
  2.         local userInfo = ULib.ucl.authed[ target_ply:UniqueID() ]
  3.  
  4.         local id = ULib.ucl.getUserRegisteredID( target_ply )
  5.         if not id then id = target_ply:SteamID() end
  6.        
  7.         if not should_unrespected then
  8.  
  9.                 ULib.ucl.addUser( id, userInfo.allow, userInfo.deny, "respected")
  10.  
  11.         elseif target_ply:IsUserGroup("respected") then
  12.  
  13.                 ULib.ucl.removeUser( target_ply:UniqueID() )
  14.  
  15.         end
  16.  
  17.         if not should_unrespected then
  18.                 ulx.fancyLogAdmin( calling_ply, "#A has promoted #T to Respected! Congratulations #T", target_ply, target_ply )
  19.         else
  20.                 ulx.fancyLogAdmin( calling_ply, "#A has demoted #T from Respected! Unlucky #T", target_ply, target_ply )
  21.         end
  22. end
  23. local addrespected = ulx.command( CATEGORY_NAME, "ulx respected", ulx.addrespected, "!respected" )
  24. addrespected:addParam{ type=ULib.cmds.PlayerArg, target="!^" }
  25. addrespected:defaultAccess( ULib.ACCESS_ADMIN )
  26. addrespected:help( "Promote player to rank Respected, DO NOT ABUSE." )
  27. addrespected:setOpposite( "ulx unrespected", {_, _, true}, "!unrespected" )

I don't know whats the deal with it, but whenever I called ulx unrespected - it promotes them to respected, any ideas?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: How would I do this?
« Reply #1 on: September 19, 2013, 05:43:00 pm »
Try it with ULib.ucl.removeUser( id ).
Experiencing God's grace one day at a time.

  • Print