Advertisement
CapsAdmin

Untitled

May 5th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.68 KB | None | 0 0
  1. function SWEP:Deploy()
  2.  
  3.     if SERVER then
  4.         self.Owner:DrawViewModel(false)
  5.     end
  6.    
  7.     if CLIENT then
  8.         if game.SinglePlayer() then
  9.             chat.AddText(Color(255,255,255), ply, "총 안보이는게 정상입니다.")
  10.             chat.AddText(Color(255,0,0), ply, "싱글 플레이 상태입니다. 광고가 보이지 않습니다.")
  11.         else
  12.             chat.AddText(Color(255,255,255), ply, "총 안보이는게 정상입니다.")
  13.         end
  14.     end
  15.    
  16. end
  17.  
  18. if CLIENT then
  19.  
  20.     local speed = 1 -- speed multiplier
  21.     local pow = 2 -- This will make the sine curve shaper if you think it'S too smooth. Normal is 1
  22.  
  23.     local tex_cafe = surface.GetTextureID("ending/cafebene")
  24.     local tex_ivy  = surface.GetTextureID("ending/ivyclub")
  25.     local tex_afreeca = surface.GetTextureID("ending/afreecatv")
  26.     local tex_afreeca2 = surface.GetTextureID("ending/afreecatv2")
  27.  
  28.     local function draw_texture(tex)
  29.         surface.SetTexture(tex)
  30.         surface.SetDrawColor (255, 255, 255, 255)
  31.         surface.DrawTexturedRect(W /2 - 70, H -166, 256, 85)
  32.     end
  33.    
  34.    
  35.     -- time starts from 0 counts up.
  36.     function SWEP:DoEffects(time)
  37.        
  38.         time = time * speed
  39.        
  40.         local F = math.sin(time) ^ pow
  41.         local W, H = ScrW(), ScrH()
  42.  
  43.         surface.SetFont("ProduceSupport")      
  44.         surface.SetTextPos(W /2 - 190, H -140)
  45.         surface.SetTextColor(255, 255, 255, 255)
  46.         surface.DrawText("제작지원")
  47.        
  48.         -- I don't know if this order is correct..
  49.        
  50.         if time < 0.25 then
  51.             draw_texture(tex_cafe)
  52.         elseif time < 0.5 then
  53.             draw_texture(tex_ivy)
  54.         elseif time < 0.75 then
  55.             draw_texture(tex_afreeca)
  56.         elseif time < 0.8 then 
  57.             draw_texture(tex_afreeca2)
  58.         end
  59.        
  60.         local params = {}
  61.  
  62.             params["$pp_colour_addr"] = 0
  63.             params["$pp_colour_addg"] = 0
  64.             params["$pp_colour_addb"] = 0
  65.             params["$pp_colour_brightness"] = F
  66.             params["$pp_colour_contrast"] = 1
  67.             params["$pp_colour_colour"] = F
  68.             params["$pp_colour_mulr"] = 0
  69.             params["$pp_colour_mulg"] = 0
  70.             params["$pp_colour_mulb"] = 0
  71.        
  72.         DrawColorModify(params)
  73.  
  74.         -- add alpha, draw alpha, delay
  75.         DrawMotionBlur(0.8, 0.95, 0)
  76.        
  77.         DrawBloom(
  78.             0, -- darken
  79.             1, -- multiply
  80.             2, -- sizex
  81.             2, -- sizey
  82.             3, -- passes
  83.            
  84.             1, -- red multiplier
  85.             1, -- green multiplier
  86.             1 -- blue multiplier
  87.            
  88.         )
  89.        
  90.         if F < 0 then
  91.             return false
  92.         end
  93.     end
  94. end
  95.  
  96. if SERVER then
  97.     function SWEP:DoEffects(time)
  98.        
  99.         -- setting it lower than 0.25 might cause the game  to run into issues
  100.         game.SetTimeScale(math.Clamp(time, 0.25, 1))
  101.     end
  102. end
  103.  
  104. function SWEP:PrimaryAttack()
  105.  
  106.     if not self:CanPrimaryAttack() then return end
  107.    
  108.     local owner = self.Owner
  109.    
  110.     local bullet = {}
  111.         bullet.Num = self.Primary.NumberofShots -- is this correct? (lower case "of")
  112.         bullet.Src = owner:GetShootPos()
  113.         bullet.Dir = owner:GetAimVector()
  114.         bullet.Spread = Vector(1, 1, 0) * self.Primary.Spread * 0.1
  115.         bullet.Tracer = 0
  116.         bullet.Force = self.Primary.Force
  117.         bullet.Damage = self.Primary.Damage
  118.         bullet.AmmoType = self.Primary.Ammo
  119.  
  120.     local recoil = self.Primary.Recoil
  121.    
  122.     owner:FireBullets(bullet)
  123.     owner:ViewPunch(Angle(recoil * -1, recoil * math.Rand(-1, 1), recoil * -1))
  124.     self:TakePrimaryAmmo(self.Primary.TakeAmmo)
  125.    
  126.     self:ShootEffects()
  127.     self:EmitSound(self.Primary.Sound)
  128.    
  129.     if not self.pp_start then
  130.         self.pp_start = UnPredictedCurTime()
  131.                    
  132.         local event = CLIENT and "RenderScreenspaceEffects" or "Think"
  133.  
  134.         hook.Add(name, tostring(self), function()
  135.             if
  136.                 not self:IsValid() or
  137.                 not self:GetOwner():IsValid() or
  138.                 self:GetOwner():GetActiveWeapon() ~= self or
  139.                 self:DoEffects(UnPredictedCurTime() - self.pp_start) ~= false
  140.             then
  141.                 hook.Remove(name, tostring(self))
  142.             end
  143.         end)
  144.     end
  145.  
  146.     self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
  147. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement