Jump to content

[Help]Script


zielonek

Recommended Posts

Hi, Could someone write me a script to change the color of car for account Mafi? On the server, all cars are red.

addEventHandler( "onPlayerLogin", root, function( _, acc ) 
  if getAccountName( acc ) == "Mef" then 
    local veh = getPedOccupiedVehicle( source ); 
    if veh then setVehicleColor( veh, 86, 86, 0, 0 ); end; 
  end; 
end ); 

How to combine it with that?

function randomVehColors() 
    for i, car in ipairs( getElementsByType( "vehicle" ) ) do 
        local color = {} 
        color[1] = math.random(5,5) 
        color[2] = math.random(5,5) 
        color[3] = math.random(5,5) 
        color[4] = math.random(5,5) 
        setVehicleColor ( car, color[1], color[2], color[3], color[4] ) 
    end 
end 
  
setTimer( randomVehColors, 500, 0 ) 

Im try two and this change all players car color :)

Help me Thanks.

Link to comment
  
addEventHandler("onPlayerLogin", getRootElement(), function( _, acc) 
if getAccountName( acc ) == "Mef" then 
local veh = getPedOccupiedVehicle( source ) 
if veh then 
local color = {} 
color[1] = math.random(0,5) 
color[2] = math.random(0,5) 
color[3] = math.random(0,5) 
color[4] = math.random(0,5) 
setVehicleColor ( car, color[1], color[2], color[3], color[4]) 
end 
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...