Negriukas Posted February 6, 2015 Share Posted February 6, 2015 Hi, Whats wrong with this? I'm trying to apply a paintjob to hydra and if player was in like example 'Blue team' it should apply a paintjob to hydra with the specified texture 'hydrabody256-blue.png' and if i was in another team lets say 'Red team' it should apply a paintjob to hydra with this texture 'hydrabody256-red.png' , It works but it apply the paint job for all hydras except the default hydras, Hope you understand. Client: myShader = dxCreateShader( "hello.fx" ) red = dxCreateTexture("hydrabody256-red.png") blue = dxCreateTexture("hydrabody256-blue.png") addEvent("applyHydraTexture", true) addEventHandler("applyHydraTexture", root, function(vehicle, tex) local thePlayer = source local theVehicle = vehicle if thePlayer and theVehicle then if tex == 'Red' then engineApplyShaderToWorldTexture( myShader, "hydrabody256",getPedOccupiedVehicle(thePlayer) ) dxSetShaderValue(myShader, "gTexture", red) elseif tex == 'Blue' then engineApplyShaderToWorldTexture( myShader, "hydrabody256",getPedOccupiedVehicle(thePlayer) ) dxSetShaderValue(myShader, "gTexture", blue) end end end ) Server: if vehicleID == 520 and getPlayerTeam(source) then if getTeamName(getPlayerTeam(source)) == 'Red team' then texture = 'Red' elseif getTeamName(getPlayerTeam(source)) == 'Blue team' then texture = 'Blue' end return triggerClientEvent(source, 'applyHydraTexture', source, vehicle, texture) end Link to comment
Anubhav Posted February 7, 2015 Share Posted February 7, 2015 Server if vehicleID == 520 and getPlayerTeam(source) then if getTeamName(getPlayerTeam(source)) == 'Red team' then texture = 'Red' elseif getTeamName(getPlayerTeam(source)) == 'Blue team' then texture = 'Blue' else texture = "None" end return triggerClientEvent(source, 'applyHydraTexture', source, vehicle, texture) end Client myShader = dxCreateShader( "hello.fx" ) red = dxCreateTexture("hydrabody256-red.png") blue = dxCreateTexture("hydrabody256-blue.png") addEvent("applyHydraTexture", true) addEventHandler("applyHydraTexture", root, function(vehicle, tex) local thePlayer = source local theVehicle = vehicle if thePlayer and theVehicle then if tex == 'Red' then engineApplyShaderToWorldTexture( myShader, "hydrabody256",getPedOccupiedVehicle(thePlayer) ) dxSetShaderValue(myShader, "gTexture", red) elseif tex == 'Blue' then engineApplyShaderToWorldTexture( myShader, "hydrabody256",getPedOccupiedVehicle(thePlayer) ) dxSetShaderValue(myShader, "gTexture", blue) else return end end end ) Link to comment
DNL291 Posted February 7, 2015 Share Posted February 7, 2015 Are you sure the argument 'vehicle' is a vehicle element? if vehicleID == 520 and getPlayerTeam(source) then if getTeamName(getPlayerTeam(source)) == 'Red team' then texture = 'Red' elseif getTeamName(getPlayerTeam(source)) == 'Blue team' then texture = 'Blue' end return triggerClientEvent(source, 'applyHydraTexture', source, getPedOccupiedVehicle(source), texture) end Link to comment
Negriukas Posted February 7, 2015 Author Share Posted February 7, 2015 Server if vehicleID == 520 and getPlayerTeam(source) then if getTeamName(getPlayerTeam(source)) == 'Red team' then texture = 'Red' elseif getTeamName(getPlayerTeam(source)) == 'Blue team' then texture = 'Blue' else texture = "None" end return triggerClientEvent(source, 'applyHydraTexture', source, vehicle, texture) end Client myShader = dxCreateShader( "hello.fx" ) red = dxCreateTexture("hydrabody256-red.png") blue = dxCreateTexture("hydrabody256-blue.png") addEvent("applyHydraTexture", true) addEventHandler("applyHydraTexture", root, function(vehicle, tex) local thePlayer = source local theVehicle = vehicle if thePlayer and theVehicle then if tex == 'Red' then engineApplyShaderToWorldTexture( myShader, "hydrabody256",getPedOccupiedVehicle(thePlayer) ) dxSetShaderValue(myShader, "gTexture", red) elseif tex == 'Blue' then engineApplyShaderToWorldTexture( myShader, "hydrabody256",getPedOccupiedVehicle(thePlayer) ) dxSetShaderValue(myShader, "gTexture", blue) else return end end end ) Doesnt make any difference.. @DNL Yes it is a vehicle element, created by creatVehicle Link to comment
Negriukas Posted February 7, 2015 Author Share Posted February 7, 2015 The problem right now is that it keep applying the shaders for old textures too, i mean that if i was in red team and spawned a hydra it apply the red paintjob and if i left the red team and spawned hydra, it doesnt apply the paintjob(normal) but when i join blue team and spawn hydra, it apply the paintjob for the current hydra and the first spawned hydra that was supposed to stay red, 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