getColorFilter | Multi Theft Auto: Wiki Skip to content

getColorFilter

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function is used to get the values of color filtering.

Tip

Normally the game is adding these colors to a screen to simulate weather effects. Sometimes it can be important to disable these effects. You can get rid of the effects by calling setColorFilter with zero values.

Syntax

int,​ int,​ int,​ int,​ int,​ int,​ int,​ int getColorFilter ( bool isOriginal )
Required Arguments
  • isOriginal: A bool indicates if the return values of color filter are GTASA original or changed by setColorFilter . If this is set to false , the return values would be the color filter that is currently being used.

Returns

  • int: value1
  • int: value2
  • int: value3
  • int: value4
  • int: value5
  • int: value6
  • int: value7
  • int: value8

Returns 8 integers , of which the first 4 indicate the color (R,G,B,A) of color filter A, and the last 4 indicate the color (R,G,B,A) of color filter B.

Code Examples

shared

This example corrects color of dxDrawMaterialLine3D. But this method has some limit.

local testRT = dxCreateRenderTarget(32,32,true)
x,y,z = 0, 0, 4
size = 4
addEventHandler("onClientRender", root, function()
dxSetRenderTarget(testRT,true)
dxDrawRectangle(0,0,32,32,tocolor(255,255,255,255))
dxSetRenderTarget()
local aR,aG,aB,aA,bR,bG,bB,bA = getColorFilter(false) --Get current color filter
local cR,cG,cB = 127/255+(aR*aA+bR*bA)/65535*0.5, 127/255+(aG*aA+bG*bA)/65535*0.5, 127/255+(aB*aA+bB*bA)/65535*0.5 --Calculate the result color of color filter
dxDrawMaterialLine3D(x+size, y+size, z-0.95, x-size, y-size, z-0.95,false, testRT, size*2,tocolor(127, 127, 127, 255))
dxDrawMaterialLine3D(x+size+20, y+size, z-0.95, x-size+20, y-size, z-0.95,false, testRT, size*2,tocolor(127/cR, 127/cG, 127/cB, 255))
end)

See Also

World Functions