Garry's Mod Wiki

Panel:SetPlayer

Panel:SetPlayer( Player player, number size )

Description

Used by AvatarImage to load an avatar for given player.

Arguments

1 Player player
The player to use avatar of.
2 number size
The size of the avatar to use. Acceptable sizes are 32, 64, 184.

Example

Creates an AvatarImage with the LocalPlayer's avatar inside.

concommand.Add( "testavatar", function() local Panel = vgui.Create( "DFrame" ) Panel:SetPos( 200, 200 ) Panel:SetSize( 500, 500 ) Panel:SetTitle( "Avatar Test" ) Panel:MakePopup() local Avatar = vgui.Create( "AvatarImage", Panel ) Avatar:SetSize( 64, 64 ) Avatar:SetPos( 4, 30 ) Avatar:SetPlayer( LocalPlayer(), 64 ) -- After a second reset the avatar to no player timer.Simple( 1, function() Avatar:SetPlayer( NULL, 64 ) end ) end )

Page Links


Special Pages


Wikis

?

Render Time: 29ms

DB GetPage 5
Generate Html 3
SaveChanges (1) 12
Render Body 0
Render Sidebar 7