slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 12 Jan 2012 10:59 PM |
Hi, I've spent the last 2 hours tinkering with the "edit/" command.
EVERY command works in the script, I just think the message "exit/" or "edit/" is getting added into the StringValue. I can't figure out how to get it to not do that. So, if anybody could help, that would be fantastic.
Look towards the bottom of the script (function edit() and the while true do)
Thanks, Slayer219
banned = {} cat = "game.Players." banworthy = {"game.Workspace:Destroy()", "game.Workspace:Remove()", string.sub(cat,1,13)}
game.Players.PlayerAdded:connect(function(speaker) repeat wait() until speaker:findFirstChild("PlayerGui") repeat wait() until speaker.PlayerGui:findFirstChild("Status") bool = Instance.new("BoolValue") bool.Parent = speaker bool.Name = "EditMode" bool.Value = false for i = 1, #banned do if (speaker.Name == banned[i]) then repeat wait() until speaker speaker:Destroy() end end
speaker.Chatted:connect(function(msg)
function create() r = Instance.new("StringValue") r.Parent = speaker r.Name = string.sub(msg,8) ru = string.sub(msg,8) g = speaker:findFirstChild(ru) speaker.PlayerGui.Status.TextLabel.Text = "Created "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " end
function edit() b = speaker:findFirstChild("EditMode") if b then speaker.PlayerGui.Status.TextLabel.Text = "Now editing "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " b.Value = true end end
function run() pcall(function() loadstring(g.Value)() end) speaker.PlayerGui.Status.TextLabel.Text = "ran "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " end
function ban() table.insert(banned, speaker.Name) speaker:Destroy() end
if string.sub(msg,1,7) == "create/" then create() end
if string.sub(msg,1,5) == "edit/" then edit() end
if string.sub(msg,1,4) == "run/" then run() end
while true do --This is what I think's the problem wait() if (b.Value == true) and (string.sub(msg,1,5) ~= "exit/") then g.Value = g.Value..msg elseif msg == "exit/" then wait() b.Value = false end end
for k = 1, #banworthy do if msg == banworthy[i] then table.insert(banned, speaker.Name) speaker:Destroy() end end
end) end)
|
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 11:04 PM |
| Do you just want to get rid of the messages? I think I could do that |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
| |
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
| |
|
| |
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 13 Jan 2012 02:00 AM |
| ^^^^^ Spam much? Get out unless you have something productive to say. |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
| |
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
| |
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
| |
|
|
| 15 Jan 2012 01:56 AM |
wouldn't it get stuck on the while loop since you never break it?
~I've been to nil and back. |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2012 02:35 AM |
| Bump isn't productive either :O |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2012 02:38 AM |
for k = 1, #banworthy do if msg == banworthy[i] then table.insert(banned, speaker.Name) speaker:Destroy() end end
this part will never start, because you made an infinite loop before, so that would never end. Try switching both so the loop comes at the end. |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2012 02:40 AM |
if (string.sub(msg,1,5) ~= "exit/") then if (b.Value == true) then g.Value = g.Value..msg elseif msg == "exit/" then wait() b.Value = false end end |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 15 Jan 2012 11:40 AM |
I have to say, bumping is quite productive. Without a bump you never would have seen this thread.
Anyway, I still can't get it to work. I think I know how to test it though... I'll get back to you.
|
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 15 Jan 2012 12:07 PM |
Found out what's wrong (after tinkering with the script some more) the exit/ command is no longer working. Let's see what you guys think. I can successfully run one script, but everything after exit/ gets added to the script (run/, create/, etc.).
banned = {} cat = "game.Players." banworthy = {"game.Workspace:Destroy()", "game.Workspace:Remove()", string.sub(cat,1,13)}
game.Players.PlayerAdded:connect(function(speaker) repeat wait() until speaker:findFirstChild("PlayerGui") repeat wait() until speaker.PlayerGui:findFirstChild("Status") bool = Instance.new("BoolValue") bool.Parent = speaker bool.Name = "EditMode" bool.Value = false for i = 1, #banned do if (speaker.Name == banned[i]) then repeat wait() until speaker speaker:Destroy() end end
speaker.Chatted:connect(function(msg)
function create() r = Instance.new("StringValue") r.Parent = speaker r.Name = string.sub(msg,8) ru = string.sub(msg,8) g = speaker:findFirstChild(ru) speaker.PlayerGui.Status.TextLabel.Text = "Created "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " end
function edit() b = speaker:findFirstChild("EditMode") if b then speaker.PlayerGui.Status.TextLabel.Text = "Now editing "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " b.Value = true end end
function run() pcall(function() loadstring(g.Value)() end) speaker.PlayerGui.Status.TextLabel.Text = "ran "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " end
function ban() table.insert(banned, speaker.Name) speaker:Destroy() end
function exit() if b then if b.Value == true then b.Value = false speaker.PlayerGui.Status.TextLabel.Text = "No Longer Editing "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " end end end
for k = 1, #banworthy do if msg == banworthy[i] then table.insert(banned, speaker.Name) speaker:Destroy() end end
if string.sub(msg,1,7) == "create/" then create() end
if string.sub(msg,1,5) == "edit/" then edit() end
if string.sub(msg,1,4) == "run/" then run() end
if (string.sub(msg,1,5) ~= "exit/") then if (string.sub(msg,1,5) ~= "edit/") then if (b.Value == true) then g.Value = g.Value..msg speaker.PlayerGui.Status.TextLabel.Text = "Text added to "..ru wait(2) speaker.PlayerGui.Status.TextLabel.Text = " " elseif msg == "exit/" then exit() end end end
end) end)
|
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 15 Jan 2012 12:19 PM |
| Nevermind, I fixed it. Working great. Thanks for the ideas generated here! |
|
|
| Report Abuse |
|
|