Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --AddCSLuaFile( "server.lua" )
- local function AddDir(dir)
- local list = file.FindDir("../"..dir.."/*")
- for _, fdir in pairs(list) do
- if fdir != ".svn" then
- AddDir(dir.."/"..fdir)
- end
- end
- for k,v in pairs(file.Find("../"..dir.."/*")) do
- resource.AddFile(dir.."/"..v)
- end
- end
- /*---------------------
- Christmas Tree ----
- ----------------------*/
- print( "Christmas Tree Loaded" )
- resource.AddFile( "models/cloud/kn_xmastree007.mdl" )
- AddDir( "materials/models/cloud/xmastree" )
- local tree = {}
- hook.Add( "InitPostEntity", "Holiday_Christmas_Tree", function()
- timer.Simple( 1, function()
- function tree.SpawnTree()
- if game.GetMap() == "gm_bigcity" then
- local ent = ents.Create( "prop_physics" )
- if ent and ent:IsValid() then
- ent:SetModel( "models/cloud/kn_xmastree007.mdl" )
- ent:SetPos( Vector( -52, -1910, -11100 ) )
- ent:SetAngles( Angle(0, 0, 0) )
- ent:Spawn()
- ent:SetMoveType( MOVETYPE_NONE )
- ent:SetName( "Christmas Tree" )
- end
- end
- end
- tree.SpawnTree()
- hook.Add( "PhysgunPickup", "Holiday_Christmas_Tree_Block_PickUp", function( ply, ent )
- if ent:GetName() == "Christmas Tree" then
- local id = ply:SteamID()
- if id == "STEAM_0:0:19081035" /*or id == "STEAM_0:0:26325520"*/ then
- return true
- else
- return false
- end
- end
- end )
- hook.Add( "CanTool", "Holiday_Christmas_Tree_Block_ToolUse", function( ply, tr, tool )
- local ent = tr.Entity
- if ent:GetName() == "Christmas Tree" then
- local id = ply:SteamID()
- if id == "STEAM_0:0:19081035"/* or id == "STEAM_0:0:26325520"*/ then
- return true
- else
- return false
- end
- end
- end )
- hook.Add( "EntityRemoved", "Holiday_Christmas_Tree_Block_Removing", function( ent )
- if ent:GetName() == "Christmas Tree" then
- timer.Simple( 3, function()
- if not ent:IsValid() then tree.SpawnTree() end
- end )
- end
- end )
- end )
- end )
- /*---------------------
- Christmas Tree ----
- ----------------------*/
Add Comment
Please, Sign In to add comment