cuervox123 Posted May 8, 2016 Share Posted May 8, 2016 hola tengo un script de un shader en un colshape,el problema es que solo quiero q se active a cada usuario que entra,pero a la hora de un usuario salir de el colshape,este desactiva el shader de los demas que estan dentro,aqui el codigo. S: function presion(source) if getElementData (source, "eszaraki",true) then if getElementType ( source ) == "player" then if isElement (presiondez) then destroyElement ( presiondez ) end local x, y, z = getElementPosition(source) presiondez = createColSphere(x, y, z, 80) --attachElements ( presiondez, source, 0.1, 0, 0, 270, 0, 00 ) addEventHandler ( "onColShapeHit", presiondez, testr ) addEventHandler ( "onColShapeLeave", presiondez, sefuelmk ) end end end addCommandHandler ( "presionz", presion ) function testr ( p ) -- if getElementType ( source ) == "player" then setElementData(source, "estadentrodez", "on")--if the element that entered was player triggerClientEvent ("elshader", p) triggerClientEvent ("memarie", p) outputChatBox ( " Estas Cerca de Zaraki!", p, 255, 255, 109 ) end function sefuelmk(p) setElementData(p, "estadentrodez", "off") triggerClientEvent ("saliodez", p) triggerClientEvent ("nomemarie", p) end C: function estacerca() if not getElementData (thePlayer, "eszaraki",true) then if getElementData(localPlayer, "estadentrodez") == "on" then toonShader, toonTec = dxCreateShader("toonShader.fx") end end end addEvent("elshader", true) addEventHandler("elshader", root, estacerca) local resourceRoot = getResourceRootElement(getThisResource()) local screenWidth, screenHeight = guiGetScreenSize() local bitDepth = 16 -- between 1 and 64 local outlineStrength = 0.9 -- between 0 and 1 // higher amount will decrease outline strenght local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) function mareo() if getElementData(localPlayer, "estadentrodez") == "on" then setCameraShakeLevel( 255 ) end end addEvent("memarie", true) addEventHandler("memarie", root, mareo) function nomareo() if getElementData(localPlayer, "estadentrodez") == "off" then setCameraShakeLevel( 0 ) end end addEvent("nomemarie", true) addEventHandler("nomemarie", root, nomareo) function testa() if (toonShader) then dxUpdateScreenSource(myScreenSource) dxSetShaderValue(toonShader, "ScreenSource", myScreenSource) dxSetShaderValue(toonShader, "ScreenWidth", screenWidth) dxSetShaderValue(toonShader, "ScreenHeight", screenHeight) dxSetShaderValue(toonShader, "BitDepth", bitDepth) dxSetShaderValue(toonShader, "OutlineStrength", outlineStrength) dxDrawImage(0, 0, screenWidth, screenHeight, toonShader) end end addEventHandler("onClientPreRender", root, testa) function estalejos(thePlayer) if (toonShader) then destroyElement(toonShader) toonShader = nil setCameraShakeLevel( 0 ) end end addEvent("saliodez", true) addEventHandler("saliodez", root, estalejos) si hay un jugador dentro con el efecto del shader,si entra otro jugador se le pone el efecto,pero si alguno de los 2 sale entonces el efecto se le cancela también al otro. Link to comment
Tomas Posted May 8, 2016 Share Posted May 8, 2016 triggerClientEvent (p, "saliodez", p) triggerClientEvent (p, "nomemarie", p) Link to comment
Recommended Posts