if (SERVER) then
util.AddNetworkString( "Give" )
net.Receive( "Give", function( len, ply )
ply:give( "weapon_ak47custom" )
end )
end
if (CLIENT) then
local midW, midH = ScrW() / 2, ScrH() / 2
local function OpenMyDerma()
local MyDerma = vgui.Create( "DFrame" )
MyDerma:SetSize( 300, 300 )
MyDerma:SetPos( midW - ( MyDerma:GetWide() / 2 ), midH - ( MyDerma:GetTall() / 2) )
MyDerma:SetTitle( "Server commands" )
MyDerma:ShowCloseButton( false )
MyDerma:MakePopup()
local MyLabel = vgui.Create( "DLabel", MyDerma )
MyLabel:SetPos( 20, 35 )
MyLabel:SetSize( 180, 20 )
MyLabel:SetText( "• To kill" )
local MyButton = vgui.Create( "DButton", MyDerma )
MyButton:SetText( "Click Here" )
MyButton:SetPos( 20, 60 )
MyButton.DoClick = function()
RunConsoleCommand( "kill" )
end
local MyLabel2 = vgui.Create( "DLabel", MyDerma )
MyLabel2:SetPos( 20, 80 )
MyLabel2:SetSize( 180, 20)
MyLabel2:SetText( "• To See Your Current Weapon" )
local MyButton2 = vgui.Create( "DButton", MyDerma )
MyButton2:SetText( "Click Here" )
MyButton2:SetPos( 20,100 )
MyButton2.DoClick = function()
local ply = LocalPlayer()
chat.AddText( Color( 100, 100, 255 ), ply, ", you are holding ", Color( 100, 255, 100 ), ply:GetActiveWeapon():GetClass() )
end
local MyLabel3 = vgui.Create( "DLabel" , MyDerma )
MyLabel3:SetPos( 20, 120 )
MyLabel3:SetSize( 180, 20 )
MyLabel3:SetText( "• To see your health and armor" )
local MyButton3 = vgui.Create( "DButton", MyDerma )
MyButton3:SetText( "Click Here" )
MyButton3:SetPos( 20, 140 )
MyButton3.DoClick = function()
local ply = LocalPlayer()
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() )
end
local MyButton3 = vgui.Create( "DButton", MyDerma )
MyButton3:SetPos( 125, 250 )
MyButton3:SetText( "hi" )
MyButton3.DoClick = function()
net.Start( "Give" )
net.WriteEntity( LocalPlayer() )
net.SendToServer()
MyDerma:Close()
end
local MyButton4 = vgui.Create( "DButton", MyDerma )
MyButton4:SetPos( 125, 270 )
MyButton4:SetText( "Close" )
MyButton4.DoClick = function()
local ply = LocalPlayer()
chat.AddText( Color( 100, 100, 255 ), ply, ", you have closed the panel" )
local ply = LocalPlayer()
MyDerma:Close()
end
MyDerma.Paint = function()
draw.RoundedBox( 8, 0, 0, MyDerma:GetWide(), MyDerma:GetTall(), Color( 255, 50, 50, 255 ) )
end
end
concommand.Add( "opencommand", OpenMyDerma )
end