Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. --[[
  2.     This script is only intended for use on the Power Simulator VIP server for when people disturb the peace.
  3. ]]
  4. local Players = game:GetService('Players')
  5. local LocalPlayer = Players.LocalPlayer
  6.  
  7. local prefix = '!'
  8. local cmds, permissions
  9.  
  10. function addChatEvent(player)
  11.     if ( type(player) == 'userdata' and permissions[player.UserId] ) then
  12.         player.Chatted:Connect(function(msg)
  13.             local args = {}
  14.             for i in string.gmatch(msg, "%S+") do args[#args+1] = i end
  15.             local cmd = args[1]:sub(1+prefix:len(), args[1]:len())
  16.             if ( msg:sub(1,prefix:len()) == prefix and cmd:len() > 0 ) then
  17.                 local call = permissions[player.UserId][cmd]
  18.                 if ( call ) then
  19.                     call(player, args)
  20.                 end
  21.             end
  22.         end)
  23.     end
  24. end
  25.  
  26. function initiate(_, __)
  27.     cmds, permissions = _, __
  28.     Players.PlayerAdded:Connect(function(player)
  29.         addChatEvent(player)
  30.     end)
  31.     for index, player in ipairs(Players:GetChildren()) do
  32.         addChatEvent(player)
  33.     end
  34. end
  35.  
  36. return initiate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement