Jump to content

Make a team, color car


Spyke25

Recommended Posts

He doesn't have one.

I want yellow car only when you join the team, other member have random car color..

Then, i join GYG team, i have yellow car, i am not in, i have random car color.

Where is that 'car'.

The car he enters?

A car defined somewhere?

Link to comment
addEventHandler ( "onVehicleStartEnter" , root , 
function ( player ) 
local team = getPlayerTeam ( player ) 
if not team then return end 
local r, g, b = getTeamColor ( team ) 
setVehicleColor ( source , r, g, b , r, g, b) 
end) 

Try that.

Link to comment

Then, like that?

local teamGyg = createTeam ( "~GYG~", 255, 255, 0 ) 
  
  
addEventHandler ( "onVehicleStartEnter" , root , 
function ( player ) 
local team = getPlayerTeam ( player ) 
if not team then return end 
local r, g, b = getTeamColor ( team ) 
setVehicleColor ( source , 255, 255, 0 , 255, 255, 0) 
end) 

If is like that, when i join the team my car color doesn't change.

I have replaced your r , g , b with 255 , 0 , 0 is that right? Thanks.

Link to comment
local teamGyg = createTeam ( "~GYG~", 255, 255, 0 ) 
  
  
function setColors() 
for index , player in ipairs ( getElementsByType ( "player" ) ) do 
if getPlayerTeam ( player ) then 
local r,g,b = getTeamColor ( getPlayerTeam ( player ) ) 
local veh = getPedOccupiedVehicle ( player ) 
if veh then 
setVehicleColor ( veh, r,g,b,r,g,b) 
end 
end 
end 
end 
  
setTimer( setColors, 500, 0 ) 

Link to comment
local teamGyg = createTeam ( "~GYG~", 255, 255, 0 ) 
  
function setColors() 
for index , player in ipairs ( getElementsByType ( "player" ) ) do 
if getPlayerTeam ( player ) then 
local r,g,b = getTeamColor ( getPlayerTeam ( player ) ) 
local veh = getPedOccupiedVehicle ( player ) 
if veh then 
setVehicleColor ( veh, r,g,b,r,g,b) 
setVehicleHeadLightColor ( veh , r,g,b ) 
end 
end 
end 
end 
  
setTimer( setColors, 500, 0 ) 

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