Console Say menu

I have a VERY Noobie Question.

Why won’t this work?

Error:


autorun/client/combinemenu.lua:17: ')' expected near '"/y Citizen Stop or recive disiplanry action!"'

Code:

function CombineMenu()
 
    local DermaPanel = vgui.Create( "DFrame" )
    DermaPanel:SetPos( 50, 50 )
    DermaPanel:SetSize( 500, 500 )
    DermaPanel:SetTitle( "Combine Menu" )
    DermaPanel:SetVisible( true )
    DermaPanel:SetDraggable( true )
    DermaPanel:ShowCloseButton( true )
 
    local DermaButton1 = vgui.Create( "DButton" )
    DermaButton1:SetParent( DermaPanel )
    DermaButton1:SetText( "Stop!" )
    DermaButton1:SetPos( 25, 50 )
    DermaButton1:SetSize( 100, 25 )
    DermaButton1.DoClick = function () -- This is DoClick
        RunConsoleCommand( "say" "/y Citizen Stop or recive disiplanry action!" )
	RunConsoleCommand( "say" "/g Pursuing Suspect. Please stand by." )
    end
end
 
concommand.Add("+combinemenu", CombineMenu)

Line 17 you are missing a comma:

[lua]RunConsoleCommand( “say”, “/y Citizen Stop or recive disiplanry action!” ) [/lua]

Thank you! This worked.

But only the first line shows up.

Im testing a few other things. Ill let you guys know if I find one that works.

try this:


RunConsoleCommand( "say /y Citizen Stop or recive disiplanry action!" )  

Because there has to be a slight delay between each message, not sure how to do a fix however. But you can always do something like
[lua]
DermaButton1.DoClick = function () – This is DoClick
RunConsoleCommand( “say” “/y Citizen Stop or recive disiplanry action!; /g Pursuing Suspect. Please stand by.” )
end
[/lua]

Although I’m not entirely sure; nevertheless, it usually works that way in binds, even with the slight delay.

autorun/client/combinemenu.lua:17: ‘)’ expected near ‘"/y Citizen Stop or recive disiplanry action!; /g Pursuing Suspect. Please stand by."’

[lua]DermaButton1.DoClick = function () – This is DoClick
RunConsoleCommand( “say”, “/y Citizen Stop or recive disiplanry action! /g Pursuing Suspect. Please stand by.” )
end
[/lua]

There’s a “)” at the end of that for me…

[lua]
DermaButton1.DoClick = function () – This is DoClick
RunConsoleCommand( “say” << Error no , “/y Citizen Stop or recive disiplanry action!; << Error can’t use ; or it will do this
and error /g Pursuing Suspect. Please stand by.” )
end [/lua]

Cubar what i want it to do is run 2 different commands. I don’t want it to be all in one silly. So like this but this wont work.

[lua]DermaButton1.DoClick = function ()
RunConsoleCommand( “say”, “/y Citizen Stop or recive disiplanry action!” )
RunConsoleCommand( “say”, “/g In foot pursuit. Please stand by.!” )
end[/lua]

Either run it on timer.Simple or make another button for the RunConsoleCommand.

Oh, I forgot that ; can’t be used, my bad. But yeah, use a timer then.

I dont know if you’re still checking this thread, but I’d like to give in my share aswel;

Usually, servers have a weak anti-spam-ish chat-delay, which wont allow you to speak for around
1 second, after typing. So yeah, a timer.Simple should clear it out. Im not an eagle(o.o) at Lua, but I think this is the way:

[lua]function CombineMenu()

local DermaPanel = vgui.Create( "DFrame" )   
DermaPanel:SetPos( 50, 50 )   
DermaPanel:SetSize( 500, 500 )   
DermaPanel:SetTitle( "Combine Menu" )   
DermaPanel:SetVisible( true )   
DermaPanel:SetDraggable( true )   
DermaPanel:ShowCloseButton( true )   

local DermaButton1 = vgui.Create( "DButton" )   
DermaButton1:SetParent( DermaPanel )   
DermaButton1:SetText( "Stop!" )   
DermaButton1:SetPos( 25, 50 )   
DermaButton1:SetSize( 100, 25 )   
DermaButton1.DoClick = function () -- This is DoClick   
    RunConsoleCommand( "say" "/y Citizen Stop or recive disiplanry action!" )   
timer.Simple(1, RunConsoleCommand( "say", "/g Pursuing Suspect. Please stand by." ) )
end  

end

concommand.Add("+combinemenu", CombineMenu)[/lua]

I havent tested that, and Im not going to :stuck_out_tongue: Anyways, I hope it works and I helped. :slight_smile: