Jump to content

Problem with dxDraw


Recommended Posts

Hi guys, i need help with my script. The idea is to create a dxDrawimage depending of the skin of the player

 

local screenW, screenH = guiGetScreenSize()

function crear_image_team ()
local get_P_Model = getElementModel(getLocalPlayer())
     if get_P_Model == 287  then
	 militares = dxDrawImage(screenW-280, screenH-100, 20, 20, "Factions/Militares.png",0.0,0.0,0.0,tocolor(255,255,255,200))
	 outputChatBox("se te asigno un escudo militares", source, 255,255,255)
	 elseif get_P_Model == 29 or get_P_Model == 73 or get_P_Model == 79 then
	 bandidos = dxDrawImage(screenW-280, screenH-100, 20, 20,"Factions/Bandidos.png",0.0,0.0,0.0,tocolor(255,255,255,200))
	 outputChatBox("se te asigno un escudo bandidos", source, 255,255,255)
    end
end
addEventHandler("onClientRender",root,crear_image_team)
addEventHandler("onPlayerSpawn", resourceRoot,crear_image_team)

function changer ()
    addEventHandler("onClientRender", getRootElement(), crear_image_team)
end
addEventHandler( "onClientResourceStart", resourceRoot, changer ) 
addEventHandler( "onPlayerJoin", resourceRoot, changer ) 

It doesn't work... Any help¿?

Edited by NodZen_42
Link to comment
local screenW, screenH = guiGetScreenSize()

local img = { 
--- [ skin ] = "src image"
[287] = "Factions/Militares.png",
[29] = "Factions/Bandidos.png",
[73] = "Factions/Bandidos.png",
[79] = "Factions/Bandidos.png",
}

function crear_image_team ( )
local skin = getElementModel ( localPlayer ) 
if ( img [ skin ] ) then
dxDrawImage(screenW-280, screenH-100, 20, 20, img[skin] , 0,0,0,tocolor(255,255,255,200))
end
end
addEventHandler("onClientRender",root,crear_image_team)

try this

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...