HunT Posted August 7, 2013 Posted August 7, 2013 Hi guys. I'm working on new script and I need info about visibility shader. I have make this: With edit box the player enter the URL image. Get the URL - trigger server - fetchRemote - callback - trigger client - engineApplyShaderToWorldTexture Well, the script work fine, but this is visible on for the client. How I can make this visible to everyone? @Huntone_
bandi94 Posted August 7, 2013 Posted August 7, 2013 easy , when you trigger client, use "root" or "getRootElement" on "element sendTo" and "element theElement" . Send the data from fetchRemote to every client and from there every client genrate the texture->shader->apply it Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
HunT Posted August 7, 2013 Author Posted August 7, 2013 easy , when you trigger client, use "root" or "getRootElement" on "element sendTo" and "element theElement" .Send the data from fetchRemote to every client and from there every client genrate the texture->shader->apply it Tnx for now,test later. Edit: But I don't want replace the texture to everyone. I want replace the texture on player click but visible to everyone. You understand ? @Huntone_
csiguusz Posted August 7, 2013 Posted August 7, 2013 But I don't want replace the texture to everyone. I want replace the texture on player click but visible to everyone. You understand ? To make a texture visible for everyone it must be replaced at everyone. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
bandi94 Posted August 7, 2013 Posted August 7, 2013 Tnx for now,test later. Edit: But I don't want replace the texture to everyone. I want replace the texture on player click but visible to everyone. You understand ? in "engineApplyShaderToWorldTexture" is a value called "element targetElement" , so let's say it's about a car, when you trigger the client's with the downloaded texture you send over the car element to. And set it as "targetelement" , so the Shader will be applyed only on that car or object. Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
HunT Posted August 7, 2013 Author Posted August 7, 2013 Yes i know this,but i no need replace the texture to vehicle. My script is "replace u skin by url" Example : This is the link image - http://i.imgur.com/K1Slj.png if i press the button = if i press the button work fine for me,but other player lock me with the default skin. I post the code but this is realy "raw" version,why i want make first the version work fine. --Client --onClientGUIClick link = guiGetText (the edit box) triggerServerEvent("downloadFile", getLocalPlayer(), link) -- Server addEvent("downloadFile", true ) function fileDownload(link,playerToReceive) fetchRemote ( link ,myCallback, "", false, playerToReceive ) end addEventHandler( "downloadFile", getRootElement(), fileDownload ) function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( root, "onClientGotImage", resourceRoot, responseData ) end end -- client addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function(pixels) theShader = dxCreateShader("material/effect.fx", 0, 0, true, "ped" ) myTexture = dxCreateTexture( pixels ) if theShader and myTexture then dxSetShaderValue(theShader,"gTexture",myTexture) engineApplyShaderToWorldTexture(theShader,"army",localPlayer) end end ) @Huntone_
denny199 Posted August 7, 2013 Posted August 7, 2013 (edited) --Client --onClientGUIClick link = guiGetText (the edit box) triggerServerEvent("downloadFile", root, link, getLocalPlayer()) -- Server addEvent("downloadFile", true ) function fileDownload(link, sPlayer) fetchRemote ( link ,myCallback, "", false,sPlayer ) end addEventHandler( "downloadFile", getRootElement(), fileDownload ) function myCallback( responseData, errno, sPlayer ) if errno == 0 then triggerClientEvent( root, "onClientGotImage", resourceRoot, responseData, sPlayer ) end end -- client addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function(pixels, sPlayer) theShader = dxCreateShader("material/effect.fx", 0, 0, true, "ped" ) myTexture = dxCreateTexture( pixels ) if theShader and myTexture then dxSetShaderValue(theShader,"gTexture",myTexture) engineApplyShaderToWorldTexture(theShader,"army",sPlayer) end end ) I sended the player elemnt from the server to the client, so everyone will get the player element on the client side, because "localPlayer" isn't shared. Edited August 7, 2013 by Guest Sometimes I dream about cheese
TAPL Posted August 7, 2013 Posted August 7, 2013 --Client --onClientGUIClick link = guiGetText (the edit box) triggerServerEvent("downloadFile", getLocalPlayer(), link) -- Server addEvent("downloadFile", true ) function fileDownload(link) fetchRemote(link ,myCallback, "", false, source) end addEventHandler("downloadFile", root, fileDownload) function myCallback(responseData, errno, playerToReceive) if errno == 0 then triggerClientEvent(root, "onClientGotImage", playerToReceive, responseData) end end -- client addEvent("onClientGotImage", true) addEventHandler( "onClientGotImage", root, function(pixels) theShader = dxCreateShader("material/effect.fx", 0, 0, true, "ped") myTexture = dxCreateTexture(pixels) if theShader and myTexture then dxSetShaderValue(theShader, "gTexture", myTexture) engineApplyShaderToWorldTexture(theShader, "army", source) end end)
HunT Posted August 7, 2013 Author Posted August 7, 2013 --Client --onClientGUIClick link = guiGetText (the edit box) triggerServerEvent("downloadFile", root, link, getLocalPlayer()) -- Server addEvent("downloadFile", true ) function fileDownload(link, sPlayer) fetchRemote ( link ,myCallback, "", false,sPlayer ) end addEventHandler( "downloadFile", getRootElement(), fileDownload ) function myCallback( responseData, errno, sPlayer ) if errno == 0 then triggerClientEvent( root, "onClientGotImage", resourceRoot, responseData, sPlayer ) end end -- client addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function(pixels, sPlayer) theShader = dxCreateShader("material/effect.fx", 0, 0, true, "ped" ) myTexture = dxCreateTexture( pixels ) if theShader and myTexture then dxSetShaderValue(theShader,"gTexture",myTexture) engineApplyShaderToWorldTexture(theShader,"army",sPlayer) end end ) I sended the player elemnt from the server to the client, so everyone will get the player element on the client side, because "localPlayer" isn't shared. Realy Tnx now work fine @Huntone_
denny199 Posted August 7, 2013 Posted August 7, 2013 You're welcome, and goodluck with your project Sometimes I dream about cheese
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