Rp_bangclaw текстуры снега

Всем привет! Решил выложить обычный скрипт который заменит некоторые текстуры на карте rp_bangclaw снегом (Можно так же сделать для других карт если знаете названия материалов)

Сам скрипт: cl_snow.lua (2.6 КБ)

Удачи!

1 симпатия

такой же скрипт, но, кажется, более грамотно реализованный с моего закрытого проекта. Тут настроены сразу несколько карт, включая тот же Bangclaw

local map = game.GetMap()

local mtab = string.find(map,"rp_bloc") and {
	"maps/rp_bloc42_zarp/stone/stonefloor006a_2032_1360_32",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_2128_1760_32",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_1472_2816_-45",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_2176_800_0",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_2944_1184_32",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_3264_944_0",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_2577_506_0",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_4144_928_16",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_2672_-256_51",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_2752_3168_-41",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_1472_2816_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_2704_1680_500",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_2864_1444_500",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_3008_1712_64",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_4159_2823_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_4563_2718_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_4159_2823_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_4563_2718_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_5980_3504_104",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_6232_2384_-40",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_5828_1669_-64",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_6232_2384_-40",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_6854_1601_-66",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6854_1601_-66",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6350_1441_49",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6976_768_-25",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6385_-417_115",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7504_-1272_8",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7664_-1208_8",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7696_-1488_8",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6408_-1344_15",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6298_-2128_6",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7520_-1544_8",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6114_-604_115",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_5768_-502_6",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_4993_-956_45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_4239_-968_64",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_3269_-800_64",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_2688_-432_51",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_3725_-915_64",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6319_698_-5",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6176_1425_49",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_5235_1144_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_4905_1304_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_4712_1714_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_4752_2224_-45",
	"concrete/concretefloor038a",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_928_1024_0",
	"maps/rp_bloc42_zarp/nature/blenddirtgrass005a_wvt_patch",
	"de_train/train_cementwear_01",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_3264_944_0",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2032_1360_32",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2128_1760_32",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_1472_2816_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2688_2112_-24",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_2688_2112_-24",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_3312_2400_-72",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2752_3168_-41",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2160_3248_-72",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_1666_3282_-45",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_1666_3282_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_1666_3282_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_1225_3325_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_1472_2816_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_1472_2816_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_1280_1024_0",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2176_800_0",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_2616_598_152",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2577_506_0",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2672_-256_51",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_3496_344_91",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_3524_-115_213",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2688_-432_51",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_3269_-800_64",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_3725_-915_64",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_4239_-968_64",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6298_-2128_6",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_4993_-956_45",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6408_-1344_15",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_6408_-1344_15",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_7504_-1272_8",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_7520_-1544_8",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_3725_-915_64",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_3269_-800_64",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6114_-604_115",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_5768_-502_6",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_5768_-502_6",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_6280_-450_6",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6385_-417_115",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_6280_-450_6",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_6385_-417_115",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6319_698_-5",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_6319_698_-5",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_5846_710_-5",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6976_768_-25",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_6976_768_-25",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_7191_1167_-63",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_7074_1534_-63",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6854_1601_-66",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_6350_1441_49",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_c17_6350_1441_49",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6176_1425_49",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_6348_1654_-63",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_c17_6348_1654_-63",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_7040_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_6408_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_6232_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_6232_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_5980_3504_104",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_4563_2718_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_4159_2823_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_4712_1714_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_4905_1304_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_5235_1144_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_5235_1144_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_4752_2224_-45",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_5828_1669_-64",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_6348_1654_-63",
	"props/rubberroof002a",
	"maps/rp_bloc42_zarp/concrete/milflr001_3888_928_256",
	"maps/rp_bloc42_zarp/concrete/milflr001_6114_-603_235",
	"maps/rp_bloc42_zarp/tile/tileroof004b_5785_-510_235",
	"maps/rp_bloc42_zarp/tile/tileroof004b_6408_-1344_15",
	"maps/rp_bloc42_zarp/metal/metalroof006a_7664_-1208_8",
	"maps/rp_bloc42_zarp/metal/metalroof006a_7408_-2224_-192",
	"maps/rp_bloc42_zarp/metal/metalroof006a_6385_-416_235",
	"maps/rp_bloc42_zarp/tile/tilefloor019a_5785_-510_235",
	"maps/rp_bloc42_zarp/metal/metalroof006a_6408_-1344_15",
	"maps/rp_bloc42_zarp/metal/metalroof006a_7504_-1272_8",
	"maps/rp_bloc42_zarp/concrete/milflr001_2864_1444_500",
	"maps/rp_bloc42_zarp/metal/metalroof006a_6080_456_136",
	"maps/rp_bloc42_zarp/concrete/milflr001_6137_-436_235",
	"maps/rp_bloc42_zarp/concrete/milflr001_6385_-416_235",
	"maps/rp_bloc42_zarp/concrete/milflr001_5785_-510_235",
	"maps/rp_bloc42_zarp/concrete/milflr001_3888_928_400",
	"maps/rp_bloc42_zarp/tile/tilefloor019a_6408_2384_104",
	"maps/rp_bloc42_zarp/metal/metalwall047a_6114_-604_115",
	"maps/rp_bloc42_zarp/metal/metalwall047a_6114_-603_235",
	"concrete/concretefloor016a",
	"maps/rp_bloc42_zarp/concrete/concretefloor013b_2288_464_176",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_3264_944_0",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6232_2384_-40",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7040_2384_-40",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7224_3456_112",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6408_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_7224_3456_112",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_7224_3456_112",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_7592_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_6320_3800_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_7376_3776_-24",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6320_3800_-40",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_5980_3504_104",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6232_2384_-40",
	"maps/rp_bloc42_zarp/de_train/blendgrassdirt001a_wvt_patch",
	"de_train/blendgrassdirt001a",
	"cs_italy/tileroof01",
	"de_cbble/rooftile02",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_1280_1024_0",
	"maps/rp_bloc42_zarp/metal/metalroof006a_1648_800_0",
	"props/rubberroof002a",
	"maps/rp_bloc42_zarp/metal/metalroof006a_1280_1024_0",
	"maps/rp_bloc42_zarp/concrete/concretefloor013b_1904_464_416",
	"maps/rp_bloc42_zarp/metal/metalroof006a_1904_768_176",
	"maps/rp_bloc42_zarp/metal/metalroof006a_1632_624_288",
	"maps/rp_bloc42_zarp/metal/metalroof006a_1904_768_176",
	"maps/rp_bloc42_zarp/metal/metalroof006a_2128_1760_32",
	"de_tides/tides_roof_1",
	"nature/cliffface002a",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_7664_-1208_8",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_7664_-1208_8",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_6385_-417_115",
	"maps/rp_bloc42_zarp/concrete/concretefloor028d_7664_-1208_8",
	"maps/rp_bloc42_zarp/concrete/concretefloor028c_c17_7696_-1488_8",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_2128_1760_32",
	"maps/rp_bloc42_zarp/cs_assault/pavement001a_1632_624_288",
	"maps/rp_bloc42_zarp/metal/metalwall047a_3008_1712_64",
	"maps/rp_bloc42_zarp/concrete/concretefloor039a_6232_2384_-40",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_5824_1465_-64",
	"maps/rp_bloc42_zarp/concrete/milflr001_6176_1430_174",
	"maps/rp_bloc42_zarp/concrete/milflr001_6176_1425_49",
	"maps/rp_bloc42_zarp/concrete/concretefloor039b_2944_1184_32",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_6385_-417_115",
	"maps/rp_bloc42_zarp/cs_assault/pavement001_7040_2384_-40",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_6348_1654_-63",
	"maps/rp_bloc42_zarp/metal/metalroof006a_1632_624_176",
	"maps/rp_bloc42_zarp/stone/stonefloor006a_7376_3776_-24",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_6816_-2240_6",
	"maps/rp_bloc42_zarp/concrete/concretefloor019a_6298_-2128_6"


} or map == "rp_bangclaw" and {
	"maps/rp_bangclaw_test22222/concrete/concretefloor033k_c17_3224_-2651_560",
	"maps/rp_bangclaw_test22222/concrete/concretefloor033o_3224_-2651_560",
	"concrete/concretefloor023a",
	"maps/rp_bangclaw_test22222/concrete/concretefloor033a_3224_-2651_560",
	"nature/grassfloor002a",
	"concrete/concretefloor027a",
	"concrete/concretefloor015a_c17",
	"maps/rp_bangclaw_test22222/nature/blendsandgrass008a_wvt_patch",
	"cs_havana/concretefloor011a",
	"nature/blendrocksand008d",
	"maps/rp_bangclaw_test22222/metal/metalroof005a_3224_-2651_560",
	"metal/milroof002",
	"props/tarpaperroof002a",
	"maps/rp_bangclaw_test22222/metal/metalroof004a_3224_-2651_560",
	"maps/rp_bangclaw_test22222/metal/metalroof004a_3208_509_-488",
	"maps/rp_bangclaw_test22222/metal/metalroof004a_1048_1799_-864",
	"building_template/roof_template001a",
	"maps/rp_bangclaw_test22222/metal/metalroof006a_3224_-2651_560",
	"concrete/concretefloor008a",
	"tile/infroofb",
	"maps/rp_bangclaw_test22222/metal/metalroof008a_3224_-2651_560",
	"maps/rp_bangclaw_test22222/concrete/concretefloor005a_3224_-2651_560",
	"concrete/concretewall001a",
	"concrete/concretefloor031a",
	"maps/rp_bangclaw_test22222/nature/blendmudmud001a_3044_1624_-865",
	"maps/rp_bangclaw_test22222/nature/blendmudmud001a_3208_509_-488",
	"maps/rp_bangclaw_test22222/concrete/concretefloor033k_c17_3208_509_-488",
	"maps/rp_bangclaw_test22222/metal/metalroof006a_3044_1624_-865",
	"maps/rp_bangclaw_test22222/nature/blendsandsand008a_wvt_patch",
	"metal/metalfloor007a"


} or map == "rp_downtown_evilmelon_v1" and {
	"ajacks/ajacks_road8",
	"nature/cliffface002a",
	"de_train/train_cement_floor_01",
	"ajacks/ajacks_10",
	"stone/stonefloor011a",
	"brick/brickfloor001a",
	"ajacks/ajacks_road6",
	"ajacks/ajacks_grass01",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-1760_-907_437",
	"concrete/concretefloor027a",
	"realworldtextures2/roof/roof_07",
	"concrete/prodflrb",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof004a_-3523_-1268_41",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-2872_-2021_41",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-3896_-1798_42",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-3149_-231_42",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-3896_-1798_42",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-3523_-1268_41",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-3523_-1268_41",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-3214_199_42",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-3214_199_42",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-2611_385_256",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof004a_-2872_-2021_41",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-2611_385_256",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-1803_471_298",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-1262_-923_438",
	"maps/rp_downtown_evilmelon_v1/tile/tileroof002a_-1314_897_41",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-1374_1625_-214",
	"concrete/concretewall001a",
	"maps/rp_downtown_evilmelon_v1/cs_assault/pavement001a_352_2681_188",
	"maps/rp_downtown_evilmelon_v1/stone/stonestair001a_-1262_-923_182",
	"maps/rp_downtown_evilmelon_v1/stone/stonestair001a_182_415_199",
	"metal/milroof002",
	"maps/rp_downtown_evilmelon_v1/concrete/concretefloor005a_-812_-1832_49",
	"wood/milroof005",
	"realworldtextures2/roof/roof_01",
}


