Jump to content

[SOLVED]Change image color in script.


off

Recommended Posts

local r,g,b = 255,255,255 -- Default is white 
function renderImage() 
  dxDrawImage(100,100,200,200,"image.png",0,0,0,tocolor(r,g,b,255)) -- Draw your image 
end 
addEventHandler("onClientRender",getRootElement(),renderImage) -- Render it cause dx functions are drawn for 1 frame. 
  
function setColours(command,c1,c2,c3) 
  c1 = tonumber(c1) -- We have strings by default, so try to make them numbers 
  c2 = tonumber(c2) 
  c3 = tonumber(c3) 
  if not c1 or not c2 or not c3 then return end -- If some value can't be a number, then don't apply the changes 
  r,g,b = c1,c2,c3 
end 
addCommandHandler("color",setColours) 

/color 255 0 0

and it sets the image to be red. The code is untested though.

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