Advertisement
HK47

Jail

May 8th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.85 KB | None | 0 0
  1. if SERVER then
  2.     local ent = {}
  3.     local govno = {}
  4.      
  5.     local vec = {
  6.         [1] = Vector(6255, 9855, -11240),
  7.         [2] = Vector(6355, 9855, -11240),
  8.         [3] = Vector(6455, 9855, -11240),
  9.            
  10.         [4] = Vector(6455, 9955, -11240),
  11.         [5] = Vector(6355, 9955, -11240),
  12.         [6] = Vector(6255, 9955, -11240),
  13.            
  14.         [7] = Vector(6255, 10055, -11240),
  15.         [8] = Vector(6355, 10055, -11240),
  16.         [9] = Vector(6455, 10055, -11240)
  17.     }
  18.      
  19.     local cols = {
  20.         [1] = Color(255, 0, 0),
  21.         [2] = Color(0, 255, 0),
  22.         [3] = Color(0, 0, 255),
  23.        
  24.         [4] = Color(255, 255, 0),
  25.         [5] = Color(255, 0, 255),
  26.         [6] = Color(0, 255, 255),
  27.        
  28.         [7] = Color(255, 255, 255),
  29.         [8] = Color(0, 0, 0),
  30.         [9] = Color(255, 150, 0),
  31.     }
  32.    
  33.     local plat = {}
  34.    
  35.     function spawnKeyPad(pos, ang)
  36.         local keypad = ents.Create("prop_physics")
  37.         keypad:SetPos(pos)
  38.         keypad:SetAngles(ang)
  39.         keypad:SetModel("models/props_junk/watermelon01.mdl")
  40.         keypad:Spawn()
  41.    
  42.         local poses = {
  43.             [1] = keypad:LocalToWorld(Vector(-5, 0, 0)),
  44.             [2] = keypad:LocalToWorld(Vector(0, 0, 0)),
  45.             [3] = keypad:LocalToWorld(Vector(5, 0, 0)),
  46.            
  47.             [4] = keypad:LocalToWorld(Vector(-5, 0, -5)),
  48.             [5] = keypad:LocalToWorld(Vector(0, 0, -5)),
  49.             [6] = keypad:LocalToWorld(Vector(5, 0, -5)),
  50.            
  51.             [7] = keypad:LocalToWorld(Vector(-5, 0, -10)),
  52.             [8] = keypad:LocalToWorld(Vector(0, 0, -10)),
  53.             [9] = keypad:LocalToWorld(Vector(5, 0, -10)),
  54.             [10] = keypad:LocalToWorld(Vector(15, 0, -5))
  55.         }
  56.        
  57.         local nums = {}
  58.        
  59.         for i = 1, 10 do
  60.             nums[i] = ents.Create("prop_physics")
  61.             nums[i]:SetModel("models/hunter/plates/plate.mdl")
  62.             nums[i]:SetPos(poses[i])
  63.             nums[i]:Spawn()
  64.             nums[i]:GetPhysicsObject():EnableMotion(false)
  65.         end
  66.        
  67.         hook.Add("Think", "checkk", function()
  68.             for i = 1, 10 do
  69.                 if not IsValid(nums[i]) then
  70.                     nums[i] = ents.Create("prop_physics")
  71.                     nums[i]:SetModel("models/hunter/plates/plate.mdl")
  72.                     nums[i]:SetPos(poses[i])
  73.                     nums[i]:Spawn()
  74.                     nums[i]:GetPhysicsObject():EnableMotion(false)
  75.                 else
  76.                     nums[i]:GetPhysicsObject():EnableMotion(false)
  77.                     nums[i]:SetPos(poses[i])
  78.                 end
  79.             end
  80.         end)
  81.        
  82.         local keys = {}
  83.        
  84.         local pass = {}
  85.        
  86.         for i = 1, 4 do
  87.             table.insert(pass, i, math.random(1, 9))
  88.             print(pass[i])
  89.         end
  90.        
  91.         hook.Add("PlayerSay", "getpassk", function(ply, text)
  92.             if ply:IsAdmin() then
  93.                 local exp = string.Explode(" ", text)
  94.                
  95.                 if exp[1] == "!getkp" then
  96.                     for i = 1, 4 do ply:ChatPrint(pass[i]) end
  97.                    
  98.                     return ""
  99.                 end
  100.             end
  101.         end)
  102.        
  103.         hook.Add("KeyPress", "keypad_think_lol", function()
  104.             for i = 1, 9 do
  105.                 for k, v in pairs(player.GetAll()) do
  106.                     local tr = v:GetEyeTrace()
  107.                     local dist = v:GetPos():Distance(nums[i]:GetPos())
  108.                  
  109.                     if tr.Entity == nums[10] and dist < 100 and v:KeyPressed(IN_USE) then  
  110.                         local check = 0
  111.                        
  112.                         for c = 1, 4 do
  113.                             SetGlobalString("keyp" .. c, "-")
  114.                            
  115.                             if keys[c] == pass[c] then
  116.                                 check = check + 1
  117.                             end
  118.                         end
  119.                        
  120.                         if check >= 4 then
  121.                             v:SetPData("EV_Jailed", false)
  122.                             v:Spawn()
  123.                             v:SetPos(Vector(-1612, 12522, -11143))
  124.                            
  125.                             for _, ply in pairs(player.GetAll()) do
  126.                                 ply:EmitSound("music/hl2_song31.mp3")
  127.                             end
  128.                            
  129.                             pass = {}
  130.            
  131.                             for i = 1, 4 do
  132.                                 table.insert(pass, i, math.random(1, 9))
  133.                             end
  134.                         end
  135.                        
  136.                         keys = {}
  137.                        
  138.                         return
  139.                     end
  140.                    
  141.                     if tr.Entity == nums[i] and dist < 100 and v:KeyPressed(IN_USE) then
  142.                         table.insert(keys, table.maxn(keys) + 1, i)
  143.                        
  144.                         SetGlobalString("keyp" .. #keys, tostring(i))
  145.                        
  146.                         if keys[5] then
  147.                             for c = 1, 4 do SetGlobalString("keyp" .. c, "-") keys = {} end
  148.                         end
  149.                     end
  150.                 end
  151.             end
  152.         end)
  153.        
  154.         keypad:Remove()
  155.     end
  156.    
  157.     spawnKeyPad(Vector(4365, 12937, -10846), Angle(0, 90, 0))
  158.    
  159.     plat[1] = ents.Create("prop_physics")
  160.     plat[1]:SetModel("models/hunter/plates/plate1x8.mdl")
  161.     plat[1]:SetMaterial("models/shiny")
  162.     plat[1]:SetPos(Vector(6750, 9955, -11270))
  163.     plat[1]:SetColor(Color(100, 0, 0))
  164.     plat[1]:SetAngles(Angle(0, 90, 0))
  165.     plat[1]:Spawn()
  166.    
  167.     plat[2] = ents.Create("prop_physics")
  168.     plat[2]:SetModel("models/hunter/plates/plate7x24.mdl")
  169.     plat[2]:SetMaterial("phoenix_storms/stripes")
  170.     plat[2]:SetPos(Vector(4930, 7671, -11040))
  171.     plat[2]:SetAngles(Angle(90, 90, 0))
  172.     plat[2]:Spawn()
  173.    
  174.     plat[3] = ents.Create("prop_physics")
  175.     plat[3]:SetModel("models/hunter/plates/plate3x7.mdl")
  176.     plat[3]:SetMaterial("phoenix_storms/stripes")
  177.     plat[3]:SetPos(Vector(5711, 7981, -10947))
  178.     plat[3]:SetAngles(Angle(90, 0, 0))
  179.     plat[3]:Spawn()
  180.    
  181.     plat[4] = ents.Create("npc_alyx")
  182.     plat[4]:SetPos(Vector(6988, 7746, -11135))
  183.     plat[4]:SetAngles(Angle(0, 90, 0))
  184.     plat[4]:Spawn()
  185.     plat[4]:SetSolid(SOLID_NONE)
  186.    
  187.     plat[5] = ents.Create("prop_physics")
  188.     plat[5]:SetModel("models/hunter/plates/plate7x32.mdl")
  189.     plat[5]:SetMaterial("phoenix_storms/stripes")
  190.     plat[5]:SetPos(Vector(3596, 7671, -11219))
  191.     plat[5]:SetAngles(Angle(90, 90, 0))
  192.     plat[5]:Spawn()
  193.    
  194.     plat[6] = ents.Create("prop_physics")
  195.     plat[6]:SetModel("models/hunter/plates/plate7x32.mdl")
  196.     plat[6]:SetMaterial("phoenix_storms/stripes")
  197.     plat[6]:SetPos(Vector(2521, 7671, -11219))
  198.     plat[6]:SetAngles(Angle(90, 90, 0))
  199.     plat[6]:Spawn()
  200.    
  201.     plat[7] = ents.Create("prop_physics")
  202.     plat[7]:SetModel("models/hunter/plates/plate7x32.mdl")
  203.     plat[7]:SetMaterial("phoenix_storms/stripes")
  204.     plat[7]:SetPos(Vector(2000, 12522, -11143))
  205.     plat[7]:SetAngles(Angle(90, 0, 0))
  206.     plat[7]:Spawn()
  207.    
  208.     plat[8] = ents.Create("prop_physics")
  209.     plat[8]:SetModel("models/hunter/plates/plate7x32.mdl")
  210.     plat[8]:SetMaterial("phoenix_storms/stripes")
  211.     plat[8]:SetPos(Vector(2000, 12522, -10810))
  212.     plat[8]:SetAngles(Angle(90, 0, 0))
  213.     plat[8]:Spawn()
  214.  
  215.     plat[9] = ents.Create("prop_physics")
  216.     plat[9]:SetModel("models/hunter/plates/plate7x32.mdl")
  217.     plat[9]:SetMaterial("phoenix_storms/stripes")
  218.     plat[9]:SetPos(Vector(3596, 7671, -10900))
  219.     plat[9]:SetAngles(Angle(90, 90, 0))
  220.     plat[9]:Spawn()
  221.    
  222.     plat[10] = ents.Create("npc_citizen")
  223.     plat[10]:SetPos(Vector(4392, 12860, -10895))
  224.     plat[10]:SetAngles(Angle(0, 80, 0))
  225.     plat[10]:Spawn()
  226.     plat[10]:SetSolid(SOLID_NONE)
  227.    
  228.     local coords = {}
  229.     local angs = {}
  230.    
  231.     for i = 1, table.maxn(plat) do
  232.         table.insert(coords, i, plat[i]:GetPos())
  233.         table.insert(angs, i, plat[i]:GetAngles())
  234.     end
  235.    
  236.     hook.Add("Think", "checkprops_mg", function()
  237.         if not IsValid(plat[1]) then
  238.             plat[1] = ents.Create("prop_physics")
  239.             plat[1]:SetModel("models/hunter/plates/plate1x8.mdl")
  240.             plat[1]:SetMaterial("models/shiny")
  241.             plat[1]:SetPos(Vector(6750, 9955, -11270))
  242.             plat[1]:SetColor(Color(100, 0, 0))
  243.             plat[1]:SetAngles(Angle(0, 90, 0))
  244.             plat[1]:Spawn()
  245.         end
  246.            
  247.         if not IsValid(plat[2]) then
  248.             plat[2] = ents.Create("prop_physics")
  249.             plat[2]:SetModel("models/hunter/plates/plate7x24.mdl")
  250.             plat[2]:SetMaterial("phoenix_storms/stripes")
  251.             plat[2]:SetPos(Vector(4930, 7671, -11040))
  252.             plat[2]:SetAngles(Angle(90, 90, 0))
  253.             plat[2]:Spawn()
  254.         end
  255.        
  256.         if not IsValid(plat[3]) then
  257.             plat[3] = ents.Create("prop_physics")
  258.             plat[3]:SetModel("models/hunter/plates/plate3x7.mdl")
  259.             plat[3]:SetMaterial("phoenix_storms/stripes")
  260.             plat[3]:SetPos(Vector(5711, 7981, -10947))
  261.             plat[3]:SetAngles(Angle(90, 0, 0))
  262.             plat[3]:Spawn()
  263.         end
  264.        
  265.         if not IsValid(plat[4]) then
  266.             plat[4] = ents.Create("npc_alyx")
  267.             plat[4]:SetPos(Vector(6988, 7746, -11135))
  268.             plat[4]:SetAngles(Angle(0, 90, 0))
  269.             plat[4]:Spawn()
  270.             plat[4]:SetSolid(SOLID_NONE)
  271.         end
  272.        
  273.         if not IsValid(plat[5]) then
  274.             plat[5] = ents.Create("prop_physics")
  275.             plat[5]:SetModel("models/hunter/plates/plate7x32.mdl")
  276.             plat[5]:SetMaterial("phoenix_storms/stripes")
  277.             plat[5]:SetPos(Vector(3596, 7671, -11219))
  278.             plat[5]:SetAngles(Angle(90, 90, 0))
  279.             plat[5]:Spawn()
  280.         end
  281.        
  282.         if not IsValid(plat[6]) then
  283.             plat[6] = ents.Create("prop_physics")
  284.             plat[6]:SetModel("models/hunter/plates/plate7x32.mdl")
  285.             plat[6]:SetMaterial("phoenix_storms/stripes")
  286.             plat[6]:SetPos(Vector(2521, 7671, -11219))
  287.             plat[6]:SetAngles(Angle(90, 90, 0))
  288.             plat[6]:Spawn()
  289.         end
  290.        
  291.         if not IsValid(plat[7]) then
  292.             plat[7] = ents.Create("prop_physics")
  293.             plat[7]:SetModel("models/hunter/plates/plate7x32.mdl")
  294.             plat[7]:SetMaterial("phoenix_storms/stripes")
  295.             plat[7]:SetPos(Vector(2000, 12522, -11143))
  296.             plat[7]:SetAngles(Angle(90, 0, 0))
  297.             plat[7]:Spawn()
  298.         end
  299.        
  300.         if not IsValid(plat[8]) then
  301.             plat[8] = ents.Create("prop_physics")
  302.             plat[8]:SetModel("models/hunter/plates/plate7x32.mdl")
  303.             plat[8]:SetMaterial("phoenix_storms/stripes")
  304.             plat[8]:SetPos(Vector(2000, 12522, -10810))
  305.             plat[8]:SetAngles(Angle(90, 0, 0))
  306.             plat[8]:Spawn()
  307.         end
  308.        
  309.         if not IsValid(plat[9]) then
  310.             plat[9] = ents.Create("prop_physics")
  311.             plat[9]:SetModel("models/hunter/plates/plate7x32.mdl")
  312.             plat[9]:SetMaterial("phoenix_storms/stripes")
  313.             plat[9]:SetPos(Vector(3596, 7671, -10900))
  314.             plat[9]:SetAngles(Angle(90, 90, 0))
  315.             plat[9]:Spawn()
  316.         end
  317.        
  318.         if not IsValid(plat[10]) then
  319.             plat[10] = ents.Create("npc_citizen")
  320.             plat[10]:SetPos(Vector(4392, 12860, -10895))
  321.             plat[10]:SetAngles(Angle(0, 80, 0))
  322.             plat[10]:Spawn()
  323.             plat[10]:SetSolid(SOLID_NONE)
  324.         end
  325.        
  326.         for i = 1, table.maxn(plat) do
  327.             if not plat[i]:IsNPC() then
  328.                 if IsValid(plat[i]:GetPhysicsObject()) then plat[i]:GetPhysicsObject():EnableMotion(false) end
  329.                
  330.                 plat[i]:SetPos(coords[i])
  331.                 plat[i]:SetNotSolid(false)
  332.                 plat[i]:SetSolid(SOLID_VPHYSICS)
  333.                 plat[i]:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE)
  334.                 plat[i]:SetAngles(angs[i])
  335.             else
  336.                 plat[i]:StopMoving()
  337.             end
  338.         end
  339.     end)
  340.    
  341.     for i = 1, 9 do
  342.         ent[i] = ents.Create("prop_physics")
  343.         ent[i]:SetModel("models/hunter/blocks/cube2x2x025.mdl")
  344.         ent[i]:SetMaterial("models/shiny")
  345.         ent[i]:SetPos(vec[i])
  346.         ent[i]:SetColor(cols[i])
  347.         ent[i]:SetAngles(Angle(0, 90, 0))
  348.         ent[i]:Spawn()
  349.         govno[i] = false
  350.        
  351.         hook.Add("Think", "minigame_thent"..i, function()
  352.             if ent[i] and IsValid(ent[i]) then
  353.                 if not govno[i] then
  354.                     ent[i]:GetPhysicsObject():EnableMotion(false)
  355.                 end
  356.             else
  357.                 ent[i] = ents.Create("prop_physics")
  358.                 ent[i]:SetModel("models/hunter/blocks/cube2x2x025.mdl")
  359.                 ent[i]:SetMaterial("models/shiny")
  360.                 ent[i]:SetPos(vec[i])
  361.                 ent[i]:SetColor(cols[i])
  362.                 ent[i]:SetAngles(Angle(0, 90, 0))
  363.                 ent[i]:Spawn()
  364.             end
  365.         end)
  366.     end
  367.    
  368.     timer.Create("minigame_timer", 4, 0, function()
  369.         for p = 1, math.random(1, 5) do
  370.             local rand = math.random(1, 9)
  371.             govno[rand] = true
  372.             ent[rand]:GetPhysicsObject():EnableMotion(true)
  373.             ent[rand]:GetPhysicsObject():ApplyForceCenter(Vector(0, 0, -60))
  374.            
  375.             timer.Simple(3, function()
  376.                 ent[rand]:Remove()
  377.                 govno[rand] = false
  378.             end)
  379.         end
  380.     end)
  381. end
  382.  
  383. if CLIENT then
  384.     hook.Add("PostDrawOpaqueRenderables", "nadpisvremya", function()
  385.         cam.Start3D2D(Vector(6990, 7697, -11020), Angle(0, 180, 90), 0.4)
  386.             draw.DrawText(string.sub(os.date(), 9), "super", 0, 0, Color(0, 255, 0), TEXT_ALIGN_CENTER)
  387.         cam.End3D2D()
  388.        
  389.         cam.Start3D2D(Vector(4365, 12933, -10848), Angle(0, 90, 90), 0.02)
  390.             draw.RoundedBox(6, 0, -500, 420, 150, Color(0, 0, 0, 200))
  391.            
  392.             for i = 1, 4 do
  393.                 draw.DrawText(GetGlobalString("keyp" .. i) or "n", "super", i * 80, -500, Color(0, 255, 0), TEXT_ALIGN_CENTER)
  394.             end
  395.            
  396.             draw.DrawText("Чтобы сбежать из тюрьмы отгадайте пароль (из 4 символов)", "super", 0, -660, Color(0, 255, 0), TEXT_ALIGN_CENTER)
  397.         cam.End3D2D()
  398.        
  399.         cam.Start3D2D(Vector(4367, 12927, -10843), Angle(0, 90, 90), 0.02)
  400.             for i = 1, 3 do
  401.                 draw.DrawText(i, "super", i * 250, 0, Color(0, 255, 0), TEXT_ALIGN_CENTER)
  402.             end
  403.            
  404.             for i = 1, 3 do
  405.                 draw.DrawText(i + 3, "super", i * 250, 250, Color(0, 255, 0), TEXT_ALIGN_CENTER)
  406.             end
  407.            
  408.             for i = 1, 3 do
  409.                 draw.DrawText(i + 6, "super", i * 250, 500, Color(0, 255, 0), TEXT_ALIGN_CENTER)
  410.             end
  411.         cam.End3D2D()
  412.     end)
  413. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement