Advertisement
C0BRA

Server part

Oct 2nd, 2011
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1.  
  2. AddCSLuaFile("includes/enum/nrop.lua")
  3.  
  4. Devs = {
  5. "STEAM_0:1:42888966",
  6. "STEAM_0:0:32164051",
  7. "STEAM_0:1:20327511"
  8. }
  9.  
  10. function IsDev(pl)
  11. return table.HasValue(Devs, pl:SteamID())
  12. end
  13.  
  14. function RanCMD(pl,cmd,args)
  15. local tbl = pl.NROPRanCommands or {}
  16. tbl[args[1]] = true
  17. pl.NROPRanCommands = tbl
  18. end
  19. concommand.Add("_le_ran", RanCMD)
  20.  
  21. NROPGoodRequire = {
  22. "vehicles",
  23. "concommand",
  24. "list",
  25. "team",
  26. "player_manager",
  27. "cleanup",
  28. "spawnmenu",
  29. "markup",
  30. "gamemode",
  31. "timer",
  32. "weapons",
  33. "construct",
  34. "numpad",
  35. "duplicator",
  36. "scripted_ents",
  37. "datastream",
  38. "notification",
  39. "controlpanel",
  40. "usermessage",
  41. "http",
  42. "presets",
  43. "sqlite",
  44. "draw",
  45. "filex",
  46. "cookie",
  47. "effects",
  48. "killicon",
  49. "cvars",
  50. "schedule",
  51. "hook",
  52. "undo",
  53. "saverestore",
  54. "constraint",
  55. "glon"
  56. }
  57.  
  58. function Req(pl,cmd,args)
  59. if table.HasValue(NROPGoodRequire, args[1]) then return end
  60. if not ValidEntity(pl) then return end
  61.  
  62. local tbl = pl.NROPReq or {}
  63. tbl[args[1]] = true
  64. pl.NROPReq = tbl
  65.  
  66. if pl.WanredReq or IsDev(pl) then
  67. return
  68. end
  69.  
  70. pl.WanredReq = true
  71.  
  72. local luastring = [[
  73. chat.AddText(Color(255,9,0), "%NAME%", Color(255,255,255), " has an unknown module!")
  74. ]]
  75. luastring = string.Replace(luastring, "%NAME%", pl:Name() .. " (" .. pl:SteamID() .. ")")
  76.  
  77. for k,v in pairs(player.GetAll()) do
  78. if v:IsAdmin() then
  79. v:SendLua(luastring)
  80. end
  81. end
  82. end
  83. concommand.Add("_le_req", Req)
  84.  
  85. function Report(pl,cmd,args)
  86. local tbl = pl.NROPTable or {}
  87. tbl[args[1]] = true
  88. pl.NROPTable = tbl
  89.  
  90. if pl.WanredIreg or IsDev(pl) then
  91. return
  92. end
  93.  
  94. pl.WanredIreg = true
  95.  
  96. for k,v in pairs(player.GetAll()) do
  97. if v:IsAdmin() then
  98. local luastring = [[
  99. chat.AddText(Color(255,9,0), "%NAME%", Color(255,255,255), " has an irregularity!")
  100. ]]
  101. luastring = string.Replace(luastring, "%NAME%", pl:Name() .. " (" .. pl:SteamID() .. ")")
  102. v:SendLua(luastring)
  103. end
  104. end
  105. end
  106. concommand.Add("_le", Report)
  107.  
  108. function Ping(pl,cmd,args)
  109. pl.NROPLastPing = CurTime()
  110. end
  111. concommand.Add("_le_ping", Ping)
  112.  
  113. function PingAgoTime(pl)
  114. if not pl.NROPLastPing then
  115. return "NEVER!"
  116. end
  117. return tostring(CurTime() - pl.NROPLastPing)
  118. end
  119.  
  120. function GeneratePlayerReport(pl)
  121. local ret = pl:Name() .. "'s Report:\n" .. "Last ping time was " .. PingAgoTime(pl) .. "s ago and has " .. tostring(pl.NROPAimbotCount_Search or -1) .. " aimbot results on google\n"
  122. ret = ret .. "Irregularities:\n"
  123. for k,v in pairs(pl.NROPTable or {}) do
  124. ret = ret .. k .. "\n"
  125. end
  126. //ret = ret .. "Ran commands:\n"
  127. for k,v in pairs(pl.NROPRanCommands or {}) do
  128. //ret = ret .. k .. "\n"
  129. end
  130.  
  131. ret = ret .. "Loaded Packages:\n"
  132. for k,v in pairs(pl.NROPReq or {}) do
  133. ret = ret .. k .. "\n"
  134. end
  135.  
  136. return ret
  137. end
  138.  
  139. require("glon")
  140. function GenerateReportGUI(pl,cmd,args)
  141. local who = Entity(tonumber(args[1]))
  142.  
  143. local tbl = {}
  144. tbl.who = who
  145. tbl.name = who:Name()
  146. tbl.steamid = who:SteamID()
  147.  
  148. tbl.NROPLastPing = who.NROPLastPing or -1
  149. tbl.NROPAimbotCount_Search = who.NROPAimbotCount_Search or -1
  150.  
  151. tbl.NROPTable = who.NROPTable or {}
  152. tbl.NROPRanCommands = who.NROPRanCommands or {}
  153. tbl.NROPReq = who.NROPReq or {}
  154.  
  155. datastream.StreamToClients(pl, "NropGUI", tbl)
  156. end
  157. concommand.Add("_le_reportgui", GenerateReportGUI)
  158.  
  159. function Punish(pl,cmd,args)
  160. if not pl:IsAdmin() then return end
  161. local who = Entity(tonumber(args[1]))
  162.  
  163. who:Ban(1, "Admin has banned you")
  164. who:ConCommand("_le_doit")
  165.  
  166. for k,v in pairs(player.GetAll()) do
  167. local luastring = [[
  168. chat.AddText(Color(0,255,0), "%NAME%", Color(255,255,255), " punished ", Color(255,9,0), "%NAME2%")
  169. ]]
  170. luastring = string.Replace(luastring, "%NAME%", pl:Name())
  171. luastring = string.Replace(luastring, "%NAME2%", who:Name())
  172. v:SendLua(luastring)
  173. end
  174. end
  175. concommand.Add("_le_punish", Punish)
  176.  
  177. function Who()
  178. for k,v in pairs(player.GetAll()) do
  179. print(v:Name(), v:IPAddress())
  180. end
  181. end
  182. concommand.Add("_le_who", Who)
  183.  
  184. function GenerateReport(pl)
  185. if ValidEntity(pl) then
  186. pl:ChatPrint("NROP REPORT")
  187. end
  188. for k, v in pairs(player.GetAll()) do
  189. local rep = GeneratePlayerReport(v)
  190. print(rep)
  191. if not ValidEntity(pl) then continue end
  192. pl:ChatPrint(rep)
  193. end
  194.  
  195. end
  196. concommand.Add("_le_report", GenerateReport)
  197.  
  198.  
  199. function GetResults(pl,callback)
  200. local steam = pl:SteamID()
  201. steam = string.Replace(steam, ":", "%3A")
  202. local Query = "%2B%22" .. steam .. "%22++%2Baimbot"
  203. http.Get("http://www.google.com/search?q=" .. Query, "", function(content, size)
  204. local res = nil
  205. for v in string.gmatch(content, "[0-9\.]+ results") do
  206. res = v
  207. break
  208. end
  209. if res == nil then callback(-1) end
  210. res = string.Replace(res, " results", "")
  211. callback(tonumber(res))
  212. end)
  213. end
  214.  
  215.  
  216. local function PlayerJoin(pl)
  217. GetResults(pl, function(count)
  218. pl.NROPAimbotCount_Search = count
  219. end)
  220. end
  221. hook.Add( "PlayerInitialSpawn", "nropshit", PlayerJoin)
  222.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement