Revision Difference
WEAPON:PrintWeaponInfo#517955
<function name="PrintWeaponInfo" parent="WEAPON" type="hook">
<ishook>yes</ishook>
<description>A convenience function that draws the weapon info box, used in <page>WEAPON:DrawWeaponSelection</page>.</description>
<realm>Client</realm>
<args>
<arg name="x" type="number">The x co-ordinate of box position</arg>
<arg name="y" type="number">The y co-ordinate of box position</arg>
<arg name="alpha" type="number">Alpha value for the box</arg>
</args>
</function>
<example>
<description>As defined in weapon_base</description>
<code>
function SWEP:PrintWeaponInfo( x, y, alpha )
if ( self.DrawWeaponInfoBox == false ) then return end
if (self.InfoMarkup == nil ) then
local str
local title_color = "&lt;color=230,230,230,255&gt;"
local text_color = "&lt;color=150,150,150,255&gt;"
local title_color = "<color=230,230,230,255>"
local text_color = "<color=150,150,150,255>"
str = "&lt;font=HudSelectionText&gt;"
if ( self.Author != "" ) then str = str .. title_color .. "Author:&lt;/color&gt;\t"..text_color..self.Author.."&lt;/color&gt;\n" end
if ( self.Contact != "" ) then str = str .. title_color .. "Contact:&lt;/color&gt;\t"..text_color..self.Contact.."&lt;/color&gt;\n\n" end
if ( self.Purpose != "" ) then str = str .. title_color .. "Purpose:&lt;/color&gt;\n"..text_color..self.Purpose.."&lt;/color&gt;\n\n" end
if ( self.Instructions != "" ) then str = str .. title_color .. "Instructions:&lt;/color&gt;\n"..text_color..self.Instructions.."&lt;/color&gt;\n" end
str = str .. "&lt;/font&gt;"
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
</code>
</example>