Difference between revisions of "Lua:AddHudIcon"

From Fortress Forever Wiki
Jump to navigationJump to search
(New page: {{Infobox manual/Header}} ==AddHudIcon== Adds an icon to a player's screen ===Usage=== <pre>AddHudIcon(player, material, icon_id, x, y, w, h, align)</pre> ===Output=== Returns: nothing ...)
 
m
Line 12: Line 12:
 
===Input===
 
===Input===
 
* player(CFFPlayer) A reference to the player receiving the icon
 
* player(CFFPlayer) A reference to the player receiving the icon
* material(string) the name of a vmt file to serve as the icon <ref name="material">the file name must end in .vtf; however it is actually looking up a vmt file. This .vmt must be located in located in FortressForever\materials\vgui\.</ref>
+
* material(string) the name of a vmt file to serve as the icon the file name must end in .vtf; however it is actually looking up a vmt file. This .vmt must be located in located in FortressForever\materials\vgui\.
 
* icon_id(string) a name for this icon (so we can remove it later)
 
* icon_id(string) a name for this icon (so we can remove it later)
 
* x(integer) horizontal position
 
* x(integer) horizontal position
Line 18: Line 18:
 
* w(integer) width of the icon
 
* w(integer) width of the icon
 
* h(integer) height of the icon
 
* h(integer) height of the icon
* align(integer) x alignment options <ref name="units">Verify: what units are used for icon size and position?</ref>
+
* align(integer) x alignment options Verify: what units are used for icon size and position?
 
** 0: align to left
 
** 0: align to left
 
** 1: align to right
 
** 1: align to right
Line 28: Line 28:
 
AddHudIcon(player, "minimap.vtf", "mapoverlay", 0, 40, 128, 128, 1 )</pre>
 
AddHudIcon(player, "minimap.vtf", "mapoverlay", 0, 40, 128, 128, 1 )</pre>
  
{{Reflist}}
 
 
[[Category:HUD_Items]]
 
[[Category:HUD_Items]]
 
{{Infobox manual/Footer}}
 
{{Infobox manual/Footer}}

Revision as of 22:32, 1 May 2010


AddHudIcon

Adds an icon to a player's screen

Usage

AddHudIcon(player, material, icon_id, x, y, w, h, align)

Output

Returns: nothing

Input

  • player(CFFPlayer) A reference to the player receiving the icon
  • material(string) the name of a vmt file to serve as the icon the file name must end in .vtf; however it is actually looking up a vmt file. This .vmt must be located in located in FortressForever\materials\vgui\.
  • icon_id(string) a name for this icon (so we can remove it later)
  • x(integer) horizontal position
  • y(integer) vertical position
  • w(integer) width of the icon
  • h(integer) height of the icon
  • align(integer) x alignment options Verify: what units are used for icon size and position?
    • 0: align to left
    • 1: align to right
    • 2: align to left of center
    • 3: align to right of center

Example

local player = CastToPlayer( player_entity )
AddHudIcon(player, "minimap.vtf", "mapoverlay", 0, 40, 128, 128, 1 )