• Print

Author Topic: ULX Jail Reason.  (Read 8074 times)

0 Members and 1 Guest are viewing this topic.

Offline Greenlight7

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
ULX Jail Reason.
« on: August 23, 2013, 03:14:57 pm »
When I jail someone ingame, I type !jail <player> <seconds> <reason>
But it only shows <me> jailed <player> for <seconds>.

I want it to say <me> jailed <player> for <seconds> (<reason>) .

This is the lua code:
http://pastebin.com/8jX08pMW

I tried doing it and had some help. Still havent got it to work.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX Jail Reason.
« Reply #1 on: August 23, 2013, 08:55:24 pm »
You'll find that most developers won't respond to "do it for me" requests. Do some basic research and try making it work on your own. Tell us what you tried and show us your best attempt.
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: ULX Jail Reason.
« Reply #2 on: August 24, 2013, 07:16:48 am »
No promises this will work

Code: Lua
  1. ------------------------------ Jail ------------------------------
  2. local doJail
  3. local jailableArea
  4. function ulx.jail( calling_ply, target_plys, seconds, should_unjail, reason )
  5.         local affected_plys = {}
  6.         for i=1, #target_plys do
  7.                 local v = target_plys[ i ]
  8.  
  9.                 if not should_unjail then
  10.                         if ulx.getExclusive( v, calling_ply ) then
  11.                                 ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  12.                         elseif not jailableArea( v:GetPos() ) then
  13.                                 ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
  14.                         else
  15.                                 doJail( v, seconds )
  16.  
  17.                                 table.insert( affected_plys, v )
  18.                         end
  19.                 elseif v.jail then
  20.                         v.jail.unjail()
  21.                         v.jail = nil
  22.                         table.insert( affected_plys, v )
  23.                 end
  24.         end
  25.  
  26.         if not should_unjail then
  27.                 local str = "#A jailed #T (#s)"
  28.                 if seconds > 0 then
  29.                         str = str .. " for #i seconds. (#s)"
  30.                 end
  31.                 ulx.fancyLogAdmin( calling_ply, str, affected_plys, seconds )
  32.         else
  33.                 ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys )
  34.         end
  35. end
  36. local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  37. jail:addParam{ type=ULib.cmds.PlayersArg }
  38. jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
  39. jail:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine }
  40. jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  41. jail:defaultAccess( ULib.ACCESS_ADMIN )
  42. jail:help( "Jails target(s)." )
  43. jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
  44.  
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Greenlight7

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX Jail Reason.
« Reply #3 on: August 24, 2013, 07:55:58 am »
You'll find that most developers won't respond to "do it for me" requests. Do some basic research and try making it work on your own. Tell us what you tried and show us your best attempt.

Thats the best I could come up with.
http://pastebin.com/KCCSVqaL

Ingame it shows: Usage: !jail <name> <seconds> [{reason}]
but it doesnt work sadly

Offline Greenlight7

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX Jail Reason.
« Reply #4 on: August 24, 2013, 08:01:05 am »
No promises this will work

Code: Lua
  1. ------------------------------ Jail ------------------------------
  2. local doJail
  3. local jailableArea
  4. function ulx.jail( calling_ply, target_plys, seconds, should_unjail, reason )
  5.         local affected_plys = {}
  6.         for i=1, #target_plys do
  7.                 local v = target_plys[ i ]
  8.  
  9.                 if not should_unjail then
  10.                         if ulx.getExclusive( v, calling_ply ) then
  11.                                 ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  12.                         elseif not jailableArea( v:GetPos() ) then
  13.                                 ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
  14.                         else
  15.                                 doJail( v, seconds )
  16.  
  17.                                 table.insert( affected_plys, v )
  18.                         end
  19.                 elseif v.jail then
  20.                         v.jail.unjail()
  21.                         v.jail = nil
  22.                         table.insert( affected_plys, v )
  23.                 end
  24.         end
  25.  
  26.         if not should_unjail then
  27.                 local str = "#A jailed #T (#s)"
  28.                 if seconds > 0 then
  29.                         str = str .. " for #i seconds. (#s)"
  30.                 end
  31.                 ulx.fancyLogAdmin( calling_ply, str, affected_plys, seconds )
  32.         else
  33.                 ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys )
  34.         end
  35. end
  36. local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  37. jail:addParam{ type=ULib.cmds.PlayersArg }
  38. jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
  39. jail:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine }
  40. jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  41. jail:defaultAccess( ULib.ACCESS_ADMIN )
  42. jail:help( "Jails target(s)." )
  43. jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
  44.  

Didnt work sadly, thanks though

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX Jail Reason.
« Reply #5 on: August 26, 2013, 05:13:01 am »
ulx.fancyLogAdmin is where the log string is being generated. You'll need to pass the reason in there. #s is equivalent to %s in string.format.
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: ULX Jail Reason.
« Reply #6 on: August 26, 2013, 07:01:33 am »
always forget that part lol even with my own commands I would do it. anyway,

again not tested but should work now

Code: Lua
  1.     ------------------------------ Jail ------------------------------
  2.     local doJail
  3.     local jailableArea
  4.     function ulx.jail( calling_ply, target_plys, seconds, should_unjail, reason )
  5.     local affected_plys = {}
  6.     for i=1, #target_plys do
  7.     local v = target_plys[ i ]
  8.      
  9.     if not should_unjail then
  10.     if ulx.getExclusive( v, calling_ply ) then
  11.     ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  12.     elseif not jailableArea( v:GetPos() ) then
  13.     ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
  14.     else
  15.     doJail( v, seconds )
  16.      
  17.     table.insert( affected_plys, v )
  18.     end
  19.     elseif v.jail then
  20.     v.jail.unjail()
  21.     v.jail = nil
  22.     table.insert( affected_plys, v )
  23.     end
  24.     end
  25.      
  26.     if not should_unjail then
  27.     local str = "#A jailed #T (#s)"
  28.     if seconds > 0 then
  29.     str = str .. " for #i seconds. (#s)"
  30.     end
  31.     ulx.fancyLogAdmin( calling_ply, str, affected_plys, seconds, reason )
  32.     else
  33.     ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys )
  34.     end
  35.     end
  36.     local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  37.     jail:addParam{ type=ULib.cmds.PlayersArg }
  38.     jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
  39.     jail:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine }
  40.     jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  41.     jail:defaultAccess( ULib.ACCESS_ADMIN )
  42.     jail:help( "Jails target(s)." )
  43.     jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
  44.      
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX Jail Reason.
« Reply #7 on: August 27, 2013, 06:38:59 pm »
should_unjail and reason need to be flipped on the function argument list, but this is getting closer. :P
Experiencing God's grace one day at a time.

  • Print