myyusuf Posted March 18, 2012 Share Posted March 18, 2012 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
Castillo Posted March 18, 2012 Share Posted March 18, 2012 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
myyusuf Posted March 19, 2012 Author Share Posted March 19, 2012 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
HunT Posted March 19, 2012 Share Posted March 19, 2012 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
myyusuf Posted March 19, 2012 Author Share Posted March 19, 2012 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
Gr0x Posted March 19, 2012 Share Posted March 19, 2012 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
HunT Posted March 19, 2012 Share Posted March 19, 2012 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
Gr0x Posted March 19, 2012 Share Posted March 19, 2012 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
myyusuf Posted March 19, 2012 Author Share Posted March 19, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now