Jump to content

what is wrong with this


Recommended Posts

local thevehicle = getPedOccupiedVehicle ( getRootElement() ) 
  
local 
  
function ( thevehicle ) 
    setVehicleHeadLightColor ( thevehicle, 0, 255,0 ) 
    setVehicleColor( thevehicle, 0, 0, 255 ) 
end 
  
addEventHandler ( "onClientPlayerSpawn", getRootElement(), ) 

It says somthing about a "attempt" to call global.

Link to comment
local thevehicle = getPedOccupiedVehicle ( getRootElement() ) 
  
local 
  
function ( thevehicle ) 
    setVehicleHeadLightColor ( thevehicle, 0, 255,0 ) 
    setVehicleColor( thevehicle, 0, 0, 255 ) 
end 
  
addEventHandler ( "onClientPlayerSpawn", getRootElement(), ) 

It says somthing about a "attempt" to call global.

function (  ) 
    local thevehicle = getPedOccupiedVehicle ( localPlayer ) 
    setVehicleHeadLightColor ( thevehicle, 0, 255,0 ) 
    setVehicleColor( thevehicle, 0, 0, 255 ) 
end 
addEventHandler ( "onClientPlayerSpawn", getRootElement(), ) 

I'm not sure if the player will have a vehicle when he spawn .

Link to comment

As what i thought try with a timer :

function (  ) 
    setTimer( 
        function (  ) 
            local thevehicle = getPedOccupiedVehicle ( localPlayer ) 
            setVehicleHeadLightColor ( thevehicle, 0, 255,0 ) 
            setVehicleColor( thevehicle, 0, 0, 255 ) 
    end,3000,1 
    ) 
end 
addEventHandler ( "onClientPlayerSpawn", getRootElement(), ) 

Link to comment
thanks :DDD It works. ah and u know any event or "export" for when I take a vehicle in the RACE (a vehicle pickup),?
addEvent( "onPlayerPickUpRacePickup" ) 
addEventHandler( "onPlayerPickUpRacePickup", g_Root,  
    function( _, type, veh ) 

onPlayerPickUpRacePickup()

source = player

argument's = int/string pickupID, string pickupType ("nitro" "repair" "vehiclechange"), int vehicleModel

Link to comment

Instead of using a timer when the player spawns, just use the 'onClientVehicleEnter' event.

function ( ) 
    setVehicleHeadLightColor ( source, 0, 255,0 ) 
    setVehicleColor( source, 0, 0, 255 ) 
end 
addEventHandler ( "onClientVehicleEnter", getRootElement(), ) 

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