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' Scripting in lua
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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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 Scripting in lua
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) Scripting in lua
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 Please do not PM me with scripting related question nor support, use the forums instead.
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 Scripting in lua
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? Scripting in lua
DNL291 Posted March 28, 2012 Posted March 28, 2012 make sure the server side in the meta.xml Please do not PM me with scripting related question nor support, use the forums instead.
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' Scripting in lua
drk Posted March 28, 2012 Posted March 28, 2012 Have you changed r,g,b,r,g,b to your color? EPT Team Server Development: 0% Learning C++ | C++ is amazing
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? Scripting in lua
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. EPT Team Server Development: 0% Learning C++ | C++ is amazing
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? Please do not PM me with scripting related question nor support, use the forums instead.
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 Scripting in lua
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 EPT Team Server Development: 0% Learning C++ | C++ is amazing
Absence2 Posted March 28, 2012 Posted March 28, 2012 replace the ')' on line 13 in draken's script with an 'end'
drk Posted March 28, 2012 Posted March 28, 2012 Oh, yeah Forgot that. EPT Team Server Development: 0% Learning C++ | C++ is amazing
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