Advertisement
Mitko1223tm

advanced test

Jan 30th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. local Admins = {["231403525"] = true}
  2. local prefix = ";"
  3.  
  4. local commandTable = {}
  5.  
  6. function findPlayer(name)
  7. for _, player in ipairs(game.Players:GetPlayers()) do
  8. if player.Name:lower() == name:lower() then
  9. return player
  10. end
  11. end
  12. end
  13.  
  14. -- Reset command.
  15. function commandTable.reset(message, player)
  16. player.Character:BreakJoints()
  17. end
  18.  
  19. -- Rejoin command
  20. function commandTable.rejoin(message, player)
  21. game:GetService("TeleportService"):Teleport(game.PlaceId, player)
  22. if player.Character ~= nil then
  23. player.Character:remove()
  24. end
  25. end
  26.  
  27. -- Kill command
  28. function commandTable.kill(message, player)
  29. victim = findPlayer(message)
  30. if victim and victim.Character then
  31. victim.Character:BreakJoints()
  32. end
  33. end
  34.  
  35. -- Kick command
  36. function commandTable.kick(message, player)
  37. victim = findPlayer(message)
  38. if victim and victim.Character then
  39. victim:Kick("[Kick]: "..player.Name.." has kicked you from the game!")
  40. end
  41. end
  42.  
  43. game.Players.PlayerAdded:Connect(function(player)
  44. if Admins[tostring(player.UserId)] then
  45. player.Chatted:Connect(function(message)
  46. local command, argument = message:match(prefix.."(.+) (.+)")
  47. if command and commandTable[command] then
  48. commandTable[command](argument, player)
  49. end
  50. end)
  51. end
  52. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement