Reflex# Posted March 28, 2012 Share Posted March 28, 2012 function setVehColor(playerSource) local teamOfPlayer = getPlayerTeam(playerSource) local r,g,b = getTeamColor(teamOfPlayer) local vehOfPlayer = getPedOccupiedVehicle(playerSource) if (vehOfPlayer) then setVehicleColor(vehOfPlayer, r,g,b,r,g,b,r,g,b,r,g,b) else setVehicleColor(vehOfPlayer, 1, 1, 1, 1) end end addEventHandler("onVehicleEnter", getRootElement(), setVehColor) I create this script..when map start,color of car is true..but when car change..color changing too. Help This is debugscript 3: WARNING: vehcolor/server.lua:3: Bad argument @ 'getTeamColor' WARNING: vehcolor/server.lua:6: Bad argument @ 'setVehicleColor' Link to comment
Castillo Posted March 28, 2012 Share Posted March 28, 2012 function setVehColor ( playerSource ) local teamOfPlayer = getPlayerTeam ( playerSource ) if ( teamOfPlayer ) then local r, g, b = getTeamColor ( teamOfPlayer ) setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) end end addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 2012 function setVehColor ( playerSource ) local teamOfPlayer = getPlayerTeam ( playerSource ) if ( teamOfPlayer ) then local r, g, b = getTeamColor ( teamOfPlayer ) setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) end end addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) dont work Link to comment
myyusuf Posted March 28, 2012 Share Posted March 28, 2012 function setVehColor ( playerSource ) local teamOfPlayer = getPlayerTeam ( playerSource ) if ( teamOfPlayer ) then local r, g, b = getTeamColor ( teamOfPlayer ) setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) end end addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) addEventHandler ( "onPlayerPickUpRacePickup", getRootElement ( ), setVehColor ) maybe? Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 2012 function setVehColor ( playerSource ) local teamOfPlayer = getPlayerTeam ( playerSource ) if ( teamOfPlayer ) then local r, g, b = getTeamColor ( teamOfPlayer ) setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) end end addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) addEventHandler ( "onPlayerPickUpRacePickup", getRootElement ( ), setVehColor ) maybe? WARNING: vehcolor/server.lua:2: Bad 'player' pointer @ 'getPlayerTeam'(1) Link to comment
DNL291 Posted March 28, 2012 Share Posted March 28, 2012 function setVehColor ( playerSource ) local teamOfPlayer = getPlayerTeam ( playerSource ) if ( teamOfPlayer ) then local r, g, b = getTeamColor ( teamOfPlayer ) setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) end end addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) dont work worked for me Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 2012 function setVehColor ( playerSource ) local teamOfPlayer = getPlayerTeam ( playerSource ) if ( teamOfPlayer ) then local r, g, b = getTeamColor ( teamOfPlayer ) setVehicleColor ( source, r, g, b, r, g, b, r, g, b, r, g, b ) end end addEventHandler ( "onVehicleEnter", getRootElement ( ), setVehColor ) dont work worked for me when car change,color too Link to comment
myyusuf Posted March 28, 2012 Share Posted March 28, 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) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),zaa) this must worked Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 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) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),zaa) this must worked You test it? Link to comment
DNL291 Posted March 28, 2012 Share Posted March 28, 2012 make sure the server side in the meta.xml Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 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) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),zaa) this must worked You test it? WARNING: vehcolor/server.lua:5: Bad argument @ 'setVehicleColor' Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 Have you changed r,g,b,r,g,b to your color? Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 2012 Have you changed r,g,b,r,g,b to your color? no..but if i have many teams? Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 What you want to do? addEvent ( 'onPlayerPickUpRacePickup', true ); function zaa ( vehicle ) if ( getPlayerTeam ( source ) ) then local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) setVehicleColor ( vehicle, r, g, b ); end ) addEventHandler ( 'onPlayerVehicleEnter', root, zaa ); addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ); Simple. Link to comment
DNL291 Posted March 28, 2012 Share Posted March 28, 2012 dont work worked for me when car change,color too when you enter a vehicle, the color is equal to your team. That's what you want? Link to comment
Reflex# Posted March 28, 2012 Author Share Posted March 28, 2012 What you want to do? addEvent ( 'onPlayerPickUpRacePickup', true ); function zaa ( vehicle ) if ( getPlayerTeam ( source ) ) then local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) setVehicleColor ( vehicle, r, g, b ); end ) addEventHandler ( 'onPlayerVehicleEnter', root, zaa ); addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ); Simple. When map start,color of car=color of team,all good,but when during the map,i pickup another car,color changed on another,so i want that when car change,color dont changed,remained like color of team Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 (edited) addEvent ( 'onPlayerPickUpRacePickup', true ); function zaa ( vehicle, id ) if ( getPlayerTeam ( source ) ) then if ( eventName == 'onPlayerPickUpRacePickup' and id == 'vehiclechange' or id == 'repair' or id == 'nitro' ) then local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) setVehicleColor ( vehicle, r, g, b ); else local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) setVehicleColor ( vehicle, r, g, b ) end end end addEventHandler ( 'onPlayerVehicleEnter', root, zaa ); addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ); Try. Edited March 28, 2012 by Guest Link to comment
Absence2 Posted March 28, 2012 Share Posted March 28, 2012 replace the ')' on line 13 in draken's script with an 'end' 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