I'm having issues with showing the players AvatarImage with the following code
[CODE]
local Avatar = vgui.Create( "AvatarImage", frame1 )
Avatar:SetPlayer( LocalPlayer(), 64 )
Avatar:SetSize( 64,64 )
Avatar:SetPos( 10,14 )
Avatar:SetParent( frame1 )
[/CODE]
The image shown is a big blue question mark with a white background instead of the users avatar image. I'm going to assume that it's conflicting with the sandbox scoreboard showing the avatar image.
local Avatar = vgui.Create( "AvatarImage", frame1 )
If you have there frame1 then you don't need to set the parent.
It's not the problem though
[QUOTE=Lebofly;42289569]I'm having issues with showing the players AvatarImage with the following code
[CODE]
local Avatar = vgui.Create( "AvatarImage", frame1 )
Avatar:SetPlayer( LocalPlayer(), 64 )
Avatar:SetSize( 64,64 )
Avatar:SetPos( 10,14 )
Avatar:SetParent( frame1 )
[/CODE]
The image shown is a big blue question mark with a white background instead of the users avatar image. I'm going to assume that it's conflicting with the sandbox scoreboard showing the avatar image.[/QUOTE]
Are you doing this on a hud, or are you doing this inside of a custom scoreboard?
In advance, I can tell ya that the AvatarImage won't load if you're calling it too early(possibly before the player is authed, or anything of that nature.. my laptop is slow on these things xD). If you're using it on a hud try using a timer and calling the function directly in cl_init.lua
[code]function DrawAV()
local Avatar = vgui.Create( "AvatarImage", frame1 )
Avatar:SetPlayer( LocalPlayer(), 64 )
Avatar:SetSize( 64,64 )
Avatar:SetPos( 10,14 )
Avatar:SetParent( frame1 )
end
function ActivateAV()
timer.Simple(10, DrawAV) //timer set to wait for 10 seconds after this function is called to draw the avatarimage to the screen.
end
ActivateAV() //let this sucker activate and let the time tick!
[/code]
That code of course is only if your trying to draw it on a hud. If you think you're having sandbox feedback or something, just use a base gamemode and overwrite the main functions to draw the scoreboard.
(That would be these two):
GM:ScoreboardShow() //http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7673.html
GM:ScoreboardHide() //http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5abc.html
Hope this helped :)
[QUOTE=Lebofly;42290996]It's not the problem though[/QUOTE]
I know that wouldn't fix it but it was just a tip.
Cheers, I will give that a shot it was being loaded onto a custom panel that opens on button press
Edit: Worked great! Thank you both for the help
Sorry, you need to Log In to post a reply to this thread.