Author Topic: Jobban from all security positons  (Read 164 times)

0 Members and 1 Guest are viewing this topic.

Offline oZqnk

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Jobban from all security positons
« on: August 26, 2017, 10:03:52 AM »
Someone Can help with coding a script / addon to
Jobban from all security positons in 15 minuts with a !jobban <player>

Plz help

 :)

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 547
  • Karma: 47
  • Just your ordinary moon angel!
    • View Profile
    • Mirai.Red
Re: Jobban from all security positons
« Reply #1 on: September 09, 2017, 07:56:12 PM »
What do you mean by "Security Positions"? Assuming this is for DarkRP, would it be all jobs with the arrest stick?

This may work however I've not tested it and it probably has an error or two. I tried to make the code easy to read so if there are any errors you should be able to fix them with little effort.
Code: Lua
  1. function ulx.bansecjob( calling_ply, target_plys, unban )
  2.         for k,ply in pairs( target_plys ) do
  3.                 if IsValid(ply) and ply.teamBan and ply.teamUnBan then
  4.                         for _,v in pairs( RPExtraTeams ) do
  5.  
  6.                                 local loadout = v.PlayerLoadout
  7.                                 local TEAM = v.team
  8.  
  9.                                 if ( TEAM and loadout and next(loadout) ) and ( table.HasValue( loadout, "arrest_stick" ) ) then
  10.                                         if unban then
  11.                                                 ply:teamUnBan( TEAM )
  12.                                         else
  13.                                                 ply:teamBan( TEAM, 0 )
  14.                                         end
  15.                                 end
  16.  
  17.                         end
  18.                 else
  19.                         local plyname = ply.Nick and "`" .. ply:Nick() .. "`" or "An unkown player"
  20.                         ULib.tsayError( calling_ply, plyname .. " can not be job banned currently.", true )
  21.                         table.remove(target_plys, k)
  22.                 end
  23.         end
  24.  
  25.         if not next(target_plys) then
  26.                 ULib.tsayError( calling_ply, "The specified target or targets can not be job banned at this time.", true )
  27.                 return
  28.         end
  29.  
  30.         if unban then
  31.                 ulx.fancyLogAdmin( calling_ply, "#A unbanned #T from all security jobs", target_plys )
  32.         else
  33.                 ulx.fancyLogAdmin( calling_ply, "#A banned #T from all security jobs", target_plys )
  34.         end
  35. end
  36. local bansecjob = ulx.command( "Utility", "ulx bsj", ulx.bansecjob, "!bsj" )
  37. bansecjob:addParam{ type=ULib.cmds.PlayersArg }
  38. bansecjob:defaultAccess( ULib.ACCESS_SUPERADMIN )
  39. bansecjob:help( "Ban players from all security jobs. (Current session only)" )
  40. bansecjob:setOpposite( "ulx unbsj", {_, _, true}, "!unbsj")
  41.  

The commands for it are "!bsj james", "ulx bsj james" in console, and "!unbsj james", "ulx unbsj james" in console. ("james" is just an example name you can obviously target people who aren't named james.)

By default the command is superadmin and up, however you can change its perms. Find it under the "Utility" section of your XGUI.
« Last Edit: September 09, 2017, 09:31:44 PM by LuaTenshi »
I cry every time I see that I am not a respected member of this community.