Advertisement
FNCxPro

Untitled

May 18th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. local gPlayers = game.Players
  2. local Murderer = ""
  3. local Sheriff = ""
  4.  
  5. --[[
  6. By Relatively
  7.  
  8. Commands
  9. twisted.roles displays roles to all players at top of screen
  10.  
  11. twisted.mute [p] mutes [p]
  12.  
  13. twisted.unmute [p] unmutes [p]
  14.  
  15. twisted.mode [s] changes the mode at the top of the screen to [s].
  16.  
  17.  
  18. ]]--
  19.  
  20. --[[ checkRole by eZaF/Murphy ]]--
  21. function checkRole(plr, role)
  22. for i,v in pairs(workspace:children()) do
  23. if v:IsA("Model") and v:findFirstChild("Humanoid") then
  24. if v:findFirstChild("Role") then
  25. if v.Role ~= nil and v.Role.Value == role then
  26. if v.Name:lower() == plr.Name:lower() then
  27. return true
  28. end
  29. end
  30. end
  31. end
  32. end
  33. end
  34.  
  35. --[[ getPlayer by Chirality ]]--
  36. local function getPlayer(name)
  37. local nameTable = {}
  38.  
  39. if name == "me" then
  40. nameTable[1] = admin
  41. elseif name == "all" then
  42. for i,v in pairs(gPlayers:GetChildren()) do
  43. nameTable[i] = v.Name
  44. end
  45. elseif name == "others" then
  46. for i,v in pairs(gPlayers:GetChildren()) do
  47. if v.Name ~= admin then
  48. nameTable[i] = v.Name
  49. end
  50. end
  51. else
  52. for i,v in pairs(gPlayers:GetChildren()) do
  53. local lname = v.Name:lower()
  54. local i,j = lname:find(name)
  55. if i == 1 then
  56. nameTable[1] = v.Name
  57. end
  58. end
  59. end
  60. return nameTable
  61. end
  62.  
  63. --[[ setMode by Relatively ]]--
  64. function setMode(mode)
  65. game.Workspace.GameInProgress.Mode.Value = mode
  66. end
  67.  
  68. --[[ refresh by Relatively ]]--
  69. function refresh()
  70. for i,h in pairs(game.Players:GetChildren()) do
  71. local char = h.Character
  72. local humanoi = char:FindFirstChild("Humanoid")
  73. if humanoi then
  74. if checkRole(h, "Murderer") then
  75. Murderer = h.Name
  76. elseif checkRole(h, "Sheriff") then
  77. Sheriff = h.Name
  78. else
  79.  
  80. end
  81. end
  82. end
  83. setMode("Murderer: "..Murderer.." Sheriff: "..Sheriff)
  84. end
  85.  
  86. SetCommandCallback(function(msg)
  87. if msg == "twisted.roles" then
  88. refresh()
  89. elseif msg:sub(1,12) == "twisted.mute" then
  90. local players = getPlayer(msg:sub(14))
  91. if players ~= nil then
  92. for i, v in pairs(players) do
  93. game.Players[v].Muted.Value = true
  94. end
  95. end
  96. elseif msg:sub(1,14) == "twisted.unmute" then
  97. local players = getPlayer(msg:sub(16))
  98. if players ~= nil then
  99. for i, v in pairs(players) do
  100. game.Players[v].Muted.Value = false
  101. end
  102. end
  103. elseif msg:sub(1,13) == "twisted.muted" then
  104. local players = getPlayer(msg:sub(15))
  105. if players ~= nil then
  106. for i, v in pairs(players) do
  107. print(v.Name..": "..game.Players[v].Muted.Value)
  108. end
  109. end
  110. elseif msg:sub(1,12)=="twisted.mode" then
  111. setMode(msg:sub(14))
  112. end
  113. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement