Gamemode.HUDWeaponPickedUp

From GMod Wiki

Revision as of 21:11, 15 September 2009 by UnrealomegaBot (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameHUDWeaponPickedUp
SyntaxGM:HUDWeaponPickedUp( Weapon )
DescriptionCalled when the game wants you to draw on the HUD that a weapon has been picked up.
ReturnsNil
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.HUDWeaponPickedUp]Gamemode.HUDWeaponPickedUp [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionThe base code.
Used onNewerClient.png
Code
function GM:HUDWeaponPickedUp( wep )
 
	if (!LocalPlayer():Alive()) then return end
 
	local pickup = {}
	pickup.time 		= CurTime()
	pickup.name 		= wep:GetPrintName()
	pickup.holdtime 	= 5
	pickup.font 		= "DefaultBold"
	pickup.fadein		= 0.04
	pickup.fadeout		= 0.3
	pickup.color		= Color( 255, 200, 50, 255 )
 
	surface.SetFont( pickup.font )
	local w, h = surface.GetTextSize( pickup.name )
	pickup.height		= h
	pickup.width		= w
 
	if (self.PickupHistoryLast >= pickup.time) then
		pickup.time = self.PickupHistoryLast + 0.05
	end
 
	table.insert( self.PickupHistory, pickup )
	self.PickupHistoryLast = pickup.time 
 
end
OutputN/A

Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox