Search the Community
Showing results for tags 'skin shader'.
-
Greetings, my question is to apply a skin shader in my script. My problem is that another player does not see the shader when he has just entered the game, and when I reconnect, the shader disappears, so I have to apply the shader again every time, how can I save it? shaders = {} names = {} textures = {} applied = {} groups = { { name = "FBI", texture= "lf.png", shader= "test.fx", num = 1, worldname = "swat" }, { name = "FBI", texture= "sf.png", shader= "test.fx", num = 2, worldname = "swat" }, { name = "FBI", texture= "sf2.png", shader= "test.fx", num = 3, worldname = "swat" }, { name = "FBI", texture= "287.png", shader= "test.fx", num = 3, worldname = "army" }, { name = "FBI", texture= "dym.png", shader= "test.fx", num = 5, worldname = "swmotr5" }, { name = "FBI", texture= "fbi1.PNG", shader= "test.fx", num = 4, worldname = "swat" }, { name = "FBI", texture= "fbi2.PNG", shader= "test.fx", num = 5, worldname = "swat" }, { name = "FBI", texture= "fbi3.PNG", shader= "test.fx", num = 6, worldname = "swat" }, { name = "FBI", texture= "lf.png", shader= "test.fx", num = 7, worldname = "swat" }, { name = "FBI", texture= "dsa287.png", shader= "test.fx", num = 9, worldname = "army" }, { name = "FBI", texture= "acura.png", shader= "test.fx", num = 11, worldname = "wmycd1" }, { name = "FBI", texture= "marvel.png", shader= "test.fx", num = 2, worldname = "wmycd1" }, { name = "FBI", texture= "srblack.png", shader= "test.fx", num = 3, worldname = "wmycd1" }, { name = "FBI", texture= "test2.png", shader= "test.fx", num = 33, worldname = "cop2_cit" }, { name = "FBI", texture= "160.png", shader= "test.fx", num = 35, worldname = "cwmohb2" }, { name = "FBI", texture= "260.png", shader= "test.fx", num = 63, worldname = "swmotr5" }, } addEventHandler( "onClientResourceStart", resourceRoot, function() for i,val in ipairs(groups) do perfectname = val.name..""..val.num textures[perfectname] = dxCreateTexture ( val.texture ) shaders[perfectname] = dxCreateShader( val.shader,999999, 0, false, "ped" ) names[perfectname] = val.worldname dxSetShaderValue ( shaders[perfectname], "Tex0", textures[perfectname] ) -- engineApplyShaderToWorldTexture ( shaders[perfectname], val.worldname ) --bit of sanity checking if not shaders[perfectname] then exports.DRKdx:new( "Could not create shader. Please use debugscript 3" ) destroyElement( textures[perfectname] ) return elseif not textures[perfectname] then exports.DRKdx:new( "loading texture failed" ) destroyElement ( shaders[perfectname] ) tec = nil return end end end ) function groupskinapply(cmd,num) local grp = getElementData(localPlayer,"Group") local perfectname = grp..""..num if grp and grp ~= "" and shaders[perfectname] then if applied[perfectname] then triggerServerEvent("SunApplyToAllServer", root, perfectname, theplayer) applied[perfectname] = nil return end theplayer = localPlayer val = groups[1] applied[perfectname] = true triggerServerEvent("SonApplyToAllServer", root, perfectname, theplayer) exports.DRKdx:new("Applied group skin "..num,0,255,0) end end addCommandHandler("groupskin", groupskinapply) addEvent("onApplyToAllServer", true ) function applyitdude(val, player) bool1 = engineApplyShaderToWorldTexture ( shaders[val], names[val], player ) --- if not bool1 then outputChatBox("oh 4",255,0,0) end end addEventHandler("onApplyToAllServer", root, applyitdude) addEvent("unApplyToAllServer", true ) function unapplyitdude(val, player) bool1 = engineRemoveShaderFromWorldTexture ( shaders[val], names[val], player ) if not bool1 then outputChatBox("oh 4",255,0,0) end end addEventHandler("unApplyToAllServer", root, unapplyitdude)