Jump to content

Nitro Color


scripterr

Recommended Posts

Hello I want to make nitro to GREEN

Code

--------------------------------------------------------------------------------- 
-- 
-- Nitro shader 
-- 
-- 
--------------------------------------------------------------------------------- 
  
addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    nitroShader = dxCreateShader("nitro.fx") 
    setTimer(updateNitroColor,00,A0,00,160,0) 
end) 
  
-- This function will set the new color of the nitro 
function updateNitroColor(r,g,b) 
    if nitroShader then 
        if r and g and b then 
            engineApplyShaderToWorldTexture (nitroShader,"smoke") 
            dxSetShaderValue (nitroShader, "gNitroColor", r/255, g/0, b/0 ) 
        end 
    end 
end 
  
-- This function will reset the nitro back to the original 
function resetNitroColor() 
    if nitroShader then 
        engineRemoveShaderFromWorldTexture(nitroShader,"smoke") 
    end 
end 
  
  
  
-- Example command use 
addCommandHandler("nitro", 
function(command,r,g,b) 
    if r and g and b then 
        local r,g,b = tonumber(r),tonumber(g),tonumber(b) 
        if r <= 255 and g <= 255 and b <= 255 then 
            updateNitroColor(r,g,b) 
            outputChatBox("Nitro color updated!",255,255,255,true) 
        else 
            outputChatBox("Colors must be between 0 and 255",255,255,255,true) 
        end 
    else 
        resetNitroColor() 
        outputChatBox("Nitro color reset to original!",255,255,255,true) 
    end 
end) 
  

Link to comment
--------------------------------------------------------------------------------- 
-- 
-- Nitro shader 
-- 
-- 
--------------------------------------------------------------------------------- 
  
addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    nitroShader = dxCreateShader("nitro.fx") 
    setTimer(updateNitroColor,1000,1,0,255,0) 
end) 
  
-- This function will set the new color of the nitro 
function updateNitroColor(r,g,b) 
    if nitroShader then 
        if r and g and b then 
            engineApplyShaderToWorldTexture (nitroShader,"smoke") 
            dxSetShaderValue (nitroShader, "gNitroColor", r/255, g/0, b/0 ) 
        end 
    end 
end 
  
-- This function will reset the nitro back to the original 
function resetNitroColor() 
    if nitroShader then 
        engineRemoveShaderFromWorldTexture(nitroShader,"smoke") 
    end 
end 
  
-- Example command use 
addCommandHandler("nitro", 
function(command,r,g,b) 
    if r and g and b then 
        local r,g,b = tonumber(r),tonumber(g),tonumber(b) 
        if r <= 255 and g <= 255 and b <= 255 then 
            updateNitroColor(r,g,b) 
            outputChatBox("Nitro color updated!",255,255,255,true) 
        else 
            outputChatBox("Colors must be between 0 and 255",255,255,255,true) 
        end 
    else 
        resetNitroColor() 
        outputChatBox("Nitro color reset to original!",255,255,255,true) 
    end 
end) 

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