Jump to content

XaskeL

Members
  • Posts

    246
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by XaskeL

  1. texture texture0; float factor; sampler Sampler0 = sampler_state { Texture = (texture0); AddressU = MIRROR; AddressV = MIRROR; }; struct PSInput { float2 TexCoord : TEXCOORD0; }; float4 PixelShader_Background(PSInput PS) : COLOR0 { float4 sum = tex2D(Sampler0, PS.TexCoord); for (float i = 1; i < 3; i++) { sum += tex2D(Sampler0, float2(PS.TexCoord.x, PS.TexCoord.y + (i * factor))); sum += tex2D(Sampler0, float2(PS.TexCoord.x, PS.TexCoord.y - (i * factor))); sum += tex2D(Sampler0, float2(PS.TexCoord.x - (i * factor), PS.TexCoord.y)); sum += tex2D(Sampler0, float2(PS.TexCoord.x + (i * factor), PS.TexCoord.y)); } sum /= 9; sum.a = 1.0; float value = (sum.r + sum.g + sum.b) / 3; return float4(value, value, value, 1.0); } technique complercated { pass P0 { PixelShader = compile ps_2_0 PixelShader_Background(); } } Test it
  2. You must remove all references to the buffer variable and call "collectgarbage ()" after replacing the model, thereby freeing memory from unused data in the variables
  3. When the ID: 0 character model began to be used on DayZ servers, all people had such a problem. It was decided by the fact that you need to replace the bone number to which you need to attach the object you need, if I'm not mistaken, then the valid number will be 7
  4. I want put out it on github. If you add server events and some functions for exports, then we can give people a good enough bone_attach
  5. I caught trend and I'm working on optimize bone_attach. 1000 objects in stream:
  6. XaskeL

    [HELP] SHADER

    https://community.multitheftauto.com/?p=resources&s=details&id=16502
  7. https://en.wikipedia.org/wiki/Anisotropic_filtering
  8. Link for download working example (Click Here)
  9. -- example [1]: CGlitch:show(500); -- example [2]: CGlitch.show(CGlitch, 500); -- params: @self (table CGlitch), 500 (time in milliseconds or false for permanently drawing) show = function(self, fTime) -- create screen source & shader if not self.Shader then self.MyScreenSource = dxCreateScreenSource(CGlitch.ScreenSize[1], CGlitch.ScreenSize[2]); self.Shader = dxCreateShader(SHADER_CODE); -- set default parametres dxSetShaderValue(self.Shader, 'GlitchPower', self.GlitchPower); dxSetShaderValue(self.Shader, 'myScreenSource', self.MyScreenSource); end -- set work time if fTime then self.fTime = getTickCount() + fTime; else self.fTime = false; end -- create event handlers if (not self.AlreadyHandlered) then addEventHandler('onClientPreRender', root, CGlitch.update); addEventHandler('onClientHUDRender', root, CGlitch.draw); self.AlreadyHandlered = true; end end; I forgot to add check, replace code this function.
  10. I writted shader for you. Code for client.Lua: local SHADER_CODE = base64Decode("AQn//sQCAAAAAAAABQAAAAQAAAAcAAAAAAAAAAAAAAABAAAADwAAAG15U2NyZWVuU291cmNlAAADAAAAAAAAAFAAAABcAAAAAAAAAAEAAAABAAAAAAAAAAYAAABnVGltZQAAAAUAAABUSU1FAAAAAAMAAAACAAAAxAAAAOAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQAAAGdXb3JsZFZpZXdQcm9qZWN0aW9uAAAAABQAAABXT1JMRFZJRVdQUk9KRUNUSU9OAAoAAAAEAAAAKAIAAAAAAAAAAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAACAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAADAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAIAAAACAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAgAAAAIAAAACAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAACAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAYAAACkAAAAAAEAABABAAAMAQAApQAAAAABAAAoAQAAJAEAAKYAAAAAAQAASAEAAEQBAACqAAAAAAEAAGgBAABkAQAAqQAAAAABAACIAQAAhAEAAKsAAAAAAQAAqAEAAKQBAAAOAAAAU2NyZWVuU2FtcGxlcgAAAAMAAAAAAAAAXAIAAAAAAAAAAAAAAQAAAAEAAAAAAAAADAAAAEdsaXRjaFBvd2VyAAMAA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wEAA4ABAACADQDkoAIAAAMBAAGAAQAAgQ0AqqAFAAADAQABgAEAAIANAP+gWAAABAEAAYABAFWACQAAoAEAAIAFAAADAQACgAEAAIAAAFWQBgAAAgEAAYABAACAEwAAAgIAAYABAFWAAgAAAwEAAoABAFWAAgAAgQUAAAMBAASAAQAAgAEAVYBaAAAEAQABgAEA7oAHAOSgBwCqoAQAAAQBAAGAAQAAgAgAAKAIAFWgEwAAAgEAAYABAACABAAABAEAAYABAACACACqoAgA/6AlAAACAgACgAEAAIAFAAADAQABgAIAVYAHAP+gEwAAAgEAAYABAACABQAAAwEAAYABAACABAAAoAUAAAMBAAGAAQAAgAkA/6AFAAADAQABgAEAAIAGAACgAgAAAwEABoACAACgAADQkFoAAAQBAAKAAQDpgAcA5KAHAKqgBAAABAEAAoABAFWACAAAoAgAVaATAAACAQACgAEAVYAEAAAEAQACgAEAVYAIAKqgCAD/oCUAAAICAAKAAQBVgAUAAAMBAAKAAgBVgAcA/6ATAAACAQACgAEAVYAFAAADAQACgAEAVYABAACABAAABAEAAYABAFWACABVoAEAAIABAAACAAAUgAAAAJAEAAAEAAASgAEAAIAKAACgAACqgEIAAAMCAA+AAADugAAI5KBCAAADAwAPgAAA7YAACOSgBAAABAAAEYABAACACgD/oAAAVYAFAAADAwAPgAMA5IAKAGmgBAAABAIAD4ACAOSACgBpoAMA5IBCAAADAwAPgAAA7IAACOSgBAAABAAAFIABAACACwAAoAAAAIAEAAAEAgAPgAMA5IAQAOSgAgDkgEIAAAMDAA+AAADugAAI5KAEAAAEAAASgAEAAIALAFWgAACqgAQAAAQCAA+AAwDkgA4A5KACAOSAQgAAAwMAD4AAAO2AAAjkoAQAAAQAABGAAQAAgAgAVaAAAFWABAAABAIAD4ADAOSADwDkoAIA5IBCAAADAwAPgAAA7IAACOSgBAAABAAAFIABAACACwCqoAAAAIAEAAAEAgAPgAMA5IAKAGagAgDkgEIAAAMDAA+AAADugAAI5KAEAAAEAAASgAEAAIALAP+gAACqgAQAAAQCAA+AAwDkgA8AxqACAOSAQgAAAwMAD4AAAO2AAAjkoAQAAAQAABGAAQAAgAkAVaAAAFWABAAABAEAEYABAACACQCqoAAAAIBCAAADBAAPgAAA7IAACOSgAQAAAgEAAoAAAP+AQgAAAwAAD4ABAOSAAAjkoAQAAAQBAA+AAwDkgA4AxqACAOSABAAABAEAD4AEAOSAEADGoAEA5IAEAAAEAAAPgAAA5IAKAFqgAQDkgAUAAAMACA+AAADkgAwA5KD//wAAAAAAAAAAAAD/////AAAAAAAAAABwAQAAAAL+//7/NQBDVEFCHAAAAJ8AAAAAAv7/AQAAABwAAAAAAAAgmAAAADAAAAACAAAABAAAAEgAAABYAAAAZ1dvcmxkVmlld1Byb2plY3Rpb24Aq6urAwADAAQABAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB2c18yXzAATWljcm9zb2Z0IChSKSBITFNMIFNoYWRlciBDb21waWxlciA5LjI3Ljk1Mi4zMDIyAFEAAAUEAA+gAACAPwAAAAAAAAAAAAAAAB8AAAIAAACAAAAPkB8AAAIFAACAAQAPkAQAAAQAAA+AAAAkkAQAQKAEABWgCQAAAwAAAcAAAOSAAADkoAkAAAMAAALAAADkgAEA5KAJAAADAAAEwAAA5IACAOSgCQAAAwAACMAAAOSAAwDkoAEAAAIAAAPgAQDkkP//AAD/////AwAAAAAAAAAAAAAAAQAAAA8AAABteVNjcmVlblNvdXJjZQAA") -- export to mta and writted code by: XaskeL -- shader code from glsl by: Coolok CGlitch = { GlitchPower = 0.001; -- Glitch Power (0.0f to 1.0f); ScreenSize = { guiGetScreenSize() }; -- default screen size -- example[1]: CGlitch:destroy() -- example[2]: CGlitch.destroy() -- function for destroy glitch effects destroy = function(self) if CGlitch.AlreadyHandlered then removeEventHandler('onClientHUDRender', root, CGlitch.draw); removeEventHandler('onClientPreRender', root, CGlitch.update); CGlitch.AlreadyHandlered = false; end if self.Shader then destroyElement(self.Shader); self.Shader = false; end if self.MyScreenSource then destroyElement(self.MyScreenSource); self.MyScreenSource = false; end return true; end; -- function for update screen source update = function() if CGlitch.MyScreenSource then dxUpdateScreenSource(CGlitch.MyScreenSource); end end; -- function for draw glitch effect draw = function() if CGlitch.Shader then dxDrawImage(0, 0, CGlitch.ScreenSize[1], CGlitch.ScreenSize[2], CGlitch.Shader) end if (CGlitch.fTime and CGlitch.fTime < getTickCount()) then CGlitch:destroy(); end end; -- example [1]: CGlitch:show(500); -- example [2]: CGlitch.show(CGlitch, 500); -- params: @self (table CGlitch), 500 (time in milliseconds or false for permanently drawing) show = function(self, fTime) -- create screen source & shader self.MyScreenSource = dxCreateScreenSource(CGlitch.ScreenSize[1], CGlitch.ScreenSize[2]); self.Shader = dxCreateShader(SHADER_CODE); -- set default parametres dxSetShaderValue(self.Shader, 'GlitchPower', self.GlitchPower); dxSetShaderValue(self.Shader, 'myScreenSource', self.MyScreenSource); -- set work time if fTime then self.fTime = getTickCount() + fTime; else self.fTime = false; end -- create event handlers if (not self.AlreadyHandlered) then addEventHandler('onClientPreRender', root, CGlitch.update); addEventHandler('onClientHUDRender', root, CGlitch.draw); self.AlreadyHandlered = true; end end; }; --[[ example: CGlitch:show(500); -- show 500 ms --]] --[[ example: CGlitch:show(false); -- show permanently addCommandHandler('disableglitch', function() CGlitch:destroy(); end ) --]] Example for use: local MarkerPos = { x = 0.0; y = 0.0; z = 0.0; }; local theMarker = createMarker(MarkerPos.x, MarkerPos.y, MarkerPos.z, "cylinder", 1.5, 255, 255, 0, 170) addEventHandler('onClientMarkerHit', theMarker, function() CGlitch:show(500); end); Screenshot:
  11. set script type "shared" in xml. example: <meta> <script src="table.Lua" type="shared" cache="false"/> </meta>
  12. Hey. Do not try to hack my development. You spoil the life of people who want to have the privacy of their assets.
  13. Completely finished code, as well as an example of use inside. Also, a resource is ready to download protected files (loader). Link: https://www.dropbox.com/s/0cpkkuwjdqa6nvt/protection dff %26 txd files example.rar?dl=0
  14. It is worth testing. And the key is what you encrypt your file and decrypt, it is advisable to come up with it yourself. After that, you need to encrypt the models and in the client-side decrypt in RAW and load.
  15. Example: function string_padding_dword(s) local l = 4 - string.len(s) % 4 return s .. string.rep(string.char(l), l) end function string_unpadding_dword(s) return string.sub(s, 0, string.len(s) - string.byte(s, string.len(s))) end function FileProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536) fileSetPos(file, 65536) local SecondPart = fileRead(file, size - 65536) fileClose(file) file = fileCreate(path..'rw') fileWrite(file, encodeString('tea', string_padding_dword(FirstPart), { key = key })..SecondPart) fileClose(file) return true end function FileUnProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536 + 4) fileSetPos(file, 65536 + 4) local SecondPart = fileRead(file, size - (65536 + 4)) fileClose(file) -- file = fileCreate(path..'rw') -- fileWrite(file, string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart) -- fileClose(file) return string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart end -- example FileProtection('infernus.dff', 'GT4BAE') -- FileUnProtection(path, key) local txd = engineLoadTXD('infernus.txd') engineImportTXD(txd, 401) local dff = engineLoadDFF( FileUnProtection('infernus.dff', 'GT4BAE') ) engineReplaceModel(dff, 401)
  16. Не стал бы я доверять этому, никак, вообще.
  17. XaskeL

    [Help] HLSL

    local texel = dxCreateTexture('textures/m4blue.png', 'dxt1') dxSetShaderValue(shader, "TEXTURE", texture)
  18. XaskeL

    [Help] HLSL

    // // fx_pre_object.fx // //--------------------------------------------------------------------- // Variables //--------------------------------------------------------------------- float3 sElementOffset = float3(0,0,0); float3 sWorldOffset = float3(0,0,0); float3 sCameraPosition = float3(0,0,0); float3 sCameraForward = float3(0,0,0); float3 sCameraUp = float3(0,0,0); float sFov = 1; float sAspect = 1; float2 sMoveObject2D = float2(0,0); float2 sScaleObject2D = float2(1,1); float sAlphaMult = 1; float sProjZMult = 2; texture newTexture : TEXTURE; // CUSTOM TEXTURE sampler newTextureSampler = sampler_state { Texture = (newTexture); }; //--------------------------------------------------------------------- // Include some common stuff //--------------------------------------------------------------------- texture gTexture0 < string textureState="0,Texture"; >; matrix gProjectionMainScene : PROJECTION_MAIN_SCENE; float4x4 gWorld : WORLD; texture secondRT < string renderTarget = "yes"; >; int gLighting < string renderState="LIGHTING"; >; float4 gGlobalAmbient < string renderState="AMBIENT"; >; int gAmbientMaterialSource < string renderState="AMBIENTMATERIALSOURCE"; >; int gDiffuseMaterialSource < string renderState="DIFFUSEMATERIALSOURCE"; >; int gEmissiveMaterialSource < string renderState="EMISSIVEMATERIALSOURCE"; >; float4 gMaterialAmbient < string materialState="Ambient"; >; float4 gMaterialDiffuse < string materialState="Diffuse"; >; float4 gMaterialSpecular < string materialState="Specular"; >; float4 gMaterialEmissive < string materialState="Emissive"; >; int CUSTOMFLAGS <string createNormals = "yes"; string skipUnusedParameters = "yes"; >; float4 gTextureFactor < string renderState="TEXTUREFACTOR"; >; //--------------------------------------------------------------------- // Sampler for the main texture //--------------------------------------------------------------------- sampler Sampler0 = sampler_state { Texture = (gTexture0); }; //--------------------------------------------------------------------- // Structure of data sent to the vertex shader //--------------------------------------------------------------------- struct VSInput { float3 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord0 : TEXCOORD0; }; //--------------------------------------------------------------------- // Structure of data sent to the pixel shader ( from the vertex shader ) //--------------------------------------------------------------------- struct PSInput { float4 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord0 : TEXCOORD0; }; //-------------------------------------------------------------------------------------- // createViewMatrix //-------------------------------------------------------------------------------------- float4x4 createViewMatrix( float3 pos, float3 fwVec, float3 upVec ) { float3 zaxis = normalize( fwVec); // The "forward" vector. float3 xaxis = normalize( cross( -upVec, zaxis ));// The "right" vector. float3 yaxis = cross( xaxis, zaxis ); // The "up" vector. // Create a 4x4 view matrix from the right, up, forward and eye position vectors float4x4 viewMatrix = { float4( xaxis.x, yaxis.x, zaxis.x, 0 ), float4( xaxis.y, yaxis.y, zaxis.y, 0 ), float4( xaxis.z, yaxis.z, zaxis.z, 0 ), float4(-dot( xaxis, pos ), -dot( yaxis, pos ), -dot( zaxis, pos ), 1 ) }; return viewMatrix; } //------------------------------------------------------------------------------------------ // createProjectionMatrix //------------------------------------------------------------------------------------------ float4x4 createProjectionMatrix(float near_plane, float far_plane, float fov_horiz, float fov_aspect, float2 ss_mov, float2 ss_scale) { float h, w, Q; w = 1/tan(fov_horiz * 0.5); h = w/fov_aspect; Q = far_plane/(far_plane - near_plane); // Create a 4x4 projection matrix from given input float4x4 projectionMatrix = { float4(w * ss_scale.x, 0, 0, 0), float4(0, h * ss_scale.y, 0, 0), float4(ss_mov.x, ss_mov.y, Q, 1), float4(0, 0, -Q*near_plane, 0) }; return projectionMatrix; } //------------------------------------------------------------------------------------------ // MTACalcGTABuildingDiffuse //------------------------------------------------------------------------------------------ float4 MTACalcGTABuildingDiffuse( float4 InDiffuse ) { float4 OutDiffuse; if ( !gLighting ) { // If lighting render state is off, pass through the vertex color OutDiffuse = InDiffuse; } else { // If lighting render state is on, calculate diffuse color by doing what D3D usually does float4 ambient = gAmbientMaterialSource == 0 ? gMaterialAmbient : InDiffuse; float4 diffuse = gDiffuseMaterialSource == 0 ? gMaterialDiffuse : InDiffuse; float4 emissive = gEmissiveMaterialSource == 0 ? gMaterialEmissive : InDiffuse; OutDiffuse = gGlobalAmbient * saturate( ambient + emissive ); OutDiffuse.a *= diffuse.a; } return OutDiffuse; } //------------------------------------------------------------------------------------------ // VertexShaderFunction //------------------------------------------------------------------------------------------ PSInput VertexShaderFunction(VSInput VS) { PSInput PS = (PSInput)0; // Vertex in world position float4 wPos = mul(float4(VS.Position, 1), gWorld); wPos.xyz += sWorldOffset; // Create view matrix float4x4 sView = createViewMatrix(sCameraPosition, sCameraForward, sCameraUp); float4 vPos = mul(wPos, sView); vPos.xzy += sElementOffset; // Create projection matrix float sFarClip = gProjectionMainScene[3][2] / (1 - gProjectionMainScene[2][2]); float sNearClip = gProjectionMainScene[3][2] / - gProjectionMainScene[2][2]; float4x4 sProjection = createProjectionMatrix(sNearClip, sFarClip, sFov, sAspect, sMoveObject2D, sScaleObject2D); PS.Position = mul(vPos, sProjection); PS.Position.z *= 0.00625 * sProjZMult; // Pass through tex coord PS.TexCoord0 = VS.TexCoord0; // Calculate GTA lighting float Diffa = MTACalcGTABuildingDiffuse(VS.Diffuse).a; PS.Diffuse = float4(0.35, 0.35, 0.3, Diffa); return PS; } //--------------------------------------------------------------------- // Structure of color data sent to the renderer ( from the pixel shader ) //--------------------------------------------------------------------- struct Pixel { float4 Color : COLOR0; // Render target #0 float4 Extra : COLOR1; // Render target #1 }; //------------------------------------------------------------------------------------------ // PixelShaderFunction //------------------------------------------------------------------------------------------ Pixel PixelShaderFunction(PSInput PS) { Pixel output; // Get texture pixel // float4 texel = tex2D(Sampler0, PS.TexCoord0); // OBJECT TEXTURE float4 texel = tex2D(newTextureSampler, PS.TexCoord0); // CUSTOM TEXTURE // Main render target (just so the secondary one works) output.Color = float4(0, 0, 0, min(min(texel.a, 0.006105), sAlphaMult)); // Apply texture and multiply by vertex color float4 finalColor = texel * PS.Diffuse; // Secondary render target output.Extra = saturate(finalColor); output.Extra.a *= sAlphaMult; return output; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique fx_pre_object_MRT { pass P0 { FogEnable = false; AlphaBlendEnable = true; AlphaRef = 1; SeparateAlphaBlendEnable = true; SrcBlendAlpha = SrcAlpha; DestBlendAlpha = One; VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } // Fallback technique fallback { pass P0 { // Just draw normally } }
  19. You cannot replace the model. Only texture. Below these links you can find the identifiers for replacing the texture. And if this is not enough for you, you can use the shader to replace the texture. https://wiki.multitheftauto.com/wiki/Clothing_Component_IDs https://wiki.multitheftauto.com/wiki/CJ_Clothes
  20. XaskeL

    AC Detect 33

    33 SD. Disallow software of the category 'Net limiter' (ideal for lagswitching or causing structural lag, but may also be used for benign purposes). While working on notifications about non-standard GTA San Andreas. Noticed that I have AC Detect # 33. But I did not install any of the programs listed here (https://updatesa.multitheftauto.com/sa/trouble/?tr=netlimiter). GIGABYTE Aorus motherboard. Maybe there are some other programs that need to be removed or not?
×
×
  • Create New...