MTA Team 0xCiBeR Posted July 4, 2013 MTA Team Posted July 4, 2013 Descague un recurso de auras de la wiki... El problema es que : 1-) cuando acciono la aura con la tecla M, no se mantiene prendida.. 2-)los demas jugadores no ven mi aura... Aca los archivos -- -- c_ped_shell.lua -- local myShader local startTickCount = 0 addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion ().sortable < "1.3.1-9.04939" then outputChatBox( "Recurso incompatible" ) outputChatBox( "Actualiza MTA." ) return end -- Create shader myShader, tec = dxCreateShader ( "fx/ped_shell_layer.fx", 0, 0, true, "ped" ) if not myShader then outputChatBox( "Could not create shader. Please use debugscript 3" ) else -- Apply shader to local player engineApplyShaderToWorldTexture ( myShader, "*", localPlayer ) -- Hack to make GTA render the ped last, so our shell effect appears on top of the background setElementAlpha( localPlayer, 254 ) -- Fire effect at startup startEffect(); end end ) ---------------------------------------------------------------- -- Start effect here ---------------------------------------------------------------- function startEffect() startTickCount = getTickCount() end bindKey("m", "down", startEffect ) ---------------------------------------------------------------- -- Update effect here ---------------------------------------------------------------- addEventHandler( "onClientRender", root, function() if not myShader then return end local timeElapsed = getTickCount() - startTickCount local f = timeElapsed / 750 f = math.min( f, 1 ) local alpha = math.lerp ( 1.0, 0.0, f ) local size = math.lerp ( 0, 0.3, f ) -- Expand shell dxSetShaderValue( myShader, "sMorphSize", size, size, size ) -- Fade out shell dxSetShaderValue( myShader, "sMorphColor", 255, 0, 0, alpha ) end ) ---------------------------------------------------------------- -- Math helper functions ---------------------------------------------------------------- function math.lerp(from,to,alpha) return from + (to-from) * alpha end Y el shader: // // Example shader - ped_shell_layer.fx // //--------------------------------------------------------------------- // Ped shell settings //--------------------------------------------------------------------- float3 sMorphSize = float3(0,0,0); float4 sMorphColor = float4(1,1,1,1); //--------------------------------------------------------------------- // Include some common stuff //--------------------------------------------------------------------- #include "mta-helper.fx" //--------------------------------------------------------------------- // Structure of data sent to the vertex shader //--------------------------------------------------------------------- struct VSInput { float3 Position : POSITION0; float3 Normal : NORMAL0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; //--------------------------------------------------------------------- // Structure of data sent to the pixel shader ( from the vertex shader ) //--------------------------------------------------------------------- struct PSInput { float4 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; //------------------------------------------------------------------------------------------ // VertexShaderFunction // 1. Read from VS structure // 2. Process // 3. Write to PS structure //------------------------------------------------------------------------------------------ PSInput VertexShaderFunction(VSInput VS) { PSInput PS = (PSInput)0; // Do morph effect by adding surface normal to the vertex position VS.Position += VS.Normal * sMorphSize; // Calculate screen pos of vertex PS.Position = MTACalcScreenPosition ( VS.Position ); // Pass through tex coords PS.TexCoord = VS.TexCoord; // Set our custom morph color PS.Diffuse.rgb = sMorphColor.rgb * sMorphColor.a; PS.Diffuse.a = 1; return PS; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique tec0 { pass P0 { // As this shader is used as a separate layer, we just have to draw our effect // and not worry about the main rendering // SrcBlend and DestBlend can be set for various effects // This combination gives a translucent look SrcBlend = SrcColor; DestBlend = One; VertexShader = compile vs_2_0 VertexShaderFunction(); } } // Fallback technique fallback { pass P0 { // As this shader is used as a separate layer, don't draw anything SrcBlend = Zero; DestBlend = One; } } Gracias no entiendo muchode shaders DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Alexs Posted July 4, 2013 Posted July 4, 2013 Para lo segundo: engineApplyShaderToWorldTexture ( myShader, "*", localPlayer ) Tendrás que reemplazar eso por un 'for-loop' con todos los jugadores que tengan el aura activada. Developer @ MYVAL
MTA Team 0xCiBeR Posted July 4, 2013 Author MTA Team Posted July 4, 2013 Para lo segundo: engineApplyShaderToWorldTexture ( myShader, "*", localPlayer ) Tendrás que reemplazar eso por un 'for-loop' con todos los jugadores que tengan el aura activada. Pero como hago que los demas vean mi aura cuando la activo? DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Alexs Posted July 4, 2013 Posted July 4, 2013 Tendrás que darles un indicador desde el server-side que se consiga y compare en client side; por ejemplo un 'trigger' o 'elementData'. Developer @ MYVAL
MTA Team 0xCiBeR Posted July 4, 2013 Author MTA Team Posted July 4, 2013 lol no entendi nada me lo explicas mejor ? DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Alexs Posted July 4, 2013 Posted July 4, 2013 Tendrás que utilizar algún método que permita que el lado del 'client' "sepa" que jugadores tienen su aura activado y aplicar el shader en todos ellos. Developer @ MYVAL
MTA Team 0xCiBeR Posted July 4, 2013 Author MTA Team Posted July 4, 2013 Ahh ya entendiiii.. Con ese script solo me esta aplicando el shader a mi no?.. DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Alexs Posted July 4, 2013 Posted July 4, 2013 Ahh ya entendiiii.. Con ese script solo me esta aplicando el shader a mi no?.. Al jugador local, si. Developer @ MYVAL
Recommended Posts