cbhusker
|
  |
| Joined: 07 Feb 2011 |
| Total Posts: 517 |
|
|
| 21 Dec 2015 02:46 PM |
Hey guys, it's Cbhusker. So right now, this script would work, minus one bit. but I'll get back to that in a minute... So I have this script that I have and it is a tournament script, that selects the order people will fight in. Once an admin says 'run SFT' then it will go and make sure there is an even number of people playing. If there is not, it asks the admin which player will not play. and heres the dilemna... How do I take what the admin said to tell the script that.. As of now, I only know how to make the script do something if the admin says a specific thing. so how do I make the SCRIPT listen, then understand how to make it say that in the console.
*NOTE* I do not need help with telling the script HOW to make the player selected to not play, only (TAKING WHAT THE ADMIN SAYS AND TURNING THAT INTO THEY'RE NAME).
local admins = {"Player"} function tableContains(t, value) for _, v in pairs(t) do if v == value then return true end end return false end function onChatted(message, player) if message == "run SFT" and tableContains(admins, player.Name) then for _, players in pairs(game.Players:GetPlayers()) do local PlayerArray = {players.Name} if #PlayerArray % 2 == 0 then else print("Odd number of players.. who will not participate?") if message == "" and tableContains(admins, player.Name) then print("Alright, "..THEIR_NAME_HERE.." will not compete.") end end end end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)
print("Hello World!") |
|
|
| Report Abuse |
|
|
cbhusker
|
  |
| Joined: 07 Feb 2011 |
| Total Posts: 517 |
|
|
| 21 Dec 2015 02:51 PM |
To clear things up..
for example: The game may go like this::
Admin: "run SFT"
Game: "Odd number of players.. who will not participate?"
Admin: "Cbhusker"
Game: "Alright, Cbhusker will not compete."
(then the rest of the script will go on..
print("Hello World!") |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 21 Dec 2015 03:05 PM |
something like this? (include your admin table/connect statements/tableContains
function do_SFT(p) if p then -- don't use player p -- player obj else -- use everyone end -- blah end
function is_player(n) local p=game.Players:GetChildren() for i=1,#p do if(p[i].Name==n)then return true end end return false end
local expecting=false function onChatted(message, player) if message == "run SFT" and tableContains(admins, player.Name) then if (game.Players.NumPlayers % 2 == 0) then do_SFT(nil) else expecting=true end elseif (expecting) and (is_player(message)) then do_SFT(game.Players[message]) end end |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 21 Dec 2015 03:06 PM |
| after the second do_SFT you probably want to set expecting back to false :p |
|
|
| Report Abuse |
|
|
XIPokezIX
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 381 |
|
|
| 21 Dec 2015 03:29 PM |
""if (game.Players.NumPlayers % 2 == 0) then do_SFT(nil) else""
bish wet |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2015 03:36 PM |
| Well just pray to God in your time of need and he will deliver you from your worries. |
|
|
| Report Abuse |
|
|