I have a VERY Noobie Question.
Why won't this work?
Error: [PHP]
autorun/client/combinemenu.lua:17: ')' expected near '"/y Citizen Stop or recive disiplanry action!"'
[/PHP]
Code: [PHP]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)[/PHP]
Line 17 you are missing a comma:
[lua]RunConsoleCommand( "say", "/y Citizen Stop or recive disiplanry action!" ) [/lua]
[QUOTE=MakeR;20595932]Line 17 you are missing a comma:
[lua]RunConsoleCommand( "say", "/y Citizen Stop or recive disiplanry action!" ) [/lua][/QUOTE]
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.
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.
[QUOTE=Knallex;20597406]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.[/QUOTE]
autorun/client/combinemenu.lua:17: ')' expected near '"/y Citizen Stop or recive disiplanry action!; /g Pursuing Suspect. Please stand by."'
[QUOTE=zzaacckk;20597528]autorun/client/combinemenu.lua:17: ')' expected near '"/y Citizen Stop or recive disiplanry action!; /g Pursuing Suspect. Please stand by."'[/QUOTE]
[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...
[QUOTE=Knallex;20598727]There's a ")" at the end of that for me...[/QUOTE]
[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]
[QUOTE=zzaacckk;20600873]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][/QUOTE]
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 :P Anyways, I hope it works and I helped. :)
Sorry, you need to Log In to post a reply to this thread.