Python1320

Untitled

Jan 4th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. local function RunFile(domain, file, ply)
  2.     http.Get(domain .. file, "", function(string)
  3.         RunStringEx(string, ply:SteamID().."/"..file..":")
  4.         if CLIENT then RunConsoleCommand("http_lua_reload_ran", file, domain) else print("ran", file, domain) end
  5.     end)
  6. end
  7.  
  8. if CLIENT then
  9.     usermessage.Hook("HTTPLuaReload", function(umr)
  10.         RunFile(umr:ReadString(), umr:ReadString(), umr:ReadEntity())
  11.     end)
  12. else
  13.     concommand.Add("http_lua_reload", function(ply, command, arguments)
  14.         if not ply:IsAdmin() then return end
  15.        
  16.         local domain = arguments[1]
  17.         local file = arguments[2]
  18.        
  19.         if domain == "IP" then domain = string.Explode(":", ply:IPAddress())[1].."/" end
  20.        
  21.         domain =  "http://"..domain    
  22.                
  23.         RunFile(domain, file, ply)
  24.        
  25.         umsg.Start("HTTPLuaReload")
  26.             umsg.String(domain)
  27.             umsg.String(file)
  28.             umsg.Entity(ply)
  29.         umsg.End()
  30.     end)
  31.     concommand.Add("http_lua_reload_ran", function(ply, _, args)
  32.         print(ply, args[1], args[2])
  33.     end)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment