Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1.  
  2. AddCSLuaFile()
  3.  
  4.  
  5. if SERVER then
  6.    
  7. end
  8.  
  9. if CLIENT then
  10.    
  11. end
  12.  
  13. function SWEP:PrimaryAttack
  14.     if score = 1 then
  15.       self.Weapon:SetNextPrimaryFire( CurTime() + 20 )
  16.       self:SpawnDrone1( "dronesrewrite_medic" )
  17.    
  18.     elseif score = 2 then
  19.       self.Weapon:SetNextPrimaryFire( CurTime() + 20 )
  20.       self:SpawnDrone1( "dronesrewrite_balltur" )
  21. end
  22.  
  23. local score = 0
  24. function SWEP:SecondaryAttack()
  25. score.add( 1 )
  26.  
  27. end
  28.  
  29.  
  30. function SWEP:SpawnDrone1( model_file )
  31.  
  32.    
  33.     self:EmitSound( ShootSound )
  34.  
  35.  
  36.  
  37.     if ( CLIENT ) then return end
  38.  
  39.    
  40.     local ent = ents.Create( "prop_physics" )
  41.  
  42.    
  43.     if ( !IsValid( ent ) ) then return end
  44.  
  45.    
  46.     ent:SetModel( model_file )
  47.  
  48.    
  49.     ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) )
  50.     ent:SetAngles( self.Owner:EyeAngles() )
  51.     ent:Spawn()
  52.  
  53.  
  54.  
  55.     local phys = ent:GetPhysicsObject()
  56.     if ( !IsValid( phys ) ) then ent:Remove() return end
  57.  
  58.  
  59.  
  60.    
  61.  
  62.    
  63.     cleanup.Add( self.Owner, "props", ent )
  64.  
  65.     undo.Create( "Drone" )
  66.         undo.AddEntity( ent )
  67.         undo.SetPlayer( self.Owner )
  68.     undo.Finish()
  69.  
  70. SWEP.Author = "Corn Hub"
  71. SWEP.Purpose = "Custom for TheTrueDragonAce's server."
  72. SWEP.Instructions = "Left click to spawn selected drone, Right click to change through drones."
  73. SWEP.Category = "Deception"
  74. SWEP.Spawnable = true
  75.  
  76.  
  77. SWEP.ViewModel = "models/weapons/v_RPG.mdl"
  78. SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl"
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement