CapsAdmin

Untitled

May 22nd, 2011
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.04 KB | None | 0 0
  1. function RealTimeLight()
  2.     osdate = tostring(os.date(Ec))
  3.     time = string.sub(osdate, -8 )
  4.    
  5.     if time == "00:00:00" then
  6.         RunConsoleCommand("es_lightstyle", "0", " ", "b")
  7.         PlaceLights()
  8.     end
  9.    
  10.     if time == "00:30:00" then
  11.         RunConsoleCommand("es_lightstyle", "0", " ", "c")
  12.         PlaceLights()
  13.     end
  14.    
  15.     if time == "01:00:00" then
  16.         RunConsoleCommand("es_lightstyle", "0", " ", "d")
  17.         PlaceLights()
  18.     end
  19.    
  20.     if time == "01:30:00" then
  21.         RunConsoleCommand("es_lightstyle", "0", " ", "e")
  22.         PlaceLights()
  23.     end
  24.    
  25.     if time == "02:00:00" then
  26.         RunConsoleCommand("es_lightstyle", "0", " ", "f")
  27.         PlaceLights()
  28.     end
  29.    
  30.     if time == "02:30:00" then
  31.         RunConsoleCommand("es_lightstyle", "0", " ", "g")
  32.         PlaceLights()
  33.     end
  34.    
  35.     if time == "03:00:00" then
  36.         RunConsoleCommand("es_lightstyle", "0", " ", "h")
  37.         PlaceLights()
  38.     end
  39.    
  40.     if time == "03:30:00" then
  41.         RunConsoleCommand("es_lightstyle", "0", " ", "i")
  42.         PlaceLights()
  43.     end
  44.    
  45.     if time == "04:00:00" then
  46.         RunConsoleCommand("es_lightstyle", "0", " ", "j")
  47.         PlaceLights()
  48.     end
  49.    
  50.     if time == "04:30:00" then
  51.         RunConsoleCommand("es_lightstyle", "0", " ", "k")
  52.         PlaceLights()
  53.     end
  54.    
  55.     if time == "05:00:00" then
  56.         RunConsoleCommand("es_lightstyle", "0", " ", "l")
  57.         PlaceLights()
  58.     end
  59.    
  60.     if time == "05:30:00" then
  61.         RunConsoleCommand("es_lightstyle", "0", " ", "m")
  62.         PlaceLights()
  63.     end
  64.    
  65.     if time == "06:00:00" then
  66.         RunConsoleCommand("es_lightstyle", "0", " ", "n")
  67.         PlaceLights()
  68.     end
  69.    
  70.     if time == "06:30:00" then
  71.         RunConsoleCommand("es_lightstyle", "0", " ", "o")
  72.         PlaceLights()
  73.     end
  74.    
  75.     if time == "07:00:00" then
  76.         RunConsoleCommand("es_lightstyle", "0", " ", "p")
  77.         PlaceLights()
  78.     end
  79.    
  80.     if time == "07:30:00" then
  81.         RunConsoleCommand("es_lightstyle", "0", " ", "q")
  82.         PlaceLights()
  83.     end
  84.    
  85.     if time == "08:00:00" then
  86.         RunConsoleCommand("es_lightstyle", "0", " ", "r")
  87.         PlaceLights()
  88.     end
  89.    
  90.     if time == "08:30:00" then
  91.         RunConsoleCommand("es_lightstyle", "0", " ", "s")
  92.         PlaceLights()
  93.     end
  94.    
  95.     if time == "09:00:00" then
  96.         RunConsoleCommand("es_lightstyle", "0", " ", "t")
  97.         PlaceLights()
  98.     end
  99.    
  100.     if time == "09:30:00" then
  101.         RunConsoleCommand("es_lightstyle", "0", " ", "u")
  102.         PlaceLights()
  103.     end
  104.    
  105.     if time == "10:00:00" then
  106.         RunConsoleCommand("es_lightstyle", "0", " ", "v")
  107.         PlaceLights()
  108.     end
  109.    
  110.     if time == "10:30:00" then
  111.         RunConsoleCommand("es_lightstyle", "0", " ", "w")
  112.         PlaceLights()
  113.     end
  114.    
  115.     if time == "11:00:00" then
  116.         RunConsoleCommand("es_lightstyle", "0", " ", "x")
  117.         PlaceLights()
  118.     end
  119.    
  120.     if time == "11:30:00" then
  121.         RunConsoleCommand("es_lightstyle", "0", " ", "y")
  122.         PlaceLights()
  123.     end
  124.    
  125.     if time == "12:00:00" then
  126.         RunConsoleCommand("es_lightstyle", "0", " ", "z")
  127.         PlaceLights()
  128.     end
  129.    
  130.     if time == "12:30:00" then
  131.         RunConsoleCommand("es_lightstyle", "0", " ", "y")
  132.         PlaceLights()
  133.     end
  134.    
  135.     if time == "13:00:00" then
  136.         RunConsoleCommand("es_lightstyle", "0", " ", "x")
  137.         PlaceLights()
  138.     end
  139.    
  140.     if time == "13:30:00" then
  141.         RunConsoleCommand("es_lightstyle", "0", " ", "w")
  142.         PlaceLights()
  143.     end
  144.    
  145.     if time == "14:00:00" then
  146.         RunConsoleCommand("es_lightstyle", "0", " ", "v")
  147.         PlaceLights()
  148.     end
  149.    
  150.     if time == "14:30:00" then
  151.         RunConsoleCommand("es_lightstyle", "0", " ", "u")
  152.         PlaceLights()
  153.     end
  154.    
  155.     if time == "15:00:00" then
  156.         RunConsoleCommand("es_lightstyle", "0", " ", "t")
  157.         PlaceLights()
  158.     end
  159.  
  160.     if time == "16:00:00" then
  161.         RunConsoleCommand("es_lightstyle", "0", " ", "s")
  162.         PlaceLights()
  163.     end
  164.    
  165.     if time == "16:30:00" then
  166.         RunConsoleCommand("es_lightstyle", "0", " ", "r")
  167.         PlaceLights()
  168.     end
  169.    
  170.     if time == "17:00:00" then
  171.         RunConsoleCommand("es_lightstyle", "0", " ", "q")
  172.         PlaceLights()
  173.     end
  174.    
  175.     if time == "17:30:00" then
  176.         RunConsoleCommand("es_lightstyle", "0", " ", "p")
  177.         PlaceLights()
  178.     end
  179.    
  180.     if time == "18:00:00" then
  181.         RunConsoleCommand("es_lightstyle", "0", " ", "o")
  182.         PlaceLights()
  183.     end
  184.    
  185.     if time == "18:30:00" then
  186.         RunConsoleCommand("es_lightstyle", "0", " ", "n")
  187.         PlaceLights()
  188.     end
  189.    
  190.     if time == "19:00:00" then
  191.         RunConsoleCommand("es_lightstyle", "0", " ", "m")
  192.         PlaceLights()
  193.     end
  194.    
  195.     if time == "19:30:00" then
  196.         RunConsoleCommand("es_lightstyle", "0", " ", "l")
  197.         PlaceLights()
  198.     end
  199.    
  200.     if time == "20:00:00" then
  201.         RunConsoleCommand("es_lightstyle", "0", " ", "k")
  202.         PlaceLights()
  203.     end
  204.    
  205.     if time == "20:30:00" then
  206.         RunConsoleCommand("es_lightstyle", "0", " ", "j")
  207.         PlaceLights()
  208.     end
  209.    
  210.     if time == "21:00:00" then
  211.         RunConsoleCommand("es_lightstyle", "0", " ", "i")
  212.         PlaceLights()
  213.     end
  214.    
  215.     if time == "21:30:00" then
  216.         RunConsoleCommand("es_lightstyle", "0", " ", "h")
  217.         PlaceLights()
  218.     end
  219.    
  220.     if time == "22:00:00" then
  221.         RunConsoleCommand("es_lightstyle", "0", " ", "g")
  222.         PlaceLights()
  223.     end
  224.    
  225.     if time == "22:30:00" then
  226.         RunConsoleCommand("es_lightstyle", "0", " ", "f")
  227.         PlaceLights()
  228.     end
  229.    
  230.     if time == "23:00:00" then
  231.         RunConsoleCommand("es_lightstyle", "0", " ", "e")
  232.         PlaceLights()
  233.     end
  234.    
  235.     if time == "23:30:00" then
  236.         RunConsoleCommand("es_lightstyle", "0", " ", "d")
  237.         PlaceLights()
  238.     end
  239.    
  240. end
  241.    
  242.    
  243. hook.Add("Think", "HookRealTimeLight", RealTimeLight)
  244.  
  245. function PlaceLights()
  246.     local dynlightp = ents.Create("prop_physics")
  247.     dynlightp:SetPos( Vector(0,0,0) )
  248.     dynlightp:SetModel( "models/items/combine_rifle_ammo01.mdl" )
  249.     dynlightp:Spawn()
  250.  
  251.     local dynlight = ents.Create( "light_dynamic" )
  252.     dynlight:SetKeyValue( "_light", "0 0 0 0")
  253.     dynlight:SetKeyValue( "style", 0 )
  254.     dynlight:SetKeyValue( "distance", 16000 )
  255.     dynlight:SetKeyValue( "brightness", 0 )
  256.     --dynlight:SetKeyValue("spawnflags","2")  
  257.     dynlight:Spawn()
  258.     dynlight:SetParent(dynlightp)
  259.     if game.GetMap() == "gm_flatgrass" then
  260.         timer.Simple(0.1, function() dynlightp:SetPos( Vector(0,0,100) ) end)
  261.         timer.Simple(0.2, function() dynlight:SetKeyValue( "distance", 1000 ) dynlightp:SetPos( Vector(12271, -15343, 63) ) end)
  262.         timer.Simple(0.3, function() dynlight:SetKeyValue( "distance", 5000 ) dynlightp:SetPos( Vector(-15412.406250, -8199.906250 , 63) ) end)
  263.         timer.Simple(0.4, function() dynlight:SetKeyValue( "distance", 5000 ) dynlightp:SetPos( Vector(-14267.750000, 10165.625000 , 63) ) end)
  264.         timer.Simple(0.5, function() dynlight:SetKeyValue( "distance", 1000 ) dynlightp:SetPos( Vector(-8899.781250, -14625.156250, 63.031250) ) end)
  265.         timer.Simple(0.6, function() dynlight:SetKeyValue( "distance", 1000 ) dynlightp:SetPos( Vector(-14625.156250, -14625.156250, 63.031250) ) end)
  266.         timer.Simple(0.7, function() dynlight:SetKeyValue( "distance", 1000 ) dynlightp:SetPos( Vector(  1434.218750, 758.375000, 123.093750) ) end)
  267.         timer.Simple(0.9, function() dynlightp:Remove() end)
  268.     end
  269.    
  270.     if game.GetMap() == "gm_construct" then
  271.         timer.Simple(0.1, function() dynlight:SetKeyValue( "distance", 8000 ) dynlightp:SetPos( Vector(-520.375000, 2774.437500, 417.468750) ) end)
  272.         timer.Simple(0.2, function() dynlight:SetKeyValue( "distance", 8000 ) dynlightp:SetPos( Vector(-2151.218750, -1235.093750, 4.156250) ) end)
  273.         timer.Simple(0.3, function() dynlight:SetKeyValue( "distance", 8000 ) dynlightp:SetPos( Vector(1474.062500, 9.656250, -70.906250) ) end)
  274.         timer.Simple(0.4, function() dynlight:SetKeyValue( "distance", 8000 ) dynlightp:Remove() end)
  275.     end
  276.    
  277.     if game.GetMap() == "gm_flatgrass_revolution" then
  278.         timer.Simple(0.1, function() dynlightp:SetPos( Vector(-24, 24, -7556) ) end)
  279.         timer.Simple(0.2, function() dynlightp:SetPos( Vector(3416, -3804, -7834) ) end)
  280.         timer.Simple(0.3, function() dynlightp:SetPos( Vector(-14008, -14333, -5952) ) end)
  281.         timer.Simple(0.4, function() dynlightp:Remove() end)
  282.     end
  283.    
  284.        
  285.     if game.GetMap() == "freespace06_v2_snow_night1" then
  286.         timer.Simple(0.1, function() dynlightp:SetPos( Vector(-49.875000, 30.156250, 609.343750) ) end)
  287.     --  timer.Simple(0.2, function() dynlightp:SetPos( Vector(-1994.343750, -6153.500000, -3177.531250) ) end)
  288.         timer.Simple(0.3, function() dynlightp:SetPos( Vector(-14008, -14333, -5952) ) end)
  289.         timer.Simple(0.4, function() dynlightp:Remove() end)
  290.     end
  291.     timer.Simple(1, function() dynlightp:Remove() end)
  292.     timer.Simple(1.1, function() dynlight:Remove() end)
  293. end
Advertisement
Add Comment
Please, Sign In to add comment