ok i been working on this help menu for darkrp just like the help menu for cop and and mobboss it works and stuff but im not sure where to add the command /x to be able to close the help menu and also the /help.... so all i need is some1 to tell me what file i need to be in and where to add the command to be able to open and close the help menu it works when i first pic the class and the help menu will open just i cant close it and reopen it some1 please help
Chat hook.
ok what file?
Garrysmod wiki is down, I'll look when it's back up.
Though unless you start typing properly I won't do shit for you.
:angel:
lol what you mean by typing properly
[quote]lol what you mean by typing properly[/quote]
Would change to:
[quote]Sorry, what do you mean when you say "typing properly"?[/quote]
ah, ok thank you
Also, capitalisation.
OK, sorry.
:buddy:
I'll reply to this thread when the wiki is up.
Ok, thank you for helping me. :)
Or if the wiki is down forever (:bang:), then you can just use a console command (although not ideal).
[lua]concommand.Add("close_copmenu" , CloseCopMenu)[/lua]
So i would put that in console in game, or?
i am not that good of a scripter, but i do know some.
I sound like a complete idiot.
You could try this... Dunno if it would work.
[lua]
function CloseCopMenu(ply , text , teamonly)
if !(ply == LocalPlayer()) then return end
if string.sub(text , 0 , 2) == "/x" then
// Stick the code to close the menu below here
// And above here! In the little gap :D
end
end
hook.Add("OnPlayerChat" , "CloseCopInfo" , CloseCopMenu)
[/lua]
:dance:
Ok i go and test that, what file would i put this in? cl_init.lua?
lua/autorun/client
OR
addons/ulx/lua/ulx/modules/cl
This help menu is for the gun dealer, as i have made custom shipments and there is a lot of shipments now, so i have just added the help menu so they can see the names of the weapon they want a shipment for.
Just a simple help menu?
Why not use a derma panel with a close button?
Here, i will give the what i have done so far it all works fine just cant close and reopen the menu.
[editline]06:26PM[/editline]
LocalPlayer():GetNWBool("helpgundealer") then
draw.RoundedBox(10, 10, 10, 590, 194, Color(0, 0, 0, 255))
draw.RoundedBox(10, 12, 12, 586, 190, Color(51, 58, 51, 200))
draw.RoundedBox(10, 12, 12, 586, 20, Color(0, 0, 70, 200))
draw.DrawText("gundealer help", "ScoreboardText", 30, 12, Color(255,0,0,255),0)
draw.DrawText("what gun dealers need to know\n-as a gundealer you need a gun licence\n-type /buyshipment(name) or /buy (name)(for only a single weapon instead or 10)\n-these are the names of the weapons\n-ak47, m4a1, aug, deagle, duelelites, famas, fiveseven, g3sg1, gail, glock\n-knife, m249, mac10, mp5, p90, p228, scout, awp, sg550, sg552, tmp, ump45, usp\n-help menu made by death_row_dave, /x to close it", "ScoreboardText", 30, 35, Color(255,255,255,255),0)
[editline]06:27PM[/editline]
Lol, don't ask about the (menu made by death_row_Dave) i was bored. :/
Try this:
[lua]
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 1000, 900 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 900, 800 )
TestingPanel.Paint = function() -- Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) -- Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) -- Draw the rect
end
local DermaButton = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Things you need to know - As a gundealealer, you need a licence. <blah blah blah> Click this message to close the window." )
DermaButton:SetPos( 20, 10 )
DermaButton:SetSize( 200, 100 )
DermaButton.DoClick = function() DermaPanel:Close() end
[/lua]
Ok, sweet where should i put this?
lua/autorun/client/
You also need to add either a console command or chat command for it.
Erm, as i said i am not the best at scripting so would i add the command in with that script or into a diffo place? Also you think you could give me like a site that gives more info on lua for garrysmod?
The whole thread is just 2 people talking, never seen that before.
[url]http://wiki.garrysmod.com/?title=Main_Page[/url]
The wiki is here, it's very helpful for this sort of stuff.
Sorry, you need to Log In to post a reply to this thread.