Hallo ich wollte Fragen,wie ich mein selbstgemachtes Derma auf die Taste F1 binden kann.
Client:
Code:
function Panal ()
local DermaPanel = vgui.Create( "DFrame" ) -- Creates the frame itself
DermaPanel:SetPos( 50,50 ) -- Position on the players screen
DermaPanel:SetSize( 500, 500 ) -- Size of the frame
DermaPanel:SetTitle( "Testing Derma Stuff" ) -- Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) -- Draggable by mouse?
DermaPanel:ShowCloseButton( true ) -- Show the close button?
DermaPanel:MakePopup() -- Show the frame
local DermaButton = vgui.Create( "DButton", DermaPanel )
DermaButton:SetText( "Crossbow" )
DermaButton:SetPos( 25, 25 )
DermaButton:SetSize( 150, 50 )
DermaButton.DoClick = function()
RunConsoleCommand( "givemecrossbow" ) -- What happens when you left click the button
end
end
concommand.Add( "Testpanal", Panal );
Server:
Code:
AddCSLuaFile( "cl_init.lua" )
/*---------------------------------------------------------
Name: gamemode:PlayerSpawn( )
Desc: Aufgerufen wenn Spieler spawnt
---------------------------------------------------------*/
function GM:PlayerSpawn( pl )
pl:RemoveAllAmmo()
self.BaseClass.PlayerSpawn( self, pl )
GAMEMODE:SetPlayerSpeed( pl, 200, 100 )
end
function givecrossbow( pl, cmd, args )
pl:Give( "weapon_crossbow" )
end
concommand.Add( "givemecrossbow", givecrossbow )