if !mtab then
	MsgC(Color(255,30,30),("--== NEED TO SETUP SNOW ON THIS MAP ==--\n"):rep(10))
	return
end


-- Смена формата для оптимизации в PlayerFootstep
for i,mat in ipairs(mtab) do
	mtab[mat] = true
	mtab[i]   = nil
end

local snow = Material("nature/snowfloor001a")
local function replaceWithSnow(targ_mat,dat)
	local targmat = Material(targ_mat)
	targmat:SetTexture("$basetexture", snow:GetTexture("$basetexture") )

	local matrix = Matrix()
	matrix:Scale( Vector(1,1,1) )
	matrix:Translate( Vector(0,0,0) )
	matrix:Rotate( Angle(0,0,0) )

	targmat:SetMatrix("$basetexturetransform", matrix)
	targmat:SetVector("$color", Vector(1,1,1))
end




hook.Add("InitPostEntity", "SnowOnBloc42", function()
	for mat in pairs(mtab) do
		replaceWithSnow(mat)
	end
end)

local mr = math.random
local ut = util.TraceLine
hook.Add("PlayerFootstep", "SnowOnBloc42", function(ply, pos)
	local t_tbl = ut( {
		start  = pos + Vector( 0, 0, 32 ),
		endpos = pos - ply:GetAngles():Up() * 100,
		filter = {ply},
	})

	--chat.AddText(t_tbl.HitTexture)
	if mtab[string.lower(t_tbl.HitTexture)] or t_tbl.HitTexture == "**displacement**" then
		ply:EmitSound(("player/footsteps/snow%s.wav"):format(mr(6)), 60, mr(95,105))
		return true
	end
end )

Путь: /addons/anyname/lua/autorun/client/snow.lua

Автор: Telegram: Contact @IVogel