Advertisement
Guest User

init.lua

a guest
Dec 6th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.16 KB | None | 0 0
  1. AddCSLuaFile("cl_init.lua")
  2. AddCSLuaFile("shared.lua")
  3.  
  4. include("shared.lua")
  5.  
  6. util.AddNetworkString("BombDefuseStart")
  7. util.AddNetworkString("Fuse")
  8. util.AddNetworkString("beep")
  9. util.AddNetworkString("BombDefuseSuccess")
  10. util.AddNetworkString("BombDefuseFail")
  11.  
  12. function ENT:Initialize()
  13.  
  14.     self:SetModel("models/Combine_Helicopter/helicopter_bomb01.mdl")
  15.     self:PhysicsInit(SOLID_VPHYSICS)
  16.     self:SetMoveType(MOVETYPE_VPHYSICS)
  17.     self:SetSolid(SOLID_VPHYSICS)
  18.     self:SetUseType(SIMPLE_USE)
  19.  
  20.     local phys = self:GetPhysicsObject()
  21.  
  22.     if phys:IsValid() then phys:Wake() end
  23.  
  24.     local BombInitialPosition = self:GetPos()
  25.     print(BombInitialPosition)
  26.  
  27.     function bombRemove()
  28.         print("Removed a bomb.")
  29.         self:Remove()
  30.     end
  31.  
  32.      isBombFused = false
  33.  
  34. end
  35.  
  36.  
  37. --explode function to be called later
  38.     function BombExplode(me)
  39.        
  40.                 --the actual explosion part
  41.  
  42.                 util.BlastDamage(me,me, BombInitialPosition, 2500, 700)
  43.  
  44.  
  45.                     local explosioneffect = EffectData()
  46.                         explosioneffect:SetScale(15)
  47.                         explosioneffect:SetOrigin(BombInitialPosition)
  48.  
  49.                     local explosioneffect2 = EffectData()
  50.                         explosioneffect2:SetScale(17)
  51.                         explosioneffect2:SetOrigin(BombInitialPosition)
  52.  
  53.                 util.Effect("Explosion", explosioneffect)
  54.                 util.Effect("RPGShotDown", explosioneffect2)   
  55.  
  56.                 bombRemove()       
  57.  
  58.         end --end of explode function
  59.  
  60.  
  61. function ENT:Use(ply,c)
  62.    
  63.     if isBombFused == false then
  64.         BombStart()
  65.     else
  66.         net.Start("BombDefuseStart")
  67.         net.Send(ply)
  68.     end
  69.  
  70.  
  71. end
  72.  
  73.  
  74. function BombStart()
  75.     printedTime = BombFuseTimer
  76.     timer.Create("Fuse timer", 1, BombFuseTimer, BombTick())
  77.  
  78.     BombExplode()
  79.  
  80. end
  81.  
  82.  
  83. function BombTick()
  84.  
  85.    
  86.     print(printedTime)
  87.     printedTime = printedTime - 1
  88.  
  89. end
  90.  
  91.  
  92.  
  93.  
  94. net.Receive("DefuseSuccess", function(len,ply)
  95.  
  96.     PrintMessage(HUD_PRINTTALK,ply:Nick().." has successfully defused a bomb!!!")
  97.     bombRemove()
  98.  
  99. end)
  100.  
  101. net.Receive("DefuseFail", function(len,ply)
  102.  
  103.     PrintMessage(HUD_PRINTTALK,ply:Nick().." has cut the wrong wire and detonated a bomb!")
  104.     BombExplode(ply)
  105.  
  106.  
  107. end)
  108.  
  109. net.Receive("BombStart", BombStart())
  110.  
  111. function ENT:SetupDataTables()
  112.  
  113.     //??????
  114.  
  115.  
  116.  
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement