Jump to content

help with this function


Sparrow

Recommended Posts

I do create vehicle, set vehicle color and respaw, it in 5sec when it blowed up, but the probleme is I can't set vehicle color, this is script, where is the probleme:

-- Set vehicle color. 
function setVehiclesColor (thePlayer, cmd, color1) 
    if (hasObjectPermissionTo (thePlayer , "function.banPlayer", true)) then 
    if (thePlayer) then 
        playerVeh = getPedOccupiedVehicle (thePlayer) 
            if (playerVeh and color1) then 
                setVehicleColor (playerVeh, color1) 
            else 
                outputConsole ( "You must be in a vehicle to use this function.", thePlayer, 255, 0, 0) 
            end 
        end 
    end 
end 
addCommandHandler ( "setvehcolor", setVehiclesColor ) 
addEventHandler("onVehicleExplode", getRootElement(), respawnVeh) 

the error:

WARNING: 1-cveh\cveh.lua:27: Bad argument @ 'setVehicleColor'
Link to comment
-- Set vehicle color. 
function setVehiclesColor (thePlayer, cmd, color1, color2, color3, color4) 
    if (hasObjectPermissionTo (thePlayer , "function.banPlayer", true)) then 
    if (color1 and color2 and color3 and color4) then 
        playerVeh = getPedOccupiedVehicle (thePlayer) 
            if (playerVeh) then 
                setVehicleColor (playerVeh, color1, color2, color3, color4) 
            else 
                outputConsole ( "You must be in a vehicle to use this function.", thePlayer, 255, 0, 0) 
            end 
        end 
    end 
end 
addCommandHandler ( "setvehcolor", setVehiclesColor ) 
addEventHandler("onVehicleExplode", getRootElement(), respawnVeh) 

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