Garry's Mod Wiki

WEAPON:PrintWeaponInfo

  WEAPON:PrintWeaponInfo( number x, number y, number alpha )

Description

A convenience function that draws the weapon info box, used in WEAPON:DrawWeaponSelection.

Arguments

1 number x
The x co-ordinate of box position
2 number y
The y co-ordinate of box position
3 number alpha
Alpha value for the box

Example

As defined in weapon_base

function SWEP:PrintWeaponInfo( x, y, alpha ) if ( self.DrawWeaponInfoBox == false ) then return end if (self.InfoMarkup == nil ) then local str local title_color = "<color=230,230,230,255>" local text_color = "<color=150,150,150,255>" str = "<font=HudSelectionText>" if ( self.Author != "" ) then str = str .. title_color .. "Author:</color>\t"..text_color..self.Author.."</color>\n" end if ( self.Contact != "" ) then str = str .. title_color .. "Contact:</color>\t"..text_color..self.Contact.."</color>\n\n" end if ( self.Purpose != "" ) then str = str .. title_color .. "Purpose:</color>\n"..text_color..self.Purpose.."</color>\n\n" end if ( self.Instructions != "" ) then str = str .. title_color .. "Instructions:</color>\n"..text_color..self.Instructions.."</color>\n" end str = str .. "</font>" self.InfoMarkup = markup.Parse( str, 250 ) end surface.SetDrawColor( 60, 60, 60, alpha ) surface.SetTexture( self.SpeechBubbleLid ) surface.DrawTexturedRect( x, y - 64 - 5, 128, 64 ) draw.RoundedBox( 8, x - 5, y - 6, 260, self.InfoMarkup:GetHeight() + 18, Color( 60, 60, 60, alpha ) ) self.InfoMarkup:Draw( x+5, y+5, nil, nil, alpha ) end