ozulus Posted May 29, 2015 Posted May 29, 2015 I am using this code, when the scripts started, i can see texture but other players can not see. Please help me what should i do?? Note: I have shader.fx local vehicle = getOccupiedVehicle() local Shader = dxCreateShader( "shader.fx" ) local Texture = dxCreateTexture( "mavericktexture.png" ) dxSetShaderValue( Shader, "Tex", Texture ) engineApplyShaderToWorldTexture( Shader, "Bell_206B_T", vehicle )
WhoAmI Posted May 29, 2015 Posted May 29, 2015 c-side addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) triggerServerEvent ( "loadForAll", localPlayer ); end ); addEvent ( "load", true ) addEventHandler ( "load", root, function ( ) local vehicle = getOccupiedVehicle ( source ) local Shader = dxCreateShader( "shader.fx" ) local Texture = dxCreateTexture( "mavericktexture.png" ) dxSetShaderValue( Shader, "Tex", Texture ) engineApplyShaderToWorldTexture( Shader, "Bell_206B_T", vehicle ) end ); s-side addEvent ( "loadForAll", true ) addEventHandler ( "loadForAll", root, function ( ) triggerClientEvent ( "load", source ); end );
3B00DG4MER Posted May 30, 2015 Posted May 30, 2015 Ow, i had that problem before so i've to trigger to Server then trigger Again to client I'll do it in my script
ALw7sH Posted May 30, 2015 Posted May 30, 2015 And you can set an element data to the vehicle and when it stream in apply the shader to it Ithink this is better than triggers
ozulus Posted May 30, 2015 Author Posted May 30, 2015 This code works well, thanks. Also, how can i do only one player? For example i am vip player and i have shader. Other players haven't shader.
Perfect Posted June 1, 2015 Posted June 1, 2015 If 'VIP' is a team name then this should work:- addEventHandler ( "onClientResourceStart", resourceRoot, function () local vehicle = getOccupiedVehicle ( localPlayer ) local Shader = dxCreateShader( "shader.fx" ) local Texture = dxCreateTexture( "mavericktexture.png" ) if (getPlayerTeam(localPlayer) == getTeamFromName("VIP")) then dxSetShaderValue( Shader, "Tex", Texture ) engineApplyShaderToWorldTexture( Shader, "Bell_206B_T", vehicle ) end 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