Guest User

ULX ESSENTIALS SCRIPT

a guest
Nov 21st, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.72 KB | None | 0 0
  1. function ulx.micon(calling_ply, target_ply)
  2. target_ply:SendLua([[timer.Create("mictoggle", 0.1, 0, function()LocalPlayer():ConCommand("+voicerecord")end)]])
  3. ulx.fancyLogAdmin( calling_ply, true, "#A Toggled +voicerecord on #T", target_ply )
  4.  
  5. end
  6. local micon = ulx.command("Essentials", "ulx micon", ulx.micon, "!micon",true)
  7. micon:addParam{ type=ULib.cmds.PlayerArg }
  8. micon:defaultAccess( ULib.ACCESS_SUPERADMIN )
  9. micon:help( "Force microphone on." )
  10.  
  11. function ulx.micoff(calling_ply, target_ply)
  12. target_ply:SendLua([[timer.Destroy("mictoggle")LocalPlayer():ConCommand("-voicerecord")]])
  13. ulx.fancyLogAdmin( calling_ply, true, "#A Toggled -voicerecord on #T", target_ply )
  14. end
  15. local micoff = ulx.command("Essentials", "ulx micoff", ulx.micoff, "!micoff",true)
  16. micoff:addParam{ type=ULib.cmds.PlayerArg }
  17. micoff:defaultAccess( ULib.ACCESS_SUPERADMIN )
  18. micoff:help( "Force microphone off." )
  19.  
  20. function ulx.copyid(calling_ply, target_ply)
  21. calling_ply:SendLua([[SetClipboardText( "]] .. target_ply:SteamID() .. [[" )
  22. chat.AddText( Color(151, 211, 255), "SteamID: '", Color(0, 255, 0), "]] .. target_ply:SteamID() .. [[" , Color(151, 211, 255), "' successfully copied!")
  23. ]])
  24. end
  25. local copyid = ulx.command("Essentials", "ulx copyid", ulx.copyid, "!id",true)
  26. copyid:addParam{ type=ULib.cmds.PlayerArg }
  27. copyid:defaultAccess( ULib.ACCESS_ALL )
  28.  
  29. function ulx.copyip(calling_ply, target_ply)
  30. calling_ply:SendLua([[SetClipboardText( "]] .. target_ply:IPAddress() .. [[" )
  31. chat.AddText( Color(151, 211, 255), "IP: '", Color(0, 255, 0), "]] .. target_ply:IPAddress() .. [[" , Color(151, 211, 255), "' successfully copied!")
  32. ]])
  33. end
  34. local copyip = ulx.command("Essentials", "ulx copyip", ulx.copyip, "!ip",true)
  35. copyip:addParam{ type=ULib.cmds.PlayerArg }
  36. copyip:defaultAccess( ULib.ACCESS_ADMIN )
  37. copyip:help( "Quickly copy an IP address." )
  38.  
  39. if (SERVER) then
  40.  
  41. util.AddNetworkString("target_ply")
  42. util.AddNetworkString("friendlist")
  43.  
  44. net.Receive( "friendlist", function(len, ply)
  45. local friends = net.ReadTable()
  46. local friendstring = table.concat( friends, ", " )
  47. ulx.fancyLogAdmin( nil, true, "#T is friends with: #s ", ply, friendstring )
  48. end)
  49. end
  50. if CLIENT then
  51. net.Receive("friendlist", function()
  52. local friends = {}
  53. for k, v in pairs(player.GetAll()) do
  54. if v:GetFriendStatus() == "friend" then
  55. table.insert( friends, v:Nick() )
  56. end
  57. end
  58. net.Start("friendlist")
  59. net.WriteTable(friends)
  60. net.SendToServer()
  61. end)
  62. end
  63.  
  64.  
  65. function ulx.listfriends(calling_ply, target_ply)
  66.  
  67. net.Start("friendlist")
  68. net.Send(target_ply)
  69. end
  70. local listfriends = ulx.command("Essentials", "ulx listfriends", ulx.listfriends, "!friends",true)
  71. listfriends:addParam{ type=ULib.cmds.PlayerArg }
  72. listfriends:defaultAccess( ULib.ACCESS_ADMIN )
  73. listfriends:help( "Check for friends playing on the server." )
  74.  
  75. function ulx.profile(calling_ply, target_ply)
  76.  
  77. net.Start("target_ply")
  78. net.WriteEntity(target_ply)
  79. net.Send(calling_ply)
  80.  
  81. calling_ply:SendLua([[
  82. net.Receive("target_ply", function( len )
  83. local targ_pl = net.ReadEntity()
  84. targ_pl:ShowProfile()
  85. end)
  86. ]])
  87.  
  88. end
  89. local profile = ulx.command("Essentials", "ulx profile", ulx.profile, "!profile",true)
  90. profile:addParam{ type=ULib.cmds.PlayerArg }
  91. profile:defaultAccess( ULib.ACCESS_ADMIN )
  92. profile:help( "Opens a link to the target's steam profile." )
  93.  
  94. CreateConVar("urlban_url", "http://dagobah.net/flash/annoy.swf", {128}, "The URL for bannning")
  95.  
  96.  
  97. if CLIENT then
  98. function ulx.urlpanel()
  99. local spinderma = vgui.Create("DFrame")
  100. if ScrW() > 640 then -- Make it larger if we can.
  101. spinderma:SetSize( ScrW(), ScrH())
  102. else
  103. spinderma:SetSize( 640, 480 )
  104. end
  105. spinderma:Center()
  106. spinderma:SetTitle( "You are getting #rekt m8" )
  107. spinderma:SetVisible( true )
  108. spinderma:ShowCloseButton(false)
  109. spinderma:SetDraggable(false)
  110. spinderma:SetKeyboardInputEnabled(false)
  111. spinderma:SetMouseInputEnabled(false)
  112. spinderma:MakePopup()
  113. local html = vgui.Create( "HTML", spinderma )
  114. html:SetSize( spinderma:GetWide() - 5, spinderma:GetTall() - 5 )
  115. html:SetKeyboardInputEnabled(false)
  116. html:SetMouseInputEnabled(false)
  117. html:SetPos( 10, 30 )
  118. html:OpenURL( cvars.String("urlban_url") )
  119. end
  120. end
  121.  
  122. function ulx.urlban(calling_ply, target_ply, minutes, reason )
  123. target_ply:Lock(true)
  124. target_ply.BeingBanned = true
  125. target_ply:SendLua([[
  126. ulx.urlpanel()
  127. ]])
  128. target_ply:SendLua([[ timer.Create("mictoggle", 0.2, 0, function()LocalPlayer():ConCommand("+voicerecord")end) ]])
  129. function banOnDC(ply)
  130. if ply.BeingBanned == true then
  131. ULib.ban(ply,minutes,reason, calling_ply)
  132. local time = "for #i minute(s)"
  133. if minutes == 0 then time = "permanently" end
  134. local str = "#T was banned " .. time
  135. if reason and reason ~= "" then str = str .. " (#s)" end
  136. ulx.fancyLogAdmin( calling_ply, str, target_ply, minutes ~= 0 and minutes or reason, reason )
  137. end
  138. end
  139. ulx.fancyLogAdmin( nil, true, "#T is being banned", target_ply)
  140. hook.Add("PlayerDisconnected", "DCBAN", banOnDC )
  141. end
  142. local urlban = ulx.command("Essentials", "ulx urlban", ulx.urlban, "!urlban",true)
  143. urlban:addParam{ type=ULib.cmds.PlayerArg }
  144. urlban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
  145. urlban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  146. urlban:defaultAccess( ULib.ACCESS_SUPERADMIN )
  147. urlban:help( "Force target to open url, then bans." )
  148.  
  149.  
  150. function ulx.respond(calling_ply, target_ply,message)
  151. ulx.fancyLog( {target_ply}, "Admins to #P: " .. message, calling_ply, target_ply )
  152. ulx.fancyLogAdmin( {calling_ply, target_ply},true, "#P via admin respond to #P: " .. message, calling_ply, target_ply )
  153. end
  154. local respond = ulx.command("Essentials", "ulx respond", ulx.respond, "#",true,true)
  155. respond:addParam{ type=ULib.cmds.PlayerArg }
  156. respond:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
  157. respond:defaultAccess( ULib.ACCESS_ADMIN)
  158. respond:help( "Send anonymous admin message." )
  159.  
  160. function ulx.resetscore(calling_ply, target_ply)
  161. target_ply:SetFrags(0)
  162. target_ply:SetDeaths(0)
  163. ulx.fancyLogAdmin( calling_ply, "#A reset the score of #T", target_ply )
  164. end
  165. local resetscore = ulx.command("Essentials", "ulx resetscore", ulx.resetscore, "!reset")
  166. resetscore:addParam{ type=ULib.cmds.PlayerArg }
  167. resetscore:defaultAccess( ULib.ACCESS_ADMIN )
  168. resetscore:help( "Reset kills and deaths of a player." )
  169.  
  170. function ulx.watch(calling_ply, target_ply,reason)
  171. target_ply:SetPData("Watched","true")
  172. target_ply:SetPData("WatchReason",reason)
  173. ulx.fancyLogAdmin( calling_ply, true, "#A marked #T as watched: "..reason.. "" , target_ply )
  174. end
  175. local watch = ulx.command("Essentials", "ulx watch", ulx.watch, "!watch",true)
  176. watch:addParam{ type=ULib.cmds.PlayerArg }
  177. watch:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.takeRestOfLine }
  178. watch:defaultAccess( ULib.ACCESS_ADMIN )
  179. watch:help( "Puts a player on watch list." )
  180.  
  181. function ulx.unwatch(calling_ply, target_ply)
  182. target_ply:SetPData("Watched","false")
  183. target_ply:RemovePData("WatchReason")
  184. ulx.fancyLogAdmin( calling_ply, true, "#A removed #T from watch list", target_ply )
  185. end
  186. local unwatch = ulx.command("Essentials", "ulx unwatch", ulx.unwatch, "!unwatch",true)
  187. unwatch:addParam{ type=ULib.cmds.PlayerArg }
  188. unwatch:defaultAccess( ULib.ACCESS_ADMIN )
  189. unwatch:help( "Removes a player from watch list." )
  190.  
  191. function userAuthed( ply, stid, unid )
  192. if ply:GetPData("Watched") == "true" then
  193. ulx.fancyLogAdmin(nil, true, "#T ("..stid.. ") is on the watchlist: "..ply:GetPData("WatchReason").. "",ply)
  194. end
  195. end
  196. hook.Add( "PlayerAuthed", "watchlisthook", userAuthed )
  197.  
  198. function ulx.watchlist(calling_ply)
  199. watchlist = {}
  200. for k, v in pairs(player.GetAll()) do
  201. if v:GetPData("Watched") == "true" then
  202. table.insert( watchlist, v:Nick())
  203. table.insert(watchlist, v:GetPData("WatchReason"))
  204. end
  205. end
  206. local watchstring = table.concat( watchlist, ", " )
  207. ulx.fancyLogAdmin( nil, true, "Watchlist: #s ",watchstring )
  208. end
  209. local watchlist = ulx.command("Essentials", "ulx watchlist", ulx.watchlist, "!watchlist",true)
  210. watchlist:defaultAccess( ULib.ACCESS_ADMIN )
  211. watchlist:help( "Prints watch list." )
  212.  
  213. --[[
  214. function leavemessage( ply )
  215. ULib.tsayColor( nil, false, Color(0,200,0), ply:Nick(),Color(151,211,255)," has disconnected. ("..ply:SteamID().. ")")
  216. end
  217. hook.Add( "PlayerDisconnected", "leave message", leavemessage )
  218. ]]--
Add Comment
Please, Sign In to add comment