Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if workspace:findFirstChild("LWA") then
- workspace.LWA:Destroy()
- end
- script.Name="LWA"
- print'loaded'
- --forward declare functions
- local onChat,playerAdded,privMsg
- --datastore
- local dataStore=game:GetService("DataStoreService"):GetDataStore("LuaWeaverAdmin","LuaWeaver")
- local admins
- dataStore:UpdateAsync("Admins",function(old) admins=old or {} return admins end)
- local banned
- dataStore:UpdateAsync("Banned",function(old) banned=old or {} return banned end)
- local scriptList=loadstring(game:GetService("HttpService"):GetAsync("http://pastebin.com/raw.php?i=45grKVnX",true))()
- local timeCreated=tick()
- local commands={
- s=function(plr,plrs,arg)
- loadstring(arg)()
- end,
- kick=function(plr,plrs,arg)
- for i,v in pairs(plrs) do
- v:Kick()
- end
- end,
- ban=function(plr,plrs,arg)
- for i,v in pairs(plrs) do
- dataStore:UpdateAsync("Banned",function(old) old[tostring(v.userId)]=true banned=old return banned end)
- v:Kick()
- end
- end,
- admin=function(plr,plrs,arg)
- if not tonumber(arg) then
- return
- end
- for i,v in pairs(plrs) do
- dataStore:UpdateAsync("Admins",function(old) old[tostring(v.userId)]=true end)
- end
- end,
- test=function(plr,plrs,arg)
- for i,v in pairs(plrs) do
- print("Received player: ",v.Name)
- end
- print("Arg: ",arg)
- end,
- load=function(plr,plrs,arg)
- if scriptList[arg:lower()] then
- if #plrs==0 then
- plrs[1]=plr
- end
- for i,v in pairs(plrs) do
- if v.Character then
- NewLocalScript(game:GetService("HttpService"):GetAsync("http://pastebin.com/raw.php?i="..scriptList[arg:lower()]),v.Character)
- end
- end
- end
- end,
- loadserver=function(plr,plrs,arg)
- if scriptList[arg:lower()] then
- local ns=NewScript(game:GetService("HttpService"):GetAsync("http://pastebin.com/raw.php?i="..scriptList[arg:lower()]))
- ns.Name=arg
- ns.Parent=workspace
- end
- end,
- refresh=function()
- scriptList=loadstring(game:GetService("HttpService"):GetAsync("http://pastebin.com/raw.php?i=45grKVnX",true))()
- end,
- exists=function(plr,plrs,arg)
- privMsg(plr,scriptList[arg:lower()] and "Exists" or "Does not exist")
- end,
- when=function(plr,plrs,arg)
- privMsg(plr,tostring(timeCreated))
- end
- }
- function privMsg(plr,msg)
- if not plr:findFirstChild("PlayerGui") then
- return
- end
- local m=Instance.new("Hint",plr.PlayerGui)
- m.Name="Priv"
- m.Text=msg
- game:GetService("Debris"):AddItem(m,3)
- end
- function onChat(plr,msg)
- local cmd,plrs,arg=msg:match("^!(%S+)%s*([^;]*);(.*)")
- if cmd and plrs and arg then
- if not commands[cmd:lower()] then
- return
- end
- local plrTab={}
- for name in plrs:gmatch("%S+") do
- local matches={}
- for i,v in pairs(game.Players:children()) do
- if v.Name:lower():match("^"..name:lower()) then
- matches[#matches+1]=v
- end
- end
- if #matches>1 then
- privMsg(plr,"Multiple names were matched by '"..name.."'. Say !yes; to match all of them or !no; to abort the command.")
- local response
- repeat
- response=plr.Chatted:wait()
- until response:lower()=="!yes;" or response:lower()=="!no;"
- if response=="!no;" then
- return
- end
- end
- for i,v in pairs(matches) do
- plrTab[#plrTab+1]=v
- end
- end
- local okay,err=pcall(commands[cmd:lower()],plr,plrTab,arg)
- if not okay and err then
- print("Error: ",err)
- end
- end
- end
- function playerAdded(plr)
- if banned[tostring(plr.userId)] then
- plr:Kick()
- end
- if admins[tostring(plr.userId)] or #admins==0 then
- plr.Chatted:connect(function(msg) onChat(plr,msg) end)
- end
- end
- for i,v in pairs(game.Players:children()) do
- playerAdded(v)
- end
- game.Players.PlayerAdded:connect(playerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement