Jump to content

[HELP] Color of car on account name


Reflex#

Recommended Posts

Posted

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?

Scripting in lua

Posted
setAccountData 
getAccountData 
setVehicleColor 

onVehicleEnter

Sorry,but I'm a little bit dont understand how to use it.

I want to make a list.

For example :

Reflex -black

BlueBerry - green

DiablO - purple

and else.

Scripting in lua

Posted (edited)

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

Scripting in lua

Posted (edited)

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
Posted

And why do you need a client side script...?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

No offense, but that script doesn't make much sense.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
  
function VehicleAccolor (player) 
    local accName = getAccountName ( getPlayerAccount( player ) ) 
    if  ( accName == "Reflex" )then 
    setVehicleColor( source, 0, 0, 0 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), VehicleAccolor ) 
  

State: Inactive

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