Jump to content

Bence2004

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Bence2004

  1. - t ad vissza mindig megvan köszi! for i in string.gmatch("2020-20-22", "%d+") do table.insert(asd, i) end
  2. Segítség kéne. local datum = "2020-02-10" -- ez kéne így: local datum = {2020, 02, 10} -- output megoldás vagy függvénynév?
  3. https://community.multitheftauto.com/index.php?p=resources&s=details&id=18208 use external links DONE
  4. Show video: Download: https://community.multitheftauto.com/?p=resources&s=details&id=18204
  5. Unatkoztam, és elkezdtem magyarosítani és alakítgatni egy CSRW játékmódot. Hát ez lett belőle: https://www.youtube.com/watch?v=w42MxGoA0us
  6. Sorry, this is a bug, I fixed it! And this is dX. If you found bug, write comment on community or forum page. https://imgur.com/hvtik71
  7. GTA: V Designed Login screen Included with login screen. Download: https://community.multitheftauto.com/index.php?p=resources&s=details&id=18162
  8. Show video: Download: https://community.multitheftauto.com/index.php?p=resources&s=details&id=18203
  9. How I use dxCreateShader on weapon? What should be elementTypes? dxCreateShader ( string filepath / string raw_data [, float priority = 0, float maxDistance = 0, bool layered = false, string elementTypes = "world,vehicle,object,other" ] )
  10. Bence2004

    Skinsystem

    I want to create a skin system similar to csgo. Changes the texture of your player's weapon as you log in or touch it etc.Can somebody help me?
  11. local weaponsWithSkin = {} function applyWeaponSkin (itemid) local shaderName = premiumItems[itemid][3] local shaderID = itemid setElementData(localPlayer, "weaponShaderID", shaderID) setElementData(localPlayer, "weaponShaderName", shaderName) setWeaponStickerC(localPlayer, shaderName, shaderID) end addEvent("applySkin", true) addEventHandler("applySkin", root, applyWeaponSkin) addEventHandler("onClientResourceStart", resourceRoot, function() for k, v in ipairs(getElementsByType("player")) do local weaponShaderName = getElementData(v, "weaponShaderName") or 0 local weaponShaderID = getElementData(v, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then setWeaponStickerC(v, weaponShaderName, weaponShaderID) end end end) addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "player" then local weaponShaderName = getElementData(localPlayer, "weaponShaderName") or 0 local weaponShaderID = getElementData(localPlayer, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then setWeaponStickerC(source, isVehicleHavePaintjob) end end end) addEventHandler("onClientElementStreamOut", root, function() if getElementType(source) == "player" then local weaponShaderName = getElementData(localPlayer, "weaponShaderName") or 0 local weaponShaderID = getElementData(localPlayer, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then removeWeaponStickerC(source) end end end) addEventHandler("onClientElementDestroy", root, function() if getElementType(source) == "player" then local weaponShaderName = getElementData(localPlayer, "weaponShaderName") or 0 local weaponShaderID = getElementData(localPlayer, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then removeWeaponStickerC(source) end end end) function setWeaponStickerC(localPlayer, shaderName, shaderID) if shaderName and shaderID then weaponsWithSkin[localPlayer] = {} weaponsWithSkin[localPlayer][1] = dxCreateShader("shaders/texturechanger.fx", 0, 100, false, "ped") weaponsWithSkin[localPlayer][2] = dxCreateTexture("textures/" .. shaderID .. ".png") if (weaponsWithSkin[localPlayer][1] and weaponsWithSkin[localPlayer][2]) then dxSetShaderValue(weaponsWithSkin[localPlayer][1], "TEXTURE", weaponsWithSkin[localPlayer][2]) engineApplyShaderToWorldTexture(weaponsWithSkin[localPlayer][1], "*" .. shaderName .. "*", localPlayer) else outputDebugString("Fegyverskinek: Hiba történt!", 3) end end end addEvent("setWeaponStickerC",true) addEventHandler("setWeaponStickerC", root, setWeaponStickerC) function removeWeaponStickerC(localPlayer) if localPlayer then if (weaponsWithSkin[localPlayer]) then destroyElement(weaponsWithSkin[localPlayer][1]) destroyElement(weaponsWithSkin[localPlayer][2]) weaponsWithSkin[localPlayer] = nil end end end addEvent("removeWeaponStickerC",true) addEventHandler("removeWeaponStickerC", root, removeWeaponStickerC) Kérlek segítsetek! Teljes bezavarodtam már ebbe a pár sorba. Egy olyan skin rendszernek az alapját akarom megcsinálni, amit lehet egyidejüleg, egyszerre több fegyveren is használni 1 localplayernek. Ezzel a scriptel az a baj, hogyha több fegyverre állítok be skint akkor a szinkronizálást nem tudja végrehajtani csak 1 fegyveren.
  12. For example, I have 2 weapons at a time and I want to use different textures on both.
  13. local weaponsWithSkin = {} function applyWeaponSkin (itemid) local shaderName = premiumItems[itemid][3] local shaderID = itemid setElementData(localPlayer, "weaponShaderID", shaderID) setElementData(localPlayer, "weaponShaderName", shaderName) setWeaponStickerC(localPlayer, shaderName, shaderID) end addEvent("applySkin", true) addEventHandler("applySkin", root, applyWeaponSkin) addEventHandler("onClientResourceStart", resourceRoot, function() for k, v in ipairs(getElementsByType("player")) do local weaponShaderName = getElementData(v, "weaponShaderName") or 0 local weaponShaderID = getElementData(v, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then setWeaponStickerC(v, weaponShaderName, weaponShaderID) end end end) addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "player" then local weaponShaderName = getElementData(localPlayer, "weaponShaderName") or 0 local weaponShaderID = getElementData(localPlayer, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then setWeaponStickerC(source, isVehicleHavePaintjob) end end end) addEventHandler("onClientElementStreamOut", root, function() if getElementType(source) == "player" then local weaponShaderName = getElementData(localPlayer, "weaponShaderName") or 0 local weaponShaderID = getElementData(localPlayer, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then removeWeaponStickerC(source) end end end) addEventHandler("onClientElementDestroy", root, function() if getElementType(source) == "player" then local weaponShaderName = getElementData(localPlayer, "weaponShaderName") or 0 local weaponShaderID = getElementData(localPlayer, "weaponShaderID") or 0 if (weaponShaderName ~= 0 and weaponShaderID ~= 0) then removeWeaponStickerC(source) end end end) function setWeaponStickerC(localPlayer, shaderName, shaderID) if shaderName and shaderID then removeWeaponStickerC(localPlayer) weaponsWithSkin[localPlayer] = {} weaponsWithSkin[localPlayer][1] = dxCreateShader("shaders/texturechanger.fx", 0, 100, false, "ped") weaponsWithSkin[localPlayer][2] = dxCreateTexture("textures/" .. shaderID .. ".png") if (weaponsWithSkin[localPlayer][1] and weaponsWithSkin[localPlayer][2]) then dxSetShaderValue(weaponsWithSkin[localPlayer][1], "TEXTURE", weaponsWithSkin[localPlayer][2]) engineApplyShaderToWorldTexture(weaponsWithSkin[localPlayer][1], "*" .. shaderName .. "*", localPlayer) else outputDebugString("Fegyverskinek: Hiba történt!", 3) end end end addEvent("setWeaponStickerC",true) addEventHandler("setWeaponStickerC", root, setWeaponStickerC) function removeWeaponStickerC(localPlayer) if localPlayer then if (weaponsWithSkin[localPlayer]) then destroyElement(weaponsWithSkin[localPlayer][1]) destroyElement(weaponsWithSkin[localPlayer][2]) weaponsWithSkin[localPlayer] = nil end end end addEvent("removeWeaponStickerC",true) addEventHandler("removeWeaponStickerC", root, removeWeaponStickerC) I want more weapons to display that texture at x times. I can't do it alone because I'm a little confused.
  14. A "{3}" stringből hogyan hámozzam ki a 3-mas számot?
  15. Fine, thanks.Sorry I'm clumsy in HLSL
  16. Not working this, the applied texture is full black.
  17. I would like the weapon preview that uses fx_pre_object.fx to change the texture with texturechange.fx. So I want to knit these two together.
  18. fx_pre_object.fx + texturechanger.fx coordination with correct tlighting. fx_pre_object.fx // // 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; //--------------------------------------------------------------------- // 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); // 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 } } texturechanger.fx texture newTexture : TEXTURE; technique replaceTexture { pass P0 { Texture[0] = newTexture; } }
  19. Hogyan tudnám megvalósítani azt, hogy objekt előrenézet során (objectpreview használata során) megváltozzon az objektum texturája? (Át szeretném vinni a texturechanger.fx-t)
  20. Köszönöm a segítséget! Megoldottam, a fegyvert objectként jelenítettem meg.
×
×
  • Create New...