Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.15 KB | None | 0 0
  1. ---------------------------------------------------
  2. -- This file holds client and server utilities --
  3. ---------------------------------------------------
  4.  
  5. function ulx.give( calling_ply, target_plys, entity, should_silent )
  6.  
  7. for k,v in pairs( target_plys ) do
  8.  
  9. if ( not v:Alive() ) then -- Is the player dead?
  10.  
  11. ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true )
  12.  
  13. elseif v:IsFrozen() then -- Is the player frozen?
  14.  
  15. ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
  16.  
  17. elseif v:InVehicle() then -- Is the player in a vehicle?
  18.  
  19. ULib.tsayError( calling_ply, v:Nick() .. " is in a vehicle.", true )
  20.  
  21. else
  22.  
  23. v:Give( entity )
  24.  
  25. end
  26.  
  27. end
  28.  
  29. if should_silent then
  30.  
  31. ulx.fancyLogAdmin( calling_ply, true, "#A gave #T #s", target_plys, entity )
  32.  
  33. else
  34.  
  35. ulx.fancyLogAdmin( calling_ply, "#A gave #T #s", target_plys, entity )
  36.  
  37. end
  38.  
  39. end
  40. local give = ulx.command( "Custom", "ulx give", ulx.give, "!give" )
  41. give:addParam{ type=ULib.cmds.PlayersArg }
  42. give:addParam{ type=ULib.cmds.StringArg, hint="entity" }
  43. give:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  44. give:defaultAccess( ULib.ACCESS_ADMIN )
  45. give:help( "Give a player an entity" )
  46. give:setOpposite ( "ulx sgive", { _, _, _, true }, "!sgive", true )
  47.  
  48. function ulx.maprestart( calling_ply )
  49.  
  50. timer.Simple( 1, function() -- Wait 1 second so players can see the log
  51.  
  52. game.ConsoleCommand( "changelevel " .. game.GetMap() .. "\n" )
  53.  
  54. end )
  55.  
  56. ulx.fancyLogAdmin( calling_ply, "#A forced a mapchange" )
  57.  
  58. end
  59. local maprestart = ulx.command( "Custom", "ulx maprestart", ulx.maprestart, "!maprestart" )
  60. maprestart:defaultAccess( ULib.ACCESS_SUPERADMIN )
  61. maprestart:help( "Forces a mapchange to the current map." )
  62.  
  63. function ulx.stopsounds( calling_ply )
  64.  
  65. for _,v in ipairs( player.GetAll() ) do
  66.  
  67. v:SendLua([[RunConsoleCommand("stopsound")]])
  68.  
  69. end
  70.  
  71. ulx.fancyLogAdmin( calling_ply, "#A stopped sounds" )
  72.  
  73. end
  74. local stopsounds = ulx.command("Custom", "ulx stopsounds", ulx.stopsounds, {"!ss", "!stopsounds"} )
  75. stopsounds:defaultAccess( ULib.ACCESS_SUPERADMIN )
  76. stopsounds:help( "Stops sounds/music of everyone in the server." )
  77.  
  78. function ulx.multiban( calling_ply, target_ply, minutes, reason )
  79.  
  80. local affected_plys = {}
  81.  
  82. for i=1, #target_ply do
  83. local v = target_ply[ i ]
  84.  
  85.  
  86. if v:IsBot() then
  87.  
  88. ULib.tsayError( calling_ply, "Cannot ban a bot", true )
  89.  
  90. return
  91.  
  92. end
  93.  
  94. table.insert( affected_plys, v )
  95.  
  96. ULib.kickban( v, minutes, reason, calling_ply )
  97.  
  98. end
  99.  
  100. local time = "for #i minute(s)"
  101.  
  102. if minutes == 0 then time = "permanently" end
  103.  
  104. local str = "#A banned #T " .. time
  105.  
  106. if reason and reason ~= "" then str = str .. " (#s)" end
  107.  
  108. ulx.fancyLogAdmin( calling_ply, str, affected_plys, minutes ~= 0 and minutes or reason, reason )
  109.  
  110.  
  111. end
  112. local multiban = ulx.command( "Custom", "ulx multiban", ulx.multiban )
  113. multiban:addParam{ type=ULib.cmds.PlayersArg }
  114. multiban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
  115. multiban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  116. multiban:defaultAccess( ULib.ACCESS_ADMIN )
  117. multiban:help( "Bans multiple targets." )
  118.  
  119. if ( CLIENT ) then
  120.  
  121. local on = false -- default off
  122.  
  123. local function toggle()
  124.  
  125. on = !on
  126.  
  127. if on == true then
  128.  
  129. print( 'enabled' )
  130.  
  131. LocalPlayer():PrintMessage( HUD_PRINTTALK, "Third person mode enabled." )
  132.  
  133. else
  134.  
  135. print( 'disabled')
  136.  
  137. LocalPlayer():PrintMessage( HUD_PRINTTALK, "Third person mode disabled." )
  138.  
  139. end
  140.  
  141. end
  142.  
  143.  
  144. hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonDrawPlayer", function()
  145.  
  146. if on and LocalPlayer():Alive() then
  147.  
  148. return true
  149.  
  150. end
  151.  
  152. end )
  153.  
  154. hook.Add( "CalcView", "ThirdPersonView", function( ply, pos, angles, fov )
  155.  
  156. if on and ply:Alive() then
  157.  
  158. local view = {}
  159. view.origin = pos - ( angles:Forward() * 70 ) + ( angles:Right() * 20 ) + ( angles:Up() * 5 )
  160. --view.origin = pos - ( angles:Forward() * 70 )
  161. view.angles = ply:EyeAngles() + Angle( 1, 1, 0 )
  162. view.fov = fov
  163.  
  164. return GAMEMODE:CalcView( ply, view.origin, view.angles, view.fov )
  165.  
  166. end
  167.  
  168. end )
  169.  
  170. concommand.Add( "thirdperson_toggle", toggle )
  171.  
  172. end
  173.  
  174. if ( SERVER ) then
  175.  
  176. function ulx.thirdperson( calling_ply )
  177.  
  178. calling_ply:SendLua([[RunConsoleCommand("thirdperson_toggle")]])
  179.  
  180. end
  181. local thirdperson = ulx.command( "Custom", "ulx thirdperson", ulx.thirdperson, {"!thirdperson", "!3p"}, true )
  182. thirdperson:defaultAccess( ULib.ACCESS_ALL )
  183. thirdperson:help( "Toggles third person mode" )
  184.  
  185. end -- end serverside
  186.  
  187. function ulx.timedcmd( calling_ply, command, seconds, should_cancel )
  188.  
  189. ulx.fancyLogAdmin( calling_ply, true, "#A will run command #s in #i seconds", command, seconds )
  190.  
  191. timer.Create( "timedcommand", seconds, 1, function()
  192.  
  193. calling_ply:ConCommand( command )
  194.  
  195. end)
  196.  
  197. timer.Create( "halftime", ( seconds/2 ), 1, function() -- Print to the chat when half the time is left
  198.  
  199. ULib.tsay( calling_ply, ( seconds/2 ) .. " seconds left" )
  200.  
  201. end)
  202.  
  203. end
  204. local timedcmd = ulx.command( "Custom", "ulx timedcmd", ulx.timedcmd, "!timedcmd", true )
  205. timedcmd:addParam{ type=ULib.cmds.StringArg, hint="command" }
  206. timedcmd:addParam{ type=ULib.cmds.NumArg, min=1, hint="seconds", ULib.cmds.round }
  207. timedcmd:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  208. timedcmd:defaultAccess( ULib.ACCESS_ADMIN )
  209. timedcmd:help( "Runs the specified command after a number of seconds." )
  210.  
  211. --cancel the active timed command--
  212. function ulx.cancelcmd( calling_ply )
  213.  
  214. timer.Destroy( "timedcommand" )
  215.  
  216. timer.Destroy( "halftime" )
  217.  
  218. ulx.fancyLogAdmin( calling_ply, true, "#A cancelled the timed command" )
  219.  
  220. end
  221. local cancelcmd = ulx.command( "Custom", "ulx cancelcmd", ulx.cancelcmd, "!cancelcmd", true )
  222. cancelcmd:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  223. cancelcmd:defaultAccess( ULib.ACCESS_ADMIN )
  224. cancelcmd:help( "Runs the specified command after a number of seconds." )
  225.  
  226. function ulx.cleardecals( calling_ply )
  227.  
  228. for _,v in ipairs( player.GetAll() ) do
  229.  
  230. v:ConCommand("r_cleardecals")
  231.  
  232. end
  233.  
  234. ulx.fancyLogAdmin( calling_ply, "#A cleared decals" )
  235.  
  236. end
  237. local cleardecals = ulx.command( "Custom", "ulx cleardecals", ulx.cleardecals, "!cleardecals" )
  238. cleardecals:defaultAccess( ULib.ACCESS_ADMIN )
  239. cleardecals:help( "Clear decals for all players." )
  240.  
  241. function ulx.resetmap( calling_ply )
  242.  
  243. game.CleanUpMap()
  244.  
  245. ulx.fancyLogAdmin( calling_ply, "#A reset the map to its original state" )
  246.  
  247. end
  248. local resetmap = ulx.command( "Custom", "ulx resetmap", ulx.resetmap, "!resetmap" )
  249. resetmap:defaultAccess( ULib.ACCESS_SUPERADMIN )
  250. resetmap:help( "Resets the map to its original state." )
  251.  
  252. function ulx.bot( calling_ply, number, should_kick )
  253.  
  254. if ( not should_kick ) then
  255.  
  256. if number == 0 then
  257.  
  258. for i=1, 256 do
  259.  
  260. RunConsoleCommand("bot")
  261.  
  262. end
  263.  
  264. elseif number > 0 then
  265.  
  266. for i=1, number do
  267.  
  268. RunConsoleCommand("bot")
  269.  
  270. end
  271.  
  272. end
  273.  
  274. if number == 0 then
  275.  
  276. ulx.fancyLogAdmin( calling_ply, "#A filled the server with bots" )
  277.  
  278. elseif number == 1 then
  279.  
  280. ulx.fancyLogAdmin( calling_ply, "#A spawned #i bot", number )
  281.  
  282. elseif number > 1 then
  283.  
  284. ulx.fancyLogAdmin( calling_ply, "#A spawned #i bots", number )
  285.  
  286. end
  287.  
  288. elseif should_kick then
  289.  
  290. for k,v in pairs( player.GetAll() ) do
  291.  
  292. if v:IsBot() then
  293.  
  294. v:Kick("")
  295.  
  296. end
  297.  
  298. end
  299.  
  300. ulx.fancyLogAdmin( calling_ply, "#A kicked all bots from the server" )
  301.  
  302. end
  303.  
  304. end
  305. local bot = ulx.command( "Custom", "ulx bot", ulx.bot, "!bot" )
  306. bot:addParam{ type=ULib.cmds.NumArg, default=0, hint="number", ULib.cmds.optional }
  307. bot:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  308. bot:defaultAccess( ULib.ACCESS_ADMIN )
  309. bot:help( "Spawn or remove bots." )
  310. bot:setOpposite( "ulx kickbots", { _, _, true }, "!kickbots" )
  311.  
  312. function ulx.banip( calling_ply, minutes, ip )
  313.  
  314. if not ULib.isValidIP( ip ) then
  315.  
  316. ULib.tsayError( calling_ply, "Invalid ip address." )
  317.  
  318. return
  319.  
  320. end
  321.  
  322. local plys = player.GetAll()
  323.  
  324. for i=1, #plys do
  325.  
  326. if string.sub( tostring( plys[ i ]:IPAddress() ), 1, string.len( tostring( plys[ i ]:IPAddress() ) ) - 6 ) == ip then
  327.  
  328. ip = ip .. " (" .. plys[ i ]:Nick() .. ")"
  329.  
  330. break
  331.  
  332. end
  333.  
  334. end
  335.  
  336. RunConsoleCommand( "addip", minutes, ip )
  337. RunConsoleCommand( "writeip" )
  338.  
  339. ulx.fancyLogAdmin( calling_ply, true, "#A banned ip address #s for #i minutes", ip, minutes )
  340.  
  341. if ULib.fileExists( "cfg/banned_ip.cfg" ) then
  342. ULib.execFile( "cfg/banned_ip.cfg" )
  343. end
  344.  
  345. end
  346. local banip = ulx.command( "Custom", "ulx banip", ulx.banip )
  347. banip:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.allowTimeString, min=0 }
  348. banip:addParam{ type=ULib.cmds.StringArg, hint="address" }
  349. banip:defaultAccess( ULib.ACCESS_SUPERADMIN )
  350. banip:help( "Bans ip address." )
  351.  
  352. hook.Add( "Initialize", "banips", function()
  353. if ULib.fileExists( "cfg/banned_ip.cfg" ) then
  354. ULib.execFile( "cfg/banned_ip.cfg" )
  355. end
  356. end )
  357.  
  358. function ulx.unbanip( calling_ply, ip )
  359.  
  360. if not ULib.isValidIP( ip ) then
  361.  
  362. ULib.tsayError( calling_ply, "Invalid ip address." )
  363.  
  364. return
  365.  
  366. end
  367.  
  368. RunConsoleCommand( "removeip", ip )
  369. RunConsoleCommand( "writeip" )
  370.  
  371. ulx.fancyLogAdmin( calling_ply, true, "#A unbanned ip address #s", ip )
  372.  
  373. end
  374. local unbanip = ulx.command( "Custom", "ulx unbanip", ulx.unbanip )
  375. unbanip:addParam{ type=ULib.cmds.StringArg, hint="address" }
  376. unbanip:defaultAccess( ULib.ACCESS_SUPERADMIN )
  377. unbanip:help( "Unbans ip address." )
  378.  
  379. function ulx.ip( calling_ply, target_ply )
  380.  
  381. calling_ply:SendLua([[SetClipboardText("]] .. tostring(string.sub( tostring( target_ply:IPAddress() ), 1, string.len( tostring( target_ply:IPAddress() ) ) - 6 )) .. [[")]])
  382.  
  383. ulx.fancyLog( {calling_ply}, "Copied IP Address of #T", target_ply )
  384.  
  385. end
  386. local ip = ulx.command( "Custom", "ulx ip", ulx.ip, "!copyip", true )
  387. ip:addParam{ type=ULib.cmds.PlayerArg }
  388. ip:defaultAccess( ULib.ACCESS_SUPERADMIN )
  389. ip:help( "Copies a player's IP address." )
  390.  
  391. function ulx.crash( calling_ply, target_ply, should_silent )
  392.  
  393. target_ply:SendLua( "AddConsoleCommand( \"sendrcon\" )" )
  394.  
  395. if should_silent then
  396.  
  397. ulx.fancyLogAdmin( calling_ply, true, "#A crashed #T", target_ply )
  398.  
  399. else
  400.  
  401. ulx.fancyLogAdmin( calling_ply, "#A crashed #T", target_ply )
  402.  
  403. end
  404.  
  405. end
  406. local crash = ulx.command( "Custom", "ulx crash", ulx.crash, "!crash" )
  407. crash:addParam{ type=ULib.cmds.PlayerArg }
  408. crash:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  409. crash:defaultAccess( ULib.ACCESS_SUPERADMIN )
  410. crash:help( "Crashes a player." )
  411. crash:setOpposite( "ulx scrash", { _, _, true }, "!scrash", true )
  412.  
  413. function ulx.sban( calling_ply, target_ply, minutes, reason )
  414.  
  415. if target_ply:IsBot() then
  416.  
  417. ULib.tsayError( calling_ply, "Cannot ban a bot", true )
  418.  
  419. return
  420.  
  421. end
  422.  
  423. ULib.ban( target_ply, minutes, reason, calling_ply )
  424.  
  425. target_ply:Kick( "Disconnect: Kicked by " .. calling_ply:Nick() .. "(" .. calling_ply:SteamID() .. ")" .. " " .. "(" .. "Banned for " .. minutes .. " minute(s): " .. reason .. ")." )
  426.  
  427. local time = "for #i minute(s)"
  428. if minutes == 0 then time = "permanently" end
  429. local str = "#A banned #T " .. time
  430. if reason and reason ~= "" then str = str .. " (#s)" end
  431.  
  432. ulx.fancyLogAdmin( calling_ply, true, str, target_ply, minutes ~= 0 and minutes or reason, reason )
  433.  
  434. end
  435. local sban = ulx.command( "Custom", "ulx sban", ulx.sban, "!sban" )
  436. sban:addParam{ type=ULib.cmds.PlayerArg }
  437. sban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
  438. sban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  439. sban:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  440. sban:defaultAccess( ULib.ACCESS_ADMIN )
  441. sban:help( "Bans target silently." )
  442.  
  443. function ulx.fakeban( calling_ply, target_ply, minutes, reason )
  444.  
  445. if target_ply:IsBot() then
  446.  
  447. ULib.tsayError( calling_ply, "Cannot ban a bot", true )
  448.  
  449. return
  450.  
  451. end
  452.  
  453. local time = "for #i minute(s)"
  454. if minutes == 0 then time = "permanently" end
  455. local str = "#A banned #T " .. time
  456. if reason and reason ~= "" then str = str .. " (#s)" end
  457.  
  458. ulx.fancyLogAdmin( calling_ply, str, target_ply, minutes ~= 0 and minutes or reason, reason )
  459.  
  460. end
  461. local fakeban = ulx.command( "Custom", "ulx fakeban", ulx.fakeban, "!fakeban", true )
  462. fakeban:addParam{ type=ULib.cmds.PlayerArg }
  463. fakeban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
  464. fakeban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  465. fakeban:defaultAccess( ULib.ACCESS_SUPERADMIN )
  466. fakeban:help( "Doesn't actually ban the target." )
  467.  
  468. function ulx.profile( calling_ply, target_ply )
  469.  
  470. calling_ply:SendLua("gui.OpenURL('http://steamcommunity.com/profiles/".. target_ply:SteamID64() .."')")
  471.  
  472. ulx.fancyLogAdmin( calling_ply, true, "#A opened the profile of #T", target_ply )
  473.  
  474. end
  475. local profile = ulx.command( "Custom", "ulx profile", ulx.profile, "!profile", true )
  476. profile:addParam{ type=ULib.cmds.PlayerArg }
  477. profile:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  478. profile:defaultAccess( ULib.ACCESS_ALL )
  479. profile:help( "Opens target's profile" )
  480.  
  481. function ulx.dban( calling_ply )
  482. calling_ply:ConCommand( "xgui hide" )
  483. calling_ply:ConCommand( "menu_disc" )
  484. end
  485. local dban = ulx.command( "Custom", "ulx dban", ulx.dban, "!dban" )
  486. dban:defaultAccess( ULib.ACCESS_ADMIN )
  487. dban:help( "Open the disconnected players menu" )
  488.  
  489. function ulx.skick( calling_ply, target_ply, reason )
  490. if reason and reason ~= "" then
  491. ulx.fancyLogAdmin( calling_ply, true, "#A kicked #T (#s)", target_ply, reason )
  492. else
  493. reason = nil
  494. ulx.fancyLogAdmin( calling_ply, true, "#A kicked #T", target_ply )
  495. end
  496. ULib.kick( target_ply, reason, calling_ply )
  497. end
  498. local skick = ulx.command( "Custom", "ulx skick", ulx.skick, "!skick" )
  499. skick:addParam{ type=ULib.cmds.PlayerArg }
  500. skick:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  501. skick:defaultAccess( ULib.ACCESS_ADMIN )
  502. skick:help( "Kicks target." )
  503.  
  504. CreateConVar( "ulx_hide_notify_superadmins", 0 )
  505.  
  506. function ulx.hide( calling_ply, command )
  507.  
  508. if GetConVarNumber( "ulx_logecho" ) == 0 then
  509. ULib.tsayError( calling_ply, "ULX Logecho is already set to 0. Your commands are hidden!" )
  510. return
  511. end
  512.  
  513. local strexc = false
  514.  
  515. local newstr
  516.  
  517. if string.find( command, "!" ) then
  518. newstr = string.gsub( command, "!", "ulx " )
  519. strexc = true
  520. end
  521.  
  522. if strexc == false and not string.find( command, "ulx" ) then
  523. ULib.tsayError( calling_ply, "Invalid ULX command!" )
  524. return
  525. end
  526.  
  527. local prevecho = GetConVarNumber( "ulx_logecho" )
  528.  
  529. game.ConsoleCommand( "ulx logecho 0\n" )
  530.  
  531. if strexc == false then
  532. calling_ply:ConCommand( command )
  533. else
  534. string.gsub( newstr, "ulx ", "!" )
  535. calling_ply:ConCommand( newstr )
  536. end
  537.  
  538. timer.Simple( 0.25, function()
  539. game.ConsoleCommand( "ulx logecho " .. prevecho .. "\n" )
  540. end )
  541.  
  542. ulx.fancyLog( {calling_ply}, "(HIDDEN) You ran command #s", command )
  543.  
  544. if GetConVarNumber( "ulx_hide_notify_superadmins" ) == 1 then
  545.  
  546. if calling_ply:IsValid() then
  547. for k,v in pairs( player.GetAll() ) do
  548. if v:IsSuperAdmin() and v ~= calling_ply then
  549. ULib.tsayColor( v, false, Color( 151, 211, 255 ), "(HIDDEN) ", Color( 0, 255, 0 ), calling_ply:Nick(), Color( 151, 211, 255 ), " ran hidden command ", Color( 0, 255, 0 ), command )
  550. end
  551. end
  552. end
  553.  
  554. end
  555.  
  556. end
  557. local hide = ulx.command( "Custom", "ulx hide", ulx.hide, "!hide", true )
  558. hide:addParam{ type=ULib.cmds.StringArg, hint="command", ULib.cmds.takeRestOfLine }
  559. hide:defaultAccess( ULib.ACCESS_SUPERADMIN )
  560. hide:help( "Run a command without it displaying the log echo." )
  561.  
  562. function ulx.administrate( calling_ply, should_revoke )
  563.  
  564. if not should_revoke then
  565. calling_ply:GodEnable()
  566. else
  567. calling_ply:GodDisable()
  568. end
  569.  
  570. if not should_revoke then
  571. ULib.invisible( calling_ply, true, 255 )
  572. else
  573. ULib.invisible( calling_ply, false, 255 )
  574. end
  575.  
  576. if not should_revoke then
  577. calling_ply:SetMoveType( MOVETYPE_NOCLIP )
  578. else
  579. calling_ply:SetMoveType( MOVETYPE_WALK )
  580. end
  581.  
  582. if not should_revoke then
  583. ulx.fancyLogAdmin( calling_ply, true, "#A is now administrating" )
  584. else
  585. ulx.fancyLogAdmin( calling_ply, true, "#A has stopped administrating" )
  586. end
  587.  
  588. end
  589. local administrate = ulx.command( "Custom", "ulx administrate", ulx.administrate, { "!admin", "!administrate"}, true )
  590. administrate:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  591. administrate:defaultAccess( ULib.ACCESS_SUPERADMIN )
  592. administrate:help( "Cloak yourself, noclip yourself, and god yourself." )
  593. administrate:setOpposite( "ulx unadministrate", { _, true }, "!unadministrate", true )
  594.  
  595. function ulx.enter( calling_ply, target_ply )
  596.  
  597. local vehicle = calling_ply:GetEyeTrace().Entity
  598.  
  599. if not vehicle:IsVehicle() then
  600. ULib.tsayError( calling_ply, "That isn't a vehicle!" )
  601. return
  602. end
  603.  
  604. target_ply:EnterVehicle( vehicle )
  605.  
  606. ulx.fancyLogAdmin( calling_ply, "#A forced #T into a vehicle", target_ply )
  607.  
  608. end
  609. local enter = ulx.command( "Custom", "ulx enter", ulx.enter, "!enter")
  610. enter:addParam{ type=ULib.cmds.PlayerArg }
  611. enter:defaultAccess( ULib.ACCESS_ADMIN )
  612. enter:help( "Force a player into a vehicle." )
  613.  
  614. function ulx.exit( calling_ply, target_ply )
  615.  
  616. if not IsValid( target_ply:GetVehicle() ) then
  617. ULib.tsayError( calling_ply, target_ply:Nick() .. " is not in a vehicle!" )
  618. return
  619. else
  620. target_ply:ExitVehicle()
  621. end
  622.  
  623. ulx.fancyLogAdmin( calling_ply, "#A forced #T out of a vehicle", target_ply )
  624.  
  625. end
  626. local exit = ulx.command( "Custom", "ulx exit", ulx.exit, "!exit")
  627. exit:addParam{ type=ULib.cmds.PlayerArg }
  628. exit:defaultAccess( ULib.ACCESS_ADMIN )
  629. exit:help( "Force a player out of a vehicle." )
  630.  
  631. function ulx.forcerespawn( calling_ply, target_plys )
  632.  
  633. if GetConVarString("gamemode") == "terrortown" then
  634. for k, v in pairs( target_plys ) do
  635. if v:Alive() then
  636. v:Kill()
  637. v:SpawnForRound( true )
  638. else
  639. v:SpawnForRound( true )
  640. end
  641. end
  642. else
  643. for k, v in pairs( target_plys ) do
  644. if v:Alive() then
  645. v:Kill()
  646. v:Spawn()
  647. else
  648. v:Spawn()
  649. end
  650. end
  651. end
  652.  
  653. ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys )
  654.  
  655. end
  656. local forcerespawn = ulx.command( "Custom", "ulx forcerespawn", ulx.forcerespawn, { "!forcerespawn", "!frespawn"} )
  657. forcerespawn:addParam{ type=ULib.cmds.PlayersArg }
  658. forcerespawn:defaultAccess( ULib.ACCESS_ADMIN )
  659. forcerespawn:help( "Force-respawn a player." )
  660.  
  661. function ulx.serverinfo( calling_ply )
  662.  
  663. local str = string.format( "\n\nServer Information:\nULX version: %s\nULib version: %.2f\n", ulx.getVersion(), ULib.VERSION )
  664. str = str .. string.format( "Gamemode: %s\nMap: %s\n", GAMEMODE.Name, game.GetMap() )
  665. str = str .. "Dedicated server: " .. tostring( game.IsDedicated() ) .. "\n"
  666. str = str .. "Hostname: " .. GetConVarString("hostname") .. "\n"
  667. str = str .. "Server IP: " .. GetConVarString("ip") .. "\n\n"
  668.  
  669. local players = player.GetAll()
  670.  
  671. str = str .. string.format( "----------\n\nCurrently connected players:\nNick%s steamid%s uid%s id lsh\n", str.rep( " ", 27 ), str.rep( " ", 11 ), str.rep( " ", 7 ) )
  672.  
  673. for _, ply in ipairs( players ) do
  674.  
  675. local id = string.format( "%i", ply:EntIndex() )
  676. local steamid = ply:SteamID()
  677. local uid = tostring( ply:UniqueID() )
  678.  
  679. local plyline = ply:Nick() .. str.rep( " ", 32 - ply:Nick():len() )
  680. plyline = plyline .. steamid .. str.rep( " ", 19 - steamid:len() )
  681. plyline = plyline .. uid .. str.rep( " ", 11 - uid:len() )
  682. plyline = plyline .. id .. str.rep( " ", 3 - id:len() )
  683.  
  684. if ply:IsListenServerHost() then
  685. plyline = plyline .. "y "
  686. else
  687. plyline = plyline .. "n "
  688. end
  689.  
  690. str = str .. plyline .. "\n"
  691.  
  692. end
  693.  
  694. local gmoddefault = util.KeyValuesToTable( ULib.fileRead( "settings/users.txt" ) )
  695.  
  696. str = str .. "\n----------\n\nUsergroup Information:\n\nULib.ucl.users (Users: " .. table.Count( ULib.ucl.users ) .. "):\n" .. ulx.dumpTable( ULib.ucl.users, 1 ) .. "\n"
  697. str = str .. "ULib.ucl.authed (Players: " .. table.Count( ULib.ucl.authed ) .. "):\n" .. ulx.dumpTable( ULib.ucl.authed, 1 ) .. "\n"
  698. str = str .. "Garrysmod default file (Groups:" .. table.Count( gmoddefault ) .. "):\n" .. ulx.dumpTable( gmoddefault, 1 ) .. "\n----------\n"
  699.  
  700. str = str .. "\nAddons on this server:\n"
  701.  
  702. local _, possibleaddons = file.Find( "addons/*", "GAME" )
  703.  
  704. for _, addon in ipairs( possibleaddons ) do
  705. if ULib.fileExists( "addons/" .. addon .. "/addon.txt" ) then
  706. local t = util.KeyValuesToTable( ULib.fileRead( "addons/" .. addon .. "/addon.txt" ) )
  707. if tonumber( t.version ) then
  708. t.version = string.format( "%g", t.version )
  709. end
  710. str = str .. string.format( "%s%s by %s, version %s (%s)\n", addon, str.rep( " ", 24 - addon:len() ), t.author_name, t.version, t.up_date )
  711. end
  712. end
  713.  
  714. local f = ULib.fileRead( "workshop.vdf" )
  715.  
  716. if f then
  717. local addons = ULib.parseKeyValues( ULib.stripComments( f, "//" ) )
  718. addons = addons.addons
  719. if table.Count( addons ) > 0 then
  720. str = str .. string.format( "\nPlus %i workshop addon(s):\n", table.Count( addons ) )
  721. PrintTable( addons )
  722. for _, addon in pairs( addons ) do
  723. str = str .. string.format( "Addon ID: %s\n", addon )
  724. end
  725. end
  726. end
  727.  
  728. ULib.tsay( calling_ply, "Server information printed to console." )
  729.  
  730. local lines = ULib.explode( "\n", str )
  731.  
  732. for _, line in ipairs( lines ) do
  733.  
  734. ULib.console( calling_ply, line )
  735.  
  736. end
  737.  
  738. end
  739. local serverinfo = ulx.command( "Custom", "ulx serverinfo", ulx.serverinfo, { "!serverinfo", "!info" } )
  740. serverinfo:defaultAccess( ULib.ACCESS_ADMIN )
  741. serverinfo:help( "Print server information." )
  742.  
  743. function ulx.timescale( calling_ply, number, should_reset )
  744.  
  745. if not should_reset then
  746.  
  747. if number <= 0.1 then
  748. ULib.tsayError( calling_ply, "Cannot set the timescale at or below 0.1, doing so will cause instability." )
  749. return
  750. end
  751.  
  752. if number >= 5 then
  753. ULib.tsayError( calling_ply, "Cannot set the timescale at or above 5, doing so will cause instability" )
  754. return
  755. end
  756.  
  757. game.SetTimeScale( number )
  758.  
  759. ulx.fancyLogAdmin( calling_ply, "#A set the game timescale to #i", number )
  760.  
  761. else
  762.  
  763. game.SetTimeScale( 1 )
  764.  
  765. ulx.fancyLogAdmin( calling_ply, "#A reset the game timescale" )
  766.  
  767. end
  768.  
  769. end
  770. local timescale = ulx.command( "Custom", "ulx timescale", ulx.timescale, "!timescale" )
  771. timescale:addParam{ type=ULib.cmds.NumArg, default=1, hint="multiplier" }
  772. timescale:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  773. timescale:defaultAccess( ULib.ACCESS_SUPERADMIN )
  774. timescale:help( "Set the server timescale." )
  775. timescale:setOpposite( "ulx resettimescale", { _, _, true } )
  776.  
  777. if ( SERVER ) then
  778.  
  779. hook.Add( "ShutDown", "reallyimportanthook", function()
  780. if game.GetTimeScale() ~= 1 then
  781. game.SetTimeScale( 1 )
  782. end
  783. end )
  784.  
  785. end
  786.  
  787. function ulx.removeragdolls( calling_ply )
  788.  
  789. for k,v in pairs( player.GetAll() ) do
  790. v:SendLua([[game.RemoveRagdolls()]])
  791. end
  792.  
  793. ulx.fancyLogAdmin( calling_ply, "#A removed ragdolls" )
  794.  
  795. end
  796. local removeragdolls = ulx.command( "Custom", "ulx removeragdolls", ulx.removeragdolls, "!removeragdolls" )
  797. removeragdolls:defaultAccess( ULib.ACCESS_ADMIN )
  798. removeragdolls:help( "Remove all ragdolls." )
  799.  
  800. function ulx.bancheck( calling_ply, steamid )
  801.  
  802. if not ULib.isValidSteamID( steamid ) then
  803.  
  804. if ( ULib.isValidIP( steamid ) and not ULib.isValidSteamID( steamid ) ) then
  805.  
  806. local file = file.Read( "cfg/banned_ip.cfg", "GAME" )
  807.  
  808. if string.find( file, steamid ) then
  809. ulx.fancyLog( {calling_ply}, "IP Address #s is banned!", steamid )
  810. else
  811. ulx.fancyLog( {calling_ply}, "IP Address #s is not banned!", steamid )
  812. end
  813.  
  814. return
  815.  
  816. elseif not ( ULib.isValidIP( steamid ) and ULib.isValidSteamID( steamid ) ) then
  817.  
  818. ULib.tsayError( calling_ply, "Invalid string." )
  819. return
  820.  
  821. end
  822.  
  823. end
  824.  
  825. if calling_ply:IsValid() then
  826.  
  827. if ULib.bans[steamid] then
  828.  
  829. ulx.fancyLog( {calling_ply}, "SteamID #s is banned! Information printed to console.", steamid )
  830.  
  831. umsg.Start( "steamid", calling_ply )
  832. umsg.String( steamid )
  833. umsg.End()
  834.  
  835. else
  836. ulx.fancyLog( {calling_ply}, "SteamID #s is not banned!", steamid )
  837. end
  838.  
  839. else
  840.  
  841. if ULib.bans[steamid] then
  842. PrintTable( ULib.bans[steamid] )
  843. else
  844. Msg( "SteamID " .. steamid .. " is not banned!" )
  845. end
  846.  
  847. end
  848.  
  849. end
  850. local bancheck = ulx.command( "Custom", "ulx bancheck", ulx.bancheck, "!bancheck" )
  851. bancheck:addParam{ type=ULib.cmds.StringArg, hint="string" }
  852. bancheck:defaultAccess( ULib.ACCESS_ADMIN )
  853. bancheck:help( "Checks if a steamid or ip address is banned." )
  854.  
  855. if ( SERVER ) then
  856.  
  857. util.AddNetworkString( "steamid2" )
  858. util.AddNetworkString( "sendtable" )
  859.  
  860. net.Receive( "steamid2", function( len, ply )
  861. local id2 = net.ReadString()
  862. local tab = ULib.bans[ id2 ]
  863. net.Start( "sendtable" )
  864. net.WriteTable( tab )
  865. net.Send( ply )
  866. end )
  867.  
  868. end
  869.  
  870. if ( CLIENT ) then
  871.  
  872. usermessage.Hook( "steamid", function( um )
  873. local id = um:ReadString()
  874. net.Start( "steamid2" )
  875. net.WriteString( id )
  876. net.SendToServer()
  877. end )
  878.  
  879. net.Receive( "sendtable", function()
  880. PrintTable( net.ReadTable() )
  881. end )
  882.  
  883. end
  884.  
  885. function ulx.friends( calling_ply, target_ply )
  886.  
  887. umsg.Start( "getfriends", target_ply )
  888. umsg.Entity( calling_ply )
  889. umsg.End()
  890.  
  891. end
  892. local friends = ulx.command( "Custom", "ulx friends", ulx.friends, { "!friends", "!listfriends" }, true )
  893. friends:addParam{ type=ULib.cmds.PlayerArg }
  894. friends:defaultAccess( ULib.ACCESS_ADMIN )
  895. friends:help( "Print a player's connected steam friends." )
  896.  
  897. if ( CLIENT ) then
  898.  
  899. local friendstab = {}
  900.  
  901. usermessage.Hook( "getfriends", function( um )
  902.  
  903. for k, v in pairs( player.GetAll() ) do
  904. if v:GetFriendStatus() == "friend" then
  905. table.insert( friendstab, v:Nick() )
  906. end
  907. end
  908.  
  909. net.Start( "sendtable" )
  910. net.WriteEntity( um:ReadEntity() )
  911. net.WriteTable( friendstab )
  912. net.SendToServer()
  913.  
  914. table.Empty( friendstab )
  915.  
  916. end )
  917.  
  918. end
  919.  
  920. if ( SERVER ) then
  921.  
  922. util.AddNetworkString( "sendtable" )
  923.  
  924. net.Receive( "sendtable", function( len, ply )
  925.  
  926. local calling, tabl = net.ReadEntity(), net.ReadTable()
  927. local tab = table.concat( tabl, ", " )
  928.  
  929. if ( string.len( tab ) == 0 and table.Count( tabl ) == 0 ) then
  930. ulx.fancyLog( {calling}, "#T is not friends with anyone on the server", ply )
  931. else
  932. ulx.fancyLog( {calling}, "#T is friends with #s", ply, tab )
  933. end
  934.  
  935. end )
  936.  
  937. end
  938.  
  939. if ( SERVER ) then
  940.  
  941. util.AddNetworkString( "RequestFiles" )
  942. util.AddNetworkString( "RequestFilesCallback" )
  943. util.AddNetworkString( "RequestDeletion" )
  944.  
  945. if not file.Exists( "watchlist", "DATA" ) then
  946. file.CreateDir( "watchlist" )
  947. end
  948.  
  949. net.Receive( "RequestFiles", function( len, ply )
  950.  
  951. local files = file.Find( "watchlist/*", "DATA" )
  952.  
  953. for k, v in pairs( files ) do
  954.  
  955. local r = file.Read( "watchlist/" .. v, "DATA" )
  956. local exp = string.Explode( "\n", r )
  957.  
  958. net.Start( "RequestFilesCallback" )
  959. net.WriteString( v )
  960. net.WriteTable( exp )
  961. net.Send( ply )
  962.  
  963. end
  964.  
  965. end )
  966.  
  967. net.Receive( "RequestDeletion", function( len, ply )
  968.  
  969. local steamid = net.ReadString()
  970. local name = net.ReadString()
  971.  
  972. if file.Exists( "watchlist/" .. steamid:gsub( ":", "X" ) .. ".txt", "DATA" ) then
  973. file.Delete( "watchlist/" .. steamid:gsub( ":", "X" ) .. ".txt" )
  974. end
  975.  
  976. for k, v in pairs( player.GetAll() ) do
  977. if v:IsSuperAdmin() or v == ply then
  978. ulx.fancyLog( {v}, "(SILENT) #s removed #s (#s) from the watchlist", ply:Nick(), name, steamid )
  979. end
  980. end
  981.  
  982. end )
  983.  
  984. hook.Add( "PlayerInitialSpawn", "CheckWatchedPlayers", function( ply )
  985.  
  986. local files = file.Find( "watchlist/*", "DATA" )
  987.  
  988. for k, v in pairs( files ) do
  989. if ply:SteamID() == string.sub( v:gsub( "X", ":" ), 1, -5 ) then
  990. for q, w in pairs( player.GetAll() ) do
  991. if w:IsAdmin() then
  992. ULib.tsayError( w, ply:Nick() .. " (" .. ply:SteamID() .. ") has joined the server and is on the watchlist!" )
  993. end
  994. end
  995. end
  996. end
  997.  
  998. end )
  999.  
  1000. hook.Add( "PlayerDisconnected", "CheckWatchedPlayersDC", function( ply )
  1001.  
  1002. local files = file.Find( "watchlist/*", "DATA" )
  1003.  
  1004. for k, v in pairs( files ) do
  1005. if ply:SteamID() == string.sub( v:gsub( "X", ":" ), 1, -5 ) then
  1006. for q, w in pairs( player.GetAll() ) do
  1007. if w:IsAdmin() then
  1008. ULib.tsayError( w, ply:Nick() .. " (" .. ply:SteamID() .. ") has left the server and is on the watchlist!" )
  1009. end
  1010. end
  1011. end
  1012. end
  1013.  
  1014. end )
  1015.  
  1016. end
  1017.  
  1018. function ulx.watch( calling_ply, target_ply, reason, should_unwatch )
  1019.  
  1020. local id = string.gsub( target_ply:SteamID(), ":", "X" )
  1021.  
  1022. if not should_unwatch then
  1023.  
  1024. if not file.Exists( "watchlist/" .. id .. ".txt", "DATA" ) then
  1025. file.Write( "watchlist/" .. id .. ".txt", "" )
  1026. else
  1027. file.Delete( "watchlist/" .. id .. ".txt" )
  1028. file.Write( "watchlist/" .. id .. ".txt", "" )
  1029. end
  1030.  
  1031. file.Append( "watchlist/" .. id .. ".txt", target_ply:Nick() .. "\n" )
  1032. file.Append( "watchlist/" .. id .. ".txt", calling_ply:Nick() .. "\n" )
  1033. file.Append( "watchlist/" .. id .. ".txt", string.Trim( reason ) .. "\n" )
  1034. file.Append( "watchlist/" .. id .. ".txt", os.date( "%m/%d/%y %H:%M" ) .. "\n" )
  1035.  
  1036. ulx.fancyLogAdmin( calling_ply, true, "#A added #T to the watchlist (#s)", target_ply, reason )
  1037.  
  1038. else
  1039.  
  1040. if file.Exists( "watchlist/" .. id .. ".txt", "DATA" ) then
  1041. file.Delete( "watchlist/" .. id .. ".txt" )
  1042. ulx.fancyLogAdmin( calling_ply, true, "#A removed #T from the watchlist", target_ply )
  1043. else
  1044. ULib.tsayError( calling_ply, target_ply:Nick() .. " is not on the watchlist." )
  1045. end
  1046.  
  1047. end
  1048.  
  1049. end
  1050. local watch = ulx.command( "Custom", "ulx watch", ulx.watch, "!watch", true )
  1051. watch:addParam{ type=ULib.cmds.PlayerArg }
  1052. watch:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.takeRestOfLine }
  1053. watch:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  1054. watch:defaultAccess( ULib.ACCESS_ADMIN )
  1055. watch:help( "Watch or unwatch a player" )
  1056. watch:setOpposite( "ulx unwatch", { _, _, false, true }, "!unwatch", true )
  1057.  
  1058. function ulx.watchlist( calling_ply )
  1059.  
  1060. if calling_ply:IsValid() then
  1061. umsg.Start( "open_watchlist", calling_ply )
  1062. umsg.End()
  1063. end
  1064.  
  1065. end
  1066. local watchlist = ulx.command( "Custom", "ulx watchlist", ulx.watchlist, "!watchlist", true )
  1067. watchlist:defaultAccess( ULib.ACCESS_ADMIN )
  1068. watchlist:help( "View the watchlist" )
  1069.  
  1070. if ( CLIENT ) then
  1071.  
  1072. local tab = {}
  1073.  
  1074. usermessage.Hook( "open_watchlist", function()
  1075.  
  1076. local main = vgui.Create( "DFrame" )
  1077.  
  1078. main:SetPos( 50,50 )
  1079. main:SetSize( 700, 400 )
  1080. main:SetTitle( "Watchlist" )
  1081. main:SetVisible( true )
  1082. main:SetDraggable( true )
  1083. main:ShowCloseButton( true )
  1084. main:MakePopup()
  1085. main:Center()
  1086.  
  1087. local list = vgui.Create( "DListView", main )
  1088. list:SetPos( 4, 27 )
  1089. list:SetSize( 692, 369 )
  1090. list:SetMultiSelect( false )
  1091. list:AddColumn( "SteamID" )
  1092. list:AddColumn( "Name" )
  1093. list:AddColumn( "Admin" )
  1094. list:AddColumn( "Reason" )
  1095. list:AddColumn( "Time" )
  1096.  
  1097. net.Start( "RequestFiles" )
  1098. net.SendToServer()
  1099.  
  1100. net.Receive( "RequestFilesCallback", function()
  1101.  
  1102. table.Empty( tab )
  1103.  
  1104. local name = net.ReadString()
  1105. local toIns = net.ReadTable()
  1106.  
  1107. table.insert( tab, { name:gsub( "X", ":" ):sub( 1, -5 ), toIns[ 1 ], toIns[ 2 ], toIns[ 3 ], toIns[ 4 ] } )
  1108.  
  1109. for k, v in pairs( tab ) do
  1110. list:AddLine( v[ 1 ], v[ 2 ], v[ 3 ], v[ 4 ], v[ 5 ] )
  1111. end
  1112.  
  1113. end )
  1114.  
  1115. list.OnRowRightClick = function( main, line )
  1116.  
  1117. local menu = DermaMenu()
  1118.  
  1119. menu:AddOption( "Copy SteamID", function()
  1120. SetClipboardText( list:GetLine( line ):GetValue( 1 ) )
  1121. chat.AddText( "SteamID Copied" )
  1122. end ):SetIcon( "icon16/tag_blue_edit.png" )
  1123.  
  1124. menu:AddOption( "Copy Name", function()
  1125. SetClipboardText( list:GetLine( line ):GetValue( 2 ) )
  1126. chat.AddText( "Username Copied" )
  1127. end ):SetIcon( "icon16/user_edit.png" )
  1128.  
  1129. menu:AddOption( "Copy Reason", function()
  1130. SetClipboardText( list:GetLine( line ):GetValue( 4 ) )
  1131. chat.AddText( "Reason Copied" )
  1132. end ):SetIcon( "icon16/note_edit.png" )
  1133.  
  1134. menu:AddOption( "Copy Time", function()
  1135. SetClipboardText( list:GetLine( line ):GetValue( 5 ) )
  1136. chat.AddText( "Time Copied" )
  1137. end ):SetIcon( "icon16/clock_edit.png" )
  1138.  
  1139. menu:AddOption( "Remove", function()
  1140.  
  1141. net.Start( "RequestDeletion" )
  1142. net.WriteString( list:GetLine( line ):GetValue( 1 ) )
  1143. net.WriteString( list:GetLine( line ):GetValue( 2 ) )
  1144. net.SendToServer()
  1145.  
  1146. list:Clear()
  1147.  
  1148. table.Empty( tab )
  1149.  
  1150. net.Start( "RequestFiles" )
  1151. net.SendToServer()
  1152.  
  1153. net.Receive( "RequestFilesCallback", function()
  1154.  
  1155. local name = net.ReadString()
  1156. local toIns = net.ReadTable()
  1157.  
  1158. table.insert( tab, { name:gsub( "X", ":" ):sub( 1, -5 ), toIns[ 1 ], toIns[ 2 ], toIns[ 3 ], toIns[ 4 ] } )
  1159.  
  1160. for k, v in pairs( tab ) do
  1161. list:AddLine( v[ 1 ], v[ 2 ], v[ 3 ], v[ 4 ], v[ 5 ] )
  1162. end
  1163.  
  1164. end )
  1165.  
  1166. end ):SetIcon( "icon16/table_row_delete.png" )
  1167.  
  1168. menu:AddOption( "Ban by SteamID", function()
  1169.  
  1170. local Frame = vgui.Create( "DFrame" )
  1171. Frame:SetSize( 250, 98 )
  1172. Frame:Center()
  1173. Frame:MakePopup()
  1174. Frame:SetTitle( "Ban by SteamID..." )
  1175.  
  1176. local TimeLabel = vgui.Create( "DLabel", Frame )
  1177. TimeLabel:SetPos( 5,27 )
  1178. TimeLabel:SetColor( Color( 0,0,0,255 ) )
  1179. TimeLabel:SetFont( "DermaDefault" )
  1180. TimeLabel:SetText( "Time:" )
  1181.  
  1182. local Time = vgui.Create( "DTextEntry", Frame )
  1183. Time:SetPos( 47, 27 )
  1184. Time:SetSize( 198, 20 )
  1185. Time:SetText( "" )
  1186.  
  1187. local ReasonLabel = vgui.Create( "DLabel", Frame )
  1188. ReasonLabel:SetPos( 5,50 )
  1189. ReasonLabel:SetColor( Color( 0,0,0,255 ) )
  1190. ReasonLabel:SetFont( "DermaDefault" )
  1191. ReasonLabel:SetText( "Reason:" )
  1192.  
  1193. local Reason = vgui.Create( "DTextEntry", Frame )
  1194. Reason:SetPos( 47, 50 )
  1195. Reason:SetSize( 198, 20 )
  1196. Reason:SetText("")
  1197.  
  1198. local execbutton = vgui.Create( "DButton", Frame )
  1199. execbutton:SetSize( 75, 20 )
  1200. execbutton:SetPos( 47, 73 )
  1201. execbutton:SetText( "Ban!" )
  1202. execbutton.DoClick = function()
  1203. RunConsoleCommand( "ulx", "banid", tostring( list:GetLine( line ):GetValue( 1 ) ), Time:GetText(), Reason:GetText() )
  1204. Frame:Close()
  1205. end
  1206.  
  1207. local cancelbutton = vgui.Create( "DButton", Frame )
  1208. cancelbutton:SetSize( 75, 20 )
  1209. cancelbutton:SetPos( 127, 73 )
  1210. cancelbutton:SetText( "Cancel" )
  1211. cancelbutton.DoClick = function( cancelbutton )
  1212. Frame:Close()
  1213. end
  1214.  
  1215. end ):SetIcon( "icon16/tag_blue_delete.png" )
  1216.  
  1217. menu:Open()
  1218.  
  1219. end
  1220.  
  1221. end )
  1222.  
  1223. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement