Jump to content

[HELP] Color of car on account name


Reflex#

Recommended Posts

Hey you guys.

I would like to ask..for example..I want to make a script..which can create own color for each account.

For example my account on server is : Reflex# and I want to have a black color of car.

for Race server. And each map I'll play with black color of car.

How to do it?

Link to comment

Example (Not Tested):

  
function Colorbyplayer() 
local PlayerNames = getPlayerName(getLocalPlayer()) 
     if isPedInVehicle( getLocalPlayer() ) then 
     if PlayerNames == "Reflex" then 
     local Vehicle = getPedOccupiedVehicle( getLocalPlayer() ) 
     if Vehicle then 
     setVehicleColor( Vehicle, 0, 0, 0 ) 
     end 
     end 
     end 
end 
addEventHandler( "onClientRender", rootElement, Colorbyplayer ) 
  

Edited by Guest
Link to comment
Example (Not Tested):
  
function Colorbyplayer() 
local PlayerNames = getPlayerName(getLocalPlayer()) 
     if isPedInVehicle( getLocalPlayer() ) then 
     if PlayerNames == "Reflex" then 
     local Vehicle = getPedOccupiedVehicle( uPlayer ) 
     if Vehicle then 
     setVehicleColor( Vehicle, 0, 0, 0 ) 
     end 
     end 
     end 
end 
addEventHandler( "onClientRender", rootElement, Colorbyplayer ) 
  

You used name..but not account...

Link to comment

Serverside ( In line 3, edit "Acount Name Here" ).

  
function VehicleAccolor () 
    local PlayerbyAccount = getAccountPlayer ( Acount Name Here ) 
    local Vehicle = getPedOccupiedVehicle( PlayerbyAccount ) 
    if ( getElementType ( PlayerbyAccount ) == "player" ) then 
    setVehicleColor( Vehicle, 0, 0, 0 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), VehicleAccolor ) 
  

Edited by Guest
Link to comment
  
function VehicleAccolor (player) 
    local accName = getAccountName ( getPlayerAccount( player ) ) 
    if  ( accName == "Reflex" )then 
    setVehicleColor( source, 0, 0, 0 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), VehicleAccolor ) 
  

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