у меня есть скрипт который позволяет включить и выключить снег на карте и возможно ли сделать вот через такую штучку (os.date("%m") == "12" or os.date("%m") == "1")
включения и отключения этого скрипта
local SnowColor = Vector( 0.6, 0.6, 0.6 )
local Map_Textures = { }
local Is_BaseTexture2 = { }
Snow_RestoreData = Snow_RestoreData or { } -- auto
Snow_RestoreColors = Snow_RestoreColors or { } -- auto
local current_map = game.GetMap( ):lower( )
-- concrete/offflrasnow -- nature/snowwall001a -- nature/snowfloor001a
if current_map == "rp_bangclaw_urb" then
Map_Textures = {
[ "maps/rp_bangclaw_urb/metal/metalroof006a_3224_-2651_560" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/metal/metalroof006a_3208_509_-488" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/metal/metalroof005a_3224_-2651_560" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/metal/metalroof008a_3224_-2651_560" ] = "nature/snowfloor001a",
[ "tile/infroofb" ] = "nature/snowfloor001a",
[ "nature/grassfloor002a" ] = "concrete/offflrasnow",
[ "concrete/concretefloor016a" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/concrete/concretefloor033k_c17_3208_509_-488" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/concrete/concretefloor033k_c17_3224_-2651_560" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/concrete/concretefloor033o_3224_-2651_560" ] = "nature/snowfloor001a",
[ "concrete/concretefloor023a" ] = "concrete/concwsnow01",
[ "concrete/concretefloor015a_c17" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/metal/metalroof008a_3208_509_-488" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/concrete/concretefloor033a_3224_-2651_560" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/concrete/concretefloor005a_3224_-2651_560" ] = "nature/snowfloor001a",
[ "building_template/roof_template001a" ] = "nature/snowfloor001a",
[ "cs_havana/concretefloor011a" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_urb/cs_italy/cobble04_3224_-2651_560" ] = "nature/snowfloor001a",
[ "props/tarpaperroof002a" ] = "nature/snowfloor001a",
[ "metal/milroof002" ] = "nature/snowfloor001a",
[ "cs_italy/tileroof01" ] = "nature/snowfloor001a",
--[[ [ "maps/rp_bangclaw_test22222/metal/metalroof006a_3044_1624_-865" ] = "nature/snowwall001a",
[ "maps/rp_bangclaw_test22222/concrete/concretefloor033k_c17_3224_-2651_560" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_test22222/concrete/concretefloor033o_3224_-2651_560" ] = "nature/snowfloor001a",
[ "maps/rp_bangclaw_test22222/concrete/concretefloor033a_3224_-2651_560" ] = "nature/snowfloor003a",
[ "CONCRETE/CONCRETEFLOOR008A" ] = "concrete/offflrasnow",
[ "TILE/INFROOFB" ] = "nature/snowwall001a",
[ "CS_ITALY/TILEROOF01" ] = "concrete/offflrasnow",
[ "maps/rp_bangclaw_test22222/concrete/concretefloor005a_3224_-2651_560" ] = "concrete/offflrasnow",
[ "PROPS/TARPAPERROOF002A" ] = "concrete/offflrasnow",
[ "maps/rp_bangclaw_test22222/nature/blendsandgrass008a_wvt_patch" ] = "nature/snowfloor001a",
[ "nature/blenddirtgrass006a" ] = "nature/snowfloor003a",
[ "building_template/roof_template001a" ] = "concrete/offflrasnow",
[ "concrete/concretewall001a" ] = "concrete/offflrasnow",
[ "concrete/concretewall065a" ] = "concrete/offflrasnow",
[ "de_train/train_cement_floor_01" ] = "concrete/concwsnow01",
[ "CONCRETE/CONCRETEFLOOR023A" ] = "concrete/concwsnow01",
[ "de_train/train_grass_floor_01" ] = "nature/snowfloor003a",
[ "nature/blendmilground004_2" ] = "nature/snowfloor003a",
[ "nature/grassfloor002a" ] = "nature/snowfloor003a",
[ "BUILDING_TEMPLATE/ROOF_TEMPLATE001A" ] = "concrete/offflrasnow",
[ "CONCRETE/CONCRETEFLOOR011A" ] = "concrete/offflrasnow",
[ "CONCRETE/CONCRETEFLOOR026A" ] = "concrete/offflrasnow",
[ "CONCRETE/CONCRETEFLOOR034A" ] = "concrete/concwsnow01",
[ "CONCRETE/CONCRETEFLOOR036A" ] = "concrete/offflrasnow",
[ "CONCRETE/CONCRETEWALL001A" ] = "concrete/offflrasnow",
[ "CONCRETE/CONCRETEWALL065A" ] = "concrete/offflrasnow",
[ "CONCRETE/PRODFLRB" ] = "concrete/offflrasnow",
[ "CS_HAVANA/GROUND01GRASS" ] = "nature/snowfloor003a",
[ "DE_TRAIN/TRAIN_CEMENT_FLOOR_01" ] = "concrete/offflrasnow",
[ "NATURE/GRASSFLOOR002A" ] = "nature/snowfloor003a",
[ "REALWORLDTEXTURES2/GROUND/BRICK_PAVER_05" ] = "concrete/concwsnow01",
[ "cs_italy/ivy06b" ] = "models/airboat/airboat_blur02",
[ "gm_forest/3dm_rockbig_001" ] = "nature/snowfloor003a",
[ "gm_forest/brg_alder_brn" ] = "models/airboat/airboat_blur02",
[ "gm_forest/brg_berk_brn" ] = "models/airboat/airboat_blur02",
[ "mazur/gtatallgrassblend" ] = "nature/snowfloor003a",
[ "models/props/nature/rd_palmleaves01" ] = "models/airboat/airboat_blur02",
[ "models/props_foliage/hedgerow_01" ] = "models/airboat/airboat_blur02",
[ "models/props_foliage/mall_trees_branches01" ] = "models/airboat/airboat_blur02",
[ "models/shiroko/ot_branches1" ] = "models/airboat/airboat_blur02",--]]
}
Is_BaseTexture2 = {
[ "nature/blenddirtgrass006a" ] = "all",
}
else
return false
end
local Shine = { }
local state = false
function SnowTextures( enable )
if state == enable then return end
state = enable
if enable then
for k, v in pairs( Map_Textures ) do
local mat = Material( k )
if not Snow_RestoreData[ k ] then
local texture = mat:GetTexture( "$basetexture" )
if texture then
Snow_RestoreData[ k ] = texture:GetName( )
else
Map_Textures[ k ] = nil
continue
end
end
if not Snow_RestoreColors[ k ] then
Snow_RestoreColors[ k ] = mat:GetVector( "$color" )
end
mat:SetTexture( "$basetexture" .. ( Is_BaseTexture2[ k ] and "2" or "" ), v )
if Is_BaseTexture2[ k ] == "all" then
mat:SetTexture( "$basetexture", v )
end
mat:SetVector( "$color", SnowColor )
end
else
for k, v in pairs( Snow_RestoreData ) do
Material( k ):SetTexture( "$basetexture" .. ( Is_BaseTexture2[ k ] and "2" or "" ), v )
if Is_BaseTexture2[ k ] == "all" then
Material( k ):SetTexture( "$basetexture", v )
end
end
for k, v in pairs( Snow_RestoreColors ) do
Material( k ):SetVector( "$color", v )
end
end
end
local enabled = CreateClientConVar( "_snow", "1", true, "Снег" )
cvars.AddChangeCallback( "_snow", function( )
SnowTextures( enabled:GetBool( ) )
end, "snow_textures2" )
hook.Add( "InitPostEntity", "SnowTexture", function( )
if enabled:GetBool( ) then
SnowTextures( true )
end
end )
local snowMaterials = {}
for k, v in pairs( Map_Textures ) do
if v:StartWith( "nature" ) then
snowMaterials[ k ] = true
end
end
local function IsReplaced(str)
return snowMaterials[str] and true or false
end
local function ETHull(ent,pos,pos2,min,max)
local filter = ent
if ent.GetViewEntity then
filter = ent:GetViewEntity()
end
local t = util.TraceHull( {
start = pos,
endpos = pos + pos2,
maxs = max,
mins = min,
collisiongroup = ent:GetCollisionGroup(),
filter = filter
} )
t.HitPos = t.HitPos or (pos + pos2)
return t
end
local function EntTraceTexture(ent) -- Returns the texture the entity is "on"
local mt = ent:GetMoveType()
if mt < 2 or mt > 3 then return end
local mins,maxs = ent:OBBMins(),ent:OBBMaxs()
local h = maxs.z - mins.z
local t = ETHull(ent,ent:GetPos() + ent:OBBCenter(),Vector(0,0,-h / 2 - 20),Vector(mins.x,mins.y,-5),Vector(maxs.x,maxs.y,5))
if not t.Hit then return end -- flying
return t.HitTexture
end
local function ShouldReplaceSound(sTexture,snd) -- Given the texture and sound, return true if it should be replaced.
if not sTexture then return false end
if IsReplaced(sTexture) then return true end
local mat = Material(sTexture)
if not mat then return false end
local mat_name = mat:GetName()
if mat_name == "___error" then
if snd and (string.find(snd,"dirt") or string.find(snd,"grass")) then
return true
else
return false
end
end
return false
end
--[[ steamworks.DownloadUGC( 1578469210, function( path )
if !path then return end
game.MountGMA( path )
end) ]]
local sounds = {
"player/footsteps/snow1.wav",
"player/footsteps/snow2.wav",
"player/footsteps/snow3.wav",
"player/footsteps/snow4.wav",
"player/footsteps/snow5.wav",
"player/footsteps/snow6.wav",
}
-- Hooks
hook.Remove("EntityEmitSound","StormFox.Footstep.Detect",function(data)
if !enabled:GetBool( ) then return end
local ent = data.Entity
local snd = data.SoundName:lower()
local originalS = data.OriginalSoundName:lower()
if not IsValid(ent) then return end
if ent:IsWorld() then return end
local tex = EntTraceTexture(ent)
if tex then
if ShouldReplaceSound(tex,snd) then
if sounds then
data.SoundName = table.Random(sounds)
replaced = true
return true
end
end
end
end)
сам скрипт