Jump to content

[HELP] Color


1LoL1

Recommended Posts

Hello i created script but not work :( how i can fix this i mean: when i use /color RED so setVehicleColor(255, 0, 0)

Amount = { 
"RED" = "255,0,0", 
"BLUE" = "1,1,1, 
"PINK" = "2,2,2, 
"BLACK" = "0,0,0", 
} 
  
function clr (player,command,color) 
local vehicle = getPedOccupiedVehicle(player) 
if color then 
setVehicleColor(vehicle, Amount[#color]) 
end 
end 
addCommandHandler("color", clr) 

Link to comment

Try using this:

Amount = { }; 
Amount.RED = { 255, 0, 0 }; 
Amount.BLUE = { 1, 1, 1 }; 
Amount.PINK = { 2, 2, 2 }; 
Amount.BLACK = { 0, 0, 0 }; 
  
function clr (player,command,color) 
    local vehicle = getPedOccupiedVehicle(player) 
    if color and vehicle then 
        if ( not Amount [ tostring ( color ):upper ( ) ] ) then  
            return false; 
        end  
         
        local r, g, b = unpack ( Amount [ tostring ( color ):upper() ] ); 
        setVehicleColor(vehicle, r, g, b ); 
    end 
end 
addCommandHandler("color", clr) 

Please make sure to check debugscript before posting. (/debugscript 3)

Link to comment
Try using this:
Amount = { }; 
Amount.RED = { 255, 0, 0 }; 
Amount.BLUE = { 1, 1, 1 }; 
Amount.PINK = { 2, 2, 2 }; 
Amount.BLACK = { 0, 0, 0 }; 
  
function clr (player,command,color) 
    local vehicle = getPedOccupiedVehicle(player) 
    if color and vehicle then 
        if ( not Amount [ tostring ( color ):upper ( ) ] ) then  
            return false; 
        end  
         
        local r, g, b = unpack ( Amount [ tostring ( color ):upper() ] ); 
        setVehicleColor(vehicle, r, g, b ); 
    end 
end 
addCommandHandler("color", clr) 

Please make sure to check debugscript before posting. (/debugscript 3)

Thanks works. But how i can 2 car colors? now it's only 1. :(

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