• Print

Author Topic: I need help with a derma  (Read 15190 times)

0 Members and 1 Guest are viewing this topic.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #30 on: November 24, 2014, 04:46:40 pm »
This is the code i used...

Code: Lua
  1. if (SERVER) then
  2.         util.AddNetworkString( "Give" )
  3.         net.Receive( "Give", function( len, ply )
  4.                 ply:give( "weapon_ak47custom" )
  5.         end )
  6. end
  7.  
  8. if (CLIENT) then
  9.         local midW, midH = ScrW() / 2, ScrH() / 2
  10.         local function OpenMyDerma()
  11.                 local MyDerma = vgui.Create( "DFrame" )
  12.                         MyDerma:SetSize( 300, 300 )
  13.                         MyDerma:SetPos( midW - ( MyDerma:GetWide() / 2 ), midH - ( MyDerma:GetTall() / 2) )
  14.                         MyDerma:SetTitle( "Server commands" )
  15.                         MyDerma:ShowCloseButton( false )
  16.                         MyDerma:MakePopup()
  17.  
  18.                 local MyLabel = vgui.Create( "DLabel", MyDerma )
  19.                         MyLabel:SetPos( 20, 35 )
  20.                         MyLabel:SetSize( 180, 20 )
  21.                         MyLabel:SetText( "• To kill" )
  22.  
  23.                 local MyButton = vgui.Create( "DButton", MyDerma )
  24.                         MyButton:SetText( "Click Here" )
  25.                         MyButton:SetPos( 20, 60 )
  26.                         MyButton.DoClick = function()
  27.                         RunConsoleCommand( "kill" )
  28.                         end
  29.                                 local MyLabel2 = vgui.Create( "DLabel", MyDerma )
  30.                                         MyLabel2:SetPos( 20, 80 )
  31.                                         MyLabel2:SetSize( 180, 20)
  32.                                         MyLabel2:SetText( "• To See Your Current Weapon" )
  33.                                 local MyButton2 = vgui.Create( "DButton", MyDerma )
  34.                                 MyButton2:SetText( "Click Here" )
  35.                                 MyButton2:SetPos( 20,100 )
  36.                                 MyButton2.DoClick = function()
  37.                                 local ply = LocalPlayer()
  38. chat.AddText( Color( 100, 100, 255 ), ply, ", you are holding ", Color( 100, 255, 100 ), ply:GetActiveWeapon():GetClass() )
  39.                                 end    
  40.                                
  41.                                         local MyLabel3 = vgui.Create( "DLabel" , MyDerma )
  42.                                         MyLabel3:SetPos( 20, 120 )
  43.                                         MyLabel3:SetSize( 180, 20 )
  44.                                         MyLabel3:SetText( "• To see your health and armor" )
  45.                                         local MyButton3 = vgui.Create( "DButton", MyDerma )
  46.                                         MyButton3:SetText( "Click Here" )
  47.                                         MyButton3:SetPos( 20, 140 )
  48.                                         MyButton3.DoClick = function()
  49.                                         local ply = LocalPlayer()
  50.                                         chat.AddText( Color( 100, 100, 255 ), ply, ", your health is at ", Color( 100, 255, 100 ), ply:Health() .. " and your armor is at ", Color(100, 255, 100), ply:Armor() )
  51.                                         end
  52.                                        
  53.                                                 local MyButton3 = vgui.Create( "DButton", MyDerma )
  54.                                                 MyButton3:SetPos( 125, 250 )
  55.                                                 MyButton3:SetText( "hi" )
  56.                                                 MyButton3.DoClick = function()
  57.                                                         net.Start( "Give" )
  58.                                                                 net.WriteEntity( LocalPlayer() )
  59.                                                         net.SendToServer()
  60.                                                 MyDerma:Close()
  61.                                                 end
  62.                                                
  63.                                                         local MyButton4 = vgui.Create( "DButton", MyDerma )
  64.                                                         MyButton4:SetPos( 125, 270 )
  65.                                                         MyButton4:SetText( "Close" )
  66.                                                         MyButton4.DoClick = function()
  67.                                                         local ply = LocalPlayer()
  68. chat.AddText( Color( 100, 100, 255 ), ply, ", you have closed the panel" )
  69.                                                         local ply = LocalPlayer()
  70.                                                         MyDerma:Close()
  71.                                                         end
  72.                                
  73.                         MyDerma.Paint = function()
  74.                                 draw.RoundedBox( 8, 0, 0, MyDerma:GetWide(), MyDerma:GetTall(), Color( 255, 50, 50, 255 ) )
  75.                         end
  76.         end
  77. concommand.Add( "opencommand", OpenMyDerma )
  78. end

There is no error its just not working!!!!

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: I need help with a derma
« Reply #31 on: November 24, 2014, 07:53:09 pm »
Is that a M9K weapon

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #32 on: November 25, 2014, 02:49:07 am »
No it's just a darkRP defily weapon but thanks for the code I'll test it out!!!

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #33 on: November 25, 2014, 12:30:07 pm »
im sorry i thought that was a new code lol i still need help with the give command!!!

Thanks

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #34 on: November 25, 2014, 05:53:38 pm »
Ok i think i'm almost done with the project i was working on!!!!! i will post final code but i need one more thing!

I know how to color the background of the derma but how do i color the buttons???

Thanks
~XxLMM13xX

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #35 on: November 27, 2014, 04:17:27 pm »
Sorry to keep posting here but how do I paint just the buttons??? Whats the function please post the code thanks!

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #36 on: November 30, 2014, 07:42:08 am »
Hey guys i did not want to start a new post but i need help with coloring the buttons!

i just need the functions thanks!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: I need help with a derma
« Reply #37 on: November 30, 2014, 08:13:35 pm »
Wow. Would it not be something simple like <button object name>.Paint?
That's what seems to work for your "MyDerma" object with the rounded box color.

Have you even tried that in the past 5 days you've been waiting on an answer and bumping?
I've NO experience with GUI, but, it seems that's a key command. .Paint

Also, I'd not recommend bumping threads here more than once in 5 days, let alone 3 times.
Ulysses forum is slow paced. A few visits a day by regulars. Even less during holidays.
Stuff like that can get you banned.
If someone knows the answer, someone will answer.
If no one knows the answer, no one will answer.

Stop being so impatient.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: I need help with a derma
« Reply #38 on: December 06, 2014, 03:29:48 pm »
I so sorry for the spam! I have learned my lesson and will not spam again, this is a awesome community! Im very new to lua so i did not know the function. Thanks anyway!


Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: I need help with a derma
« Reply #39 on: December 06, 2014, 04:04:23 pm »
Apparently no one knew the answer in the past 2-3 weeks.
I'd aim for .Paint, considering that's what seems to paint the actual background MyDerma object.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print