Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. AddCSLuaFile( "cl_init.lua" )
  2. AddCSLuaFile( "shared.lua" )
  3.  
  4. include( "shared.lua" )
  5.  
  6. function ENT:Initialize()
  7.  
  8. if ( SERVER ) then
  9. local phys, attach, pos, ang, seat
  10. self:SetModel( "models/Effects/combineball.mdl" )
  11. self:SetColor(Color(0,0,0,0))
  12. self:SetRenderMode( RENDERMODE_TRANSALPHA )
  13.  
  14. local now = CurTime() - 120
  15.  
  16. pos = self:GetPos( )
  17. ang = self:GetAngles( )
  18.  
  19. ang:RotateAroundAxis( ang:Up( ), 180 )
  20.  
  21. self.Veh = ents.Create( "prop_vehicle_prisoner_pod" )
  22. self.Veh:SetPos( pos )
  23. self.Veh:SetModel( "models/nova/airboat_seat.mdl" )
  24. self.Veh:SetKeyValue( "vehiclescript", "scripts/vehicles/prisoner_pod.txt" )
  25. self.Veh:SetKeyValue( "LimitView", "60" )
  26. self.Veh.HandleAnimation = function( v, p ) return p:SelectWeightedSequence( ACT_GMOD_SIT_ROLLERCOASTER ) end
  27. self.Veh:SetAngles( ang )
  28. self.Veh:Spawn( )
  29.  
  30. self.Veh:DeleteOnRemove( self )
  31.  
  32. // This Table and spawnsystem from Neuro cars. ThankU all!
  33. // Passenger Seats - Gunners
  34. self.MountedGuns = {}
  35. local mgpos,mgang = {},{},{},{}
  36.  
  37. // Gunner
  38.  
  39. // Mounted gun pos
  40. mgpos[1] = Vector( 0, 25, 15 )
  41.  
  42. // Mounted gun angles
  43. mgang[1] = Angle( 0, 90, 0 )
  44.  
  45. for i=1,1 do
  46. self.MountedGuns[i] = ents.Create( "prop_physics_override" )
  47. self.MountedGuns[i]:SetPos( self.Veh:LocalToWorld( mgpos[i] ) )
  48. self.MountedGuns[i]:SetAngles( self.Veh:GetAngles() + mgang[i] )
  49. self.MountedGuns[i]:SetModel( "models/Airboatgun.mdl" )
  50. self.MountedGuns[i]:SetParent( self.Veh )
  51. self.MountedGuns[i]:SetSolid( SOLID_NONE )
  52. self.MountedGuns[i].LastAttack = now
  53. self.MountedGuns[i]:Spawn()
  54. self.Veh.MountedWeapon = self.MountedGuns[i]
  55. end
  56. end
  57. end
  58.  
  59. function ENT:Think( )
  60. if ( SERVER ) then
  61.  
  62. timer.Create("FUK_KYU_S_HOL"..self.Entity:EntIndex(), 0.01, 50, function()
  63. if not self:IsValid() then return end
  64.  
  65. local seat
  66. local gunner
  67. local wep
  68. // Gunners
  69. for i=1,1 do
  70.  
  71. seat = self.Veh
  72. gunner = seat:GetDriver()
  73. wep = seat.MountedWeapon
  74.  
  75. if( IsValid( seat ) && IsValid( gunner ) && IsValid( wep ) ) then
  76.  
  77. local ang = gunner:EyeAngles()
  78.  
  79. if ( gunner:KeyDown( IN_ATTACK ) && wep.LastAttack + .06 <= CurTime() ) then
  80.  
  81. ang = ang + Angle( math.Rand(-.8,.8), math.Rand(-.8,.8), 0 )
  82.  
  83. local bullet = {}
  84. bullet.Num = 1
  85. bullet.Src = wep:GetPos() + wep:GetForward() * 55
  86. bullet.Dir = wep:GetAngles():Forward() // Dir of bullet
  87. bullet.Spread = Vector( .03, .03, .03 ) // Aim Cone
  88. bullet.Tracer = 1 // Show a tracer on every x bullets
  89. bullet.Force = 0 // Amount of force to give to phys objects
  90. bullet.Damage = 0
  91. bullet.AmmoType = "Ar2"
  92. bullet.Attacker = gunner
  93. bullet.TracerName = "AirboatGunHeavyTracer"
  94. bullet.Callback = function ( a, b, c )
  95. util.BlastDamage( gunner, gunner, b.HitPos, 70, 25 )
  96. return { damage = true, effects = DoDefaultEffect }
  97. end
  98.  
  99. wep:FireBullets( bullet )
  100. wep:EmitSound( "npc/turret_floor/shoot"..math.random(2,3)..".wav", 400, 60 )
  101.  
  102. local e = EffectData()
  103. e:SetStart( wep:GetPos()+wep:GetForward() * 62 )
  104. e:SetOrigin( wep:GetPos()+wep:GetForward() * 62 )
  105. e:SetEntity( wep )
  106. e:SetAttachment(1)
  107. util.Effect( "ChopperMuzzleFlash", e )
  108.  
  109. wep.LastAttack = CurTime() + 0.05
  110.  
  111. end
  112. wep:SetAngles( ang )
  113. end
  114. end
  115. end)
  116. end
  117. end
  118.  
  119. function ENT:Use( pl )
  120. end
  121.  
  122. function ENT:SpawnFunction( ply, tr )
  123.  
  124. if ( !tr.Hit ) then return end
  125.  
  126. local SpawnPos = tr.HitPos + tr.HitNormal * 100
  127.  
  128. local ent = ents.Create("weldable_seat1")
  129. ent:SetPos( SpawnPos )
  130. ent:Spawn()
  131. ent:Activate()
  132.  
  133. return ent
  134.  
  135. end
  136.  
  137. function ENT:OnRemove()
  138. if SERVER then
  139. self.Veh:Remove()
  140. self:Remove()
  141. end
  142. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement