Jump to content

about setCarColor


myyusuf

Recommended Posts

function zaa()  
for index , player in ipairs ( getElementsByType ( "player" ) ) do 
if getPlayerTeam (player) then  
local r,b,g = getTeamColor ( getplayerteam ( player) )  
local araba = getPedOccupiedVehicle ( player ) 
if araba then 
setVehicleColor ( araba, r,g,b,r,g,b)  
addEventHandler("onMapStarting",getRootElement(),zaa)  

what is wrong with this code? can somebody help me please?

Link to comment
function zaa() 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onMapStarting",getRootElement(),zaa) 

Link to comment
function zaa() 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onMapStarting",getRootElement(),zaa) 

thanks but dont work at map starting. i know i have to use setTimer. but how can i make worked that without setTimer?

Link to comment
function zaa() 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onMapStarting",getRootElement(),zaa) 

thanks but dont work at map starting. i know i have to use setTimer. but how can i make worked that without setTimer?

Add this : addEvent("onMapStarting",true)

Type :

  
addEvent("onMapStarting",true) 
function zaa() 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onMapStarting",getRootElement(),zaa) 
  

Link to comment
function zaa() 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onMapStarting",getRootElement(),zaa) 

thanks but dont work at map starting. i know i have to use setTimer. but how can i make worked that without setTimer?

Add this : addEvent("onMapStarting",true)

Type :

  
addEvent("onMapStarting",true) 
function zaa() 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onMapStarting",getRootElement(),zaa) 
  

not worked and non errors on /debugscript 3 :?

Link to comment
  
function zaa(theVehicle) 
    if getPlayerTeam (source) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source) ) 
        if theVehicle then 
            setVehicleColor ( theVehicle, r,g,b,r,g,b) 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
  

Link to comment

No work why "onMapStarting" the player is not in vehicle.

"onPlayerVehicleEnter" is good but with (theVehicle, seat, jacked )

Type :

  
function zaa(theVehicle, seat, jacked ) 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
  

Link to comment
No work why "onMapStarting" the player is not in vehicle.

"onPlayerVehicleEnter" is good but with (theVehicle, seat, jacked )

Type :

  
function zaa(theVehicle, seat, jacked ) 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        if getPlayerTeam (player) then 
            local r, b, g = getTeamColor ( getPlayerTeam ( player) ) -- Lua is case sensetive. 
            local araba = getPedOccupiedVehicle ( player ) 
            if araba then 
                setVehicleColor ( araba, r,g,b,r,g,b) 
            end 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
  

You don't need for, and getPedOccupiedVehicle,seat, jacked, etc...

Use this, it's more simple:

function zaa(theVehicle) 
    if getPlayerTeam (source) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source) ) 
        if theVehicle then 
            setVehicleColor ( theVehicle, r,g,b,r,g,b) 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
  

Link to comment
  
function zaa(theVehicle) 
    if getPlayerTeam (source) then 
        local r, g, b = getTeamColor ( getPlayerTeam ( source) ) 
        if theVehicle then 
            setVehicleColor ( theVehicle, r,g,b,r,g,b) 
        end 
    end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),zaa) 
  

thanks :)

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