Hello!
I need help with this button function...
[CODE]local Clicker = vgui.Create("DButton", hello)
Clicker:SetText("I always wanted to be a cop! :D")
Clicker:SetSize(200, 35)
Clicker:SetPos(230,200)
Clicker:SetConsoleCommand("say", "/cp")
Clicker:SetFont( "GModToolName" )
Clicker:SetTextColor( Color( 252, 252, 252 ) )
Clicker.Paint = function()
surface.SetDrawColor( 112, 112, 112 )
draw.RoundedBox( 8, 0, 0, Clicker:GetWide(), Clicker:GetTall(), Color( 0,0,0,200 ) )
end[/CODE]
so when you click on button it answers with say command "/cp" and with function
[CODE]Clicker.DoClick = function()
hello:Close() end[/CODE]
I know its something with if =, but sorry i am not long in this waters.
Thanks for help in advance.
Im not sure what your problem is. What is wrong with this? Do you get an error?
Well when you press the button it makes you a cp but it doesnt close the panel, so i added the function for closing panel the function in upper message but it just close the panel and not make you a cp.
Here's an example of an NPC where you press USE on and it'll open a menu with 2 buttons. Join team 2, and close..
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_zipped_code/acecool_npc_jointeam_example.rar[/url]
Simple example of npc, shows how to set up a basic npc ( I'll be adding a few other examples where this system is added on to such as dynamic vgui screens based on npc, or teams, etc... )
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_zipped_code/acecool_npc_jointeam_example.rar[/url]
Also, there is a dev function in there. dev_spawnent x where x is where you'd type the entity name you want to spawn ( it'll spawn 5 feet or so in front of you, taken from: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/entities/spawn_entity_in_front_of_player_by_calc_size_of_object.lua.html[/url] )
@Acecool on make so on your join team 2 button you close the panel after pressing the button. So you join team 2 and close the panel.
What are you asking for?
Yeah, to make it close when you "join" change
[code] _bjoin.DoClick = function( )
net.Start( "npc_jointeam_cl_to_server_join_team" );
net.SendToServer( );
end[/code]
to include the line included here
[code] _bexit.DoClick = function( )
_panel:Remove( );
end[/code]
which turns it into
[code] _bjoin.DoClick = function( )
net.Start( "npc_jointeam_cl_to_server_join_team" );
net.SendToServer( );
_panel:Remove( );
end[/code]
Sorry, you need to Log In to post a reply to this thread.