Advertisement
Guest User

bug in addons

a guest
Nov 14th, 2019
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. -----------------------------------------------------------------------------------------------------
  2. -- Config section here
  3. -- Features
  4. SWEP.AllowDamage = false -- Should a player be able to inflict damage at all?
  5. SWEP.GiveWeaponsBack = true -- Should the player get the weapons he had back after he is revived? (Will spawn with default weps)
  6. SWEP.DeathBeepEnabled = true -- Should a player hear a flat tone when they die?
  7. SWEP.GiveMedicRPCash = 100 -- How much cash should a medic receive upon reviving someone? Set to 0 to disable.
  8. SWEP.ReviveHeartMedicsOnly = false -- Should only people with SWEP equipped see the heart or every player?
  9.  
  10. -- Settings (will not take effect if feature is disabled)
  11. SWEP.DeathSound = "HL1/fvox/flatline.wav" -- Sound the player hears when they die (DeathBeep)
  12. SWEP.Damage = 20 -- Damage the swep does when using for self-defense
  13. SWEP.HPAfterRespawn = 70 -- HP the revived player will have after being revived
  14. SWEP.TimeToRevive = 200 -- How many seconds should players be dead for before they can not be revived?
  15. SWEP.ChargeTime = 12 -- How many seconds should charging the paddle keep a charge for?
  16. SWEP.GhostTime = 5 -- How long should players be ghosted for upon revival? (No collision with players)
  17. SWEP.ReviveDistance = 80 -- How far should a medic be able to revive a player?
  18. SWEP.ReviveHeartDistance = 12000 -- How far should someone be from a ragdoll to see the revive heart picture?
  19. SWEP.HitDistance = 100 -- How far should a medic be from a player to damage another player?
  20. SWEP.reviveCashTimeout = 120 -- The amount of seconds a medic will not receive money for reviving the same player
  21. local disableRespawnTime = 50 -- How long to disallow a player from respawning for, leave at 0 to disable
  22. SWEP.respawnPlayerOnJobChange = false -- Should the player respawn when they change job?
  23. -- IMPORTANT: If the above setting is true, you MUST set GM.Config.norespawn to false inside of darkrpmodification/settings.lua
  24. -- These are the settings for the text users will see if disableRespawnTime is not 0.
  25. SWEP.enableRespawnText = true
  26. SWEP.respawnWaitText = "Vous devez attendre %d secondes ou vous faire réanimer." -- This MUST have %d in it. %d is the time left for respawn.
  27. SWEP.respawnFont = "Trebuchet24" -- This is the font for the respawn text.
  28. SWEP.textXPos = -1 -- X position for the respawn text. If -1, it will be in the middle of the screen.
  29. SWEP.textYPos = -1 -- Y position for the respawn text. If -1, it will be in the middle of the screen.
  30. SWEP.textColor = Color(255, 255, 255, 255) -- The color for the respawn text.
  31. -- END CONFIG
  32. -----------------------------------------------------------------------------------------------------
  33. SWEP.Instructions = "Clique gauche pour défibriler"
  34. SWEP.UseHands = true
  35. SWEP.Spawnable = true
  36. SWEP.AdminSpawnable = true
  37. SWEP.Category = "CustomHQ"
  38. SWEP.ViewModelFOV = 62
  39. SWEP.AnimPrefix = "rpg"
  40. SWEP.Primary.Damage = 0
  41. SWEP.Primary.ClipSize = -1
  42. SWEP.Primary.DefaultClip = 1
  43. SWEP.Primary.Automatic = false
  44. SWEP.Primary.Ammo = "none"
  45. SWEP.Secondary.ClipSize = -1
  46. SWEP.Secondary.DefaultClip = 1
  47. SWEP.Secondary.Automatic = false
  48. SWEP.Secondary.Ammo = "none"
  49. SWEP.WorldModel = Model("models/weapons/custom/w_defib.mdl")
  50. SWEP.ViewModel = Model("models/weapons/custom/v_defib.mdl")
  51. SWEP.PrintName = "Defibrilateur"
  52. SWEP.Author = "CustomHQ"
  53. SWEP.Slot = 2
  54. SWEP.SlotPos = 1
  55. SWEP.CanUse = 0
  56. SWEP.disableRespawnTime = disableRespawnTime
  57. util.PrecacheModel("models/weapons/custom/defib2")
  58. if SERVER then
  59. function makefx(ent, pos, fx, ply, broadcast)
  60. net.Start("defibfx")
  61. net.WriteEntity(ent)
  62. net.WriteVector(pos)
  63. net.WriteString(fx)
  64. net.WriteEntity(ply)
  65. if broadcast then net.Broadcast()
  66. else net.Send(ply) end
  67. end
  68. util.AddNetworkString("defibfx")
  69. util.AddNetworkString("defibgetents")
  70. util.AddNetworkString("defibgiveents")
  71. resource.AddWorkshop("824479456")
  72. AddCSLuaFile("cl_init.lua")
  73. include("sv_init.lua")
  74. function SWEP:OnDrop() self:makefxN("decharge") end
  75. function SWEP:OnRemove() self:makefxN("decharge") end
  76. function DisableImmRespawn(ply)
  77. if (ply.CustomHQSpawnTimer == nil) then return end
  78. if (ply.CustomHQLastTeamChange == nil) then ply.CustomHQLastTeamChange = 0 end
  79. if ply.CustomHQSpawnTimer+disableRespawnTime > CurTime() and ply.CustomHQLastTeamChange+15 < CurTime() then
  80. return false
  81. end
  82. end
  83. function SetPlayerTime(ply)
  84. ply.CustomHQSpawnTimer = CurTime()
  85. end
  86. if disableRespawnTime != 0 then
  87. hook.Add("PostPlayerDeath", "stopfalcosimmrespawn", SetPlayerTime)
  88. hook.Add("PlayerDeathThink", "stopfalcozimmrespawn", DisableImmRespawn)
  89. end
  90. end
  91. function shouldveaddedthisbefore(ply, before, after)
  92. if SERVER then
  93. local globalwep = weapons.GetStored("weapon_defibrillator")
  94. ply.CustomHQLastTeamChange = CurTime()
  95. if globalwep != nil and globalwep.respawnPlayerOnJobChange then
  96. ply:Spawn()
  97. end
  98. end
  99. ply.TimeDied = CurTime()
  100. end
  101. hook.Add("OnPlayerChangedTeam", "defibfalcoteamchangegoddammit", shouldveaddedthisbefore)
  102. function SWEP:makefxN(type) makefx(self.Owner, Vector(0, 0, 0), type, self.Owner, false) end
  103. --it's clientside location, need to talk with client and gmod makes that a pain in ass (afaik)
  104. function SWEP:PrimaryAttack()
  105. if CLIENT or CurTime() > self.CanUse then return end
  106. net.Start("defibgetents")
  107. net.Send(self.Owner)
  108. end
  109. function SWEP:SecondaryAttack()
  110. if CLIENT or CurTime() <= self.CanUse then return end
  111. --double animation because GMod is broken and doesn't play anims properly, hack around it
  112. self:SendWeaponAnim(ACT_VM_IDLE)
  113. timer.Simple(0.16, function() if IsValid(self) then self:SendWeaponAnim(ACT_VM_SECONDARYATTACK) end end)
  114. self:SetNextSecondaryFire(CurTime()+self.ChargeTime+2)
  115. timer.Simple(.9, function()
  116. if !IsValid(self.Owner) or !IsValid(self) then return end
  117. self.Owner:EmitSound("buttons/button1.wav", 50)
  118. self.CanUse = CurTime() + self.ChargeTime
  119. self:makefxN("charge")
  120. end)
  121. end
  122. function SWEP:Initialize()
  123. self:SetHoldType("knife")
  124. end
  125. function SWEP:Deploy()
  126. self.CanUse = 0
  127. return true
  128. end
  129. function SWEP:Holster()
  130. if SERVER then self:makefxN("decharge") end
  131. return true
  132. end
  133. function SWEP:Reload() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement