Guest User

Untitled

a guest
Apr 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. --AddCSLuaFile( "server.lua" )
  2.  
  3.  
  4. local function AddDir(dir)
  5. local list = file.FindDir("../"..dir.."/*")
  6. for _, fdir in pairs(list) do
  7. if fdir != ".svn" then
  8. AddDir(dir.."/"..fdir)
  9. end
  10. end
  11.  
  12. for k,v in pairs(file.Find("../"..dir.."/*")) do
  13. resource.AddFile(dir.."/"..v)
  14. end
  15. end
  16.  
  17. /*---------------------
  18. Christmas Tree ----
  19. ----------------------*/
  20.  
  21. print( "Christmas Tree Loaded" )
  22. resource.AddFile( "models/cloud/kn_xmastree007.mdl" )
  23. AddDir( "materials/models/cloud/xmastree" )
  24.  
  25. local tree = {}
  26.  
  27. hook.Add( "InitPostEntity", "Holiday_Christmas_Tree", function()
  28. timer.Simple( 1, function()
  29.  
  30. function tree.SpawnTree()
  31. if game.GetMap() == "gm_bigcity" then
  32. local ent = ents.Create( "prop_physics" )
  33. if ent and ent:IsValid() then
  34. ent:SetModel( "models/cloud/kn_xmastree007.mdl" )
  35. ent:SetPos( Vector( -52, -1910, -11100 ) )
  36. ent:SetAngles( Angle(0, 0, 0) )
  37. ent:Spawn()
  38. ent:SetMoveType( MOVETYPE_NONE )
  39. ent:SetName( "Christmas Tree" )
  40. end
  41. end
  42. end
  43. tree.SpawnTree()
  44.  
  45. hook.Add( "PhysgunPickup", "Holiday_Christmas_Tree_Block_PickUp", function( ply, ent )
  46.  
  47. if ent:GetName() == "Christmas Tree" then
  48. local id = ply:SteamID()
  49.  
  50. if id == "STEAM_0:0:19081035" /*or id == "STEAM_0:0:26325520"*/ then
  51. return true
  52. else
  53. return false
  54. end
  55. end
  56.  
  57. end )
  58.  
  59. hook.Add( "CanTool", "Holiday_Christmas_Tree_Block_ToolUse", function( ply, tr, tool )
  60.  
  61. local ent = tr.Entity
  62.  
  63. if ent:GetName() == "Christmas Tree" then
  64. local id = ply:SteamID()
  65.  
  66. if id == "STEAM_0:0:19081035"/* or id == "STEAM_0:0:26325520"*/ then
  67. return true
  68. else
  69. return false
  70. end
  71. end
  72.  
  73. end )
  74.  
  75. hook.Add( "EntityRemoved", "Holiday_Christmas_Tree_Block_Removing", function( ent )
  76.  
  77. if ent:GetName() == "Christmas Tree" then
  78.  
  79. timer.Simple( 3, function()
  80. if not ent:IsValid() then tree.SpawnTree() end
  81. end )
  82.  
  83. end
  84.  
  85. end )
  86.  
  87. end )
  88. end )
  89.  
  90. /*---------------------
  91. Christmas Tree ----
  92. ----------------------*/
Add Comment
Please, Sign In to add comment