Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. local commands = {"kick", "get", "rank", "script"}
  2. local adminName = "NoobllV"
  3.  
  4. function kickPlayer(player)
  5. player:remove()
  6. end
  7.  
  8. function getAddress(player)
  9. local ip = player["IP Adress"]
  10. _G.notify("IP Adress: "..ip.Value, game.Players[adminName], Color3.new(0, 0, 0), 2)
  11. end
  12.  
  13. function rankPlayer(player)
  14. ranking = true
  15. rankingPlayer = player
  16. delay(5, (function() ranking = false rankingPlayer = nil end))
  17. end
  18.  
  19. function executeScript(source)
  20. local status, errorMsg = pcall(function()
  21. loadstring(source)()
  22. end)
  23. if (not status) then
  24. _G.notify("Error: "..errorMsg, game.Players[adminName], Color3.new(0, 0, 0), 2)
  25. end
  26. end
  27.  
  28. function playerEntered(player)
  29. if (player.Name == adminName) then
  30. player.Chatted:connect(playerChatted)
  31. end
  32. end
  33.  
  34. function playerChatted(message)
  35. local functions = {kickPlayer, getAddress, rankPlayer, executeScript}
  36. for index, command in ipairs(commands) do
  37. local length = string.len(command)
  38. local chat = string.sub(message, 1, length)
  39. if (chat == command) then
  40. local totalLength = string.len(message)
  41. local playerName = string.sub(message, length + 2, totalLength)
  42. local player = game.Players:findFirstChild(playerName)
  43. if (player) then
  44. functions[index](player)
  45. else
  46. functions[index](playerName)
  47. end
  48. end
  49. end
  50. if (tonumber(message) ~= nil) then
  51. if (ranking) and (rankingPlayer ~= nil) then
  52. rankingPlayer:WaitForDataReady()
  53. rankingPlayer:SaveNumber("Rank", tonumber(message))
  54. rankingPlayer.leaderstats.Rank.Value = tonumber(message)
  55. rankingPlayer = nil
  56. ranking = false
  57. end
  58. end
  59. end
  60.  
  61. game.Players.ChildAdded:connect(playerEntered)
  62.  
  63. while wait() do
  64. if (game:findFirstChild("NetworkServer") ~= nil) then
  65. break
  66. end
  67. end
  68.  
  69. game.NetworkServer.IncommingConnection:connect(function(adress, child)
  70. local connected = false
  71. game.Players.ChildAdded:connect(function(player)
  72. if (not connected) then
  73. connected = true;
  74. local ip = Instance.new("StringValue", player)
  75. ip.Name = "IP Adress"
  76. ip.Value = adress
  77. end
  78. end)
  79. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement