Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local admins = {
- ["metaindex"] = true,
- ["ErrorAlert"] = true,
- ["ErrorSurge"] = true
- }
- local cmd = {}
- local cmds = {}
- local network = {}
- local prefix = "."
- function network.getPlayer(speaker,str)
- str = str:lower()
- local targets = {}
- if str == "me" then
- table.insert(targets,speaker)
- elseif str == "all" then
- local c = game.Players:GetPlayers()
- for i = 1,#c do
- table.insert(targets,c[i])
- end
- elseif str == "others" then
- local c = game.Players:GetPlayers()
- for i = 1,#c do
- if c[i].Name ~= speaker.Name then
- table.insert(targets,c[i])
- end
- end
- end
- for i,v in pairs(game.Players:GetPlayers()) do
- if v.Name:lower():sub(1,str:len()) == str:lower() then
- table.insert(targets,v)
- end
- end
- return targets
- end
- function network.checkAdmin(user)
- local admin = false
- for key,value in pairs(admins) do
- local key = game.Players:GetUserIdFromNameAsync(key)
- local userid = user.UserId
- if key == userid then
- admin = true
- end
- end
- return admin
- end
- function cmd.new(speaker,msg,cmd,func)
- if not cmds[cmd] then
- cmds[cmd] = true
- end
- msg = msg:lower()
- local args = {}
- for i in string.gmatch(msg,"%S+") do
- table.insert(args,i)
- end
- for i,v in pairs(args) do
- if v == prefix..cmd then
- local target = args[i + 1]
- local value = args[i + 2]
- if tonumber(target) == nil then
- target = network.getPlayer(speaker,target)
- func(target,value)
- else
- print(target)
- value = target
- func({speaker},value)
- end
- end
- end
- end
- function network.walkSpeed(targets,value)
- for i,v in pairs(targets) do
- local humanoid = v.Character:FindFirstChildWhichIsA("Humanoid")
- if humanoid and value then
- humanoid.WalkSpeed = value
- end
- end
- end
- function network.jumpPower(targets,value)
- for i,v in pairs(targets) do
- local humanoid = v.Character:FindFirstChildWhichIsA("Humanoid")
- if humanoid and value then
- humanoid.WalkSpeed = value
- end
- end
- end
- function network.hipHeight(targets,value)
- for i,v in pairs(targets) do
- local humanoid = v.Character:FindFirstChildWhichIsA("Humanoid")
- if humanoid and value then
- humanoid.HipHeight = value
- end
- end
- end
- game.Players.PlayerAdded:Connect(function(player)
- local connection = player.Chatted:Connect(function(msg,recipient)
- local isAdmin = network.checkAdmin(player)
- if isAdmin then
- cmd.new(player,msg,"ws",
- function(targets,value)
- network.walkSpeed(targets,value)
- end
- )
- cmd.new(player,msg,"jp",
- function(targets,value)
- network.jumpPower(targets,value)
- end
- )
- cmd.new(player,msg,"hh",
- function(targets,value)
- network.hipHeight(targets,value)
- end
- )
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement