Reflex# Posted March 28, 2012 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'
Castillo Posted March 28, 2012 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 )
Reflex# Posted March 28, 2012 Author 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
myyusuf Posted March 28, 2012 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?
Reflex# Posted March 28, 2012 Author 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)
DNL291 Posted March 28, 2012 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
Reflex# Posted March 28, 2012 Author 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
myyusuf Posted March 28, 2012 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
Reflex# Posted March 28, 2012 Author 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?
Reflex# Posted March 28, 2012 Author 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'
Reflex# Posted March 28, 2012 Author Posted March 28, 2012 Have you changed r,g,b,r,g,b to your color? no..but if i have many teams?
drk Posted March 28, 2012 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.
DNL291 Posted March 28, 2012 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?
Reflex# Posted March 28, 2012 Author 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
drk Posted March 28, 2012 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
Absence2 Posted March 28, 2012 Posted March 28, 2012 replace the ')' on line 13 in draken's script with an 'end'
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