Jump to content

Get player's skin problem


Recommended Posts

Hello guys, so today I made a new hud. My problem is that I need to get the player's skin in picture, so how can I say... The image should be match with the ID and draw it in a picture on the hud. But mine is not working. Can somebody help me please?

Here's a part of the code where this skin part is.

  
local screenX, screenY = guiGetScreenSize() 
local skinID = tonumber(getPlayerSkin(localPlayer)) 
     
    dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img/" .. skinID .. ".png") 

Link to comment

getPlayerSkin() - This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be an alternative (usually more generic) way of performing what it once did.

Also dxDrawImage() renders the image only for one frame so you must use it with onClientRender.

  
local screenX, screenY = guiGetScreenSize() 
local skinID = getElementModel(localPlayer) 
addEventHandler("onClientRender",root,function() 
    dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img/" .. skinID .. ".png") 
end) 
  

Link to comment
getPlayerSkin() - This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be an alternative (usually more generic) way of performing what it once did.

Also dxDrawImage() renders the image only for one frame so you must use it with onClientRender.

  
local screenX, screenY = guiGetScreenSize() 
local skinID = getElementModel(localPlayer) 
addEventHandler("onClientRender",root,function() 
    dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img/" .. skinID .. ".png") 
end) 
  

Not working and my fps jumped to 7 from 60 :o How can I do this with guiCreateStaticImage?

Link to comment
  
  
local screenX, screenY = guiGetScreenSize() 
local skinID = getElementModel(localPlayer) 
addEventHandler("onClientRender",root,function() 
    dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img\" .. skinID .. ".png") 
end) 
  
  
 

Lol..

A typo its \ not /...

Maybe i am wrong not sure.

Link to comment
  
  
local screenX, screenY = guiGetScreenSize() 
local skinID = getElementModel(localPlayer) 
addEventHandler("onClientRender",root,function() 
    dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img\" .. skinID .. ".png") 
end) 
  
  
  
 

Lol..

A typo its \ not /...

Maybe i am wrong not sure.

No, it's /.

Link to comment
local screenX, screenY = guiGetScreenSize ( ) 
local skinID = getElementModel ( localPlayer ) 
addEventHandler ( "onClientRender", root, 
    function ( ) 
        dxDrawImage ( screenX * 0.8505 , screenY * 0.0915, 104, 104, "img/" .. skinID .. ".png" ) 
    end 
) 

That works for sure, check if image is in meta.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...