Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1.  
  2. --#NoSimplerr#
  3.  
  4. //////////////////////////////////////////////////////////////////////////////////////////////////////
  5. //////////////////////////////////////////////////////////////////////////////////////////////////////
  6. local Bossfight_ON = false
  7. local BossTable = {}
  8. local BossPlayers = {}
  9. local BossConfig = {}
  10. local BossAmount = 0
  11. //////////////////////////////////////////////////////////////////////////////////////////////////////
  12. // DO NOT TOUCH THE ABOVE EVERYTHING BELOW IS YOUR CONFIG
  13. //////////////////////////////////////////////////////////////////////////////////////////////////////
  14.  
  15. BossConfig.RandomEvenTimerDelay = 300 // How long in seconds for the timer to show??
  16.  
  17. BossConfig.QuestionTimerExecute = 60 // How long do players have to press "Yes/No" on the question
  18.  
  19. BossConfig.Weapons = "m9k_acr" // Weapon to give for the battle
  20.  
  21. BossConfig.AmmoType = "ar" // The ammo type
  22.  
  23. BossConfig.AmmoAmount = 500 // The amount of ammo
  24.  
  25. ///////////////////////////////////////////////////
  26. // setup boss spawn
  27. ///////////////////////////////////////////////////
  28.  
  29. BossConfig.BossSpawnLocation = {
  30.  
  31. Location = Vector( -6003.359375, -8062.643555, 128.025848 ),
  32.  
  33. Rotation = Angle( 0, -90, 0 ),
  34.  
  35. }
  36.  
  37. ///////////////////////////////////////////////////
  38. // setup player spawn
  39. ///////////////////////////////////////////////////
  40.  
  41. BossConfig.RandomBossLocations = {
  42.  
  43. [1] = {
  44. Location = Vector( -6198.959473, -8925.958984, 128.031250 ),
  45. Rotation = Angle( 0, 90, 0 ),
  46. },
  47.  
  48. [2] = {
  49. Location = Vector( -6055.904297, -8931.146484, 128.031250 ),
  50. Rotation = Angle( 0, 90, 0 ),
  51. },
  52.  
  53. [3] = {
  54. Location = Vector( -5933.400391, -8935.567383, 128.031250 ),
  55. Rotation = Angle( 0, 90, 0 ),
  56. },
  57.  
  58. }
  59.  
  60. ///////////////////////////////////////////////////
  61. // boss setup
  62. ///////////////////////////////////////////////////
  63.  
  64. BossConfig.BossFights = {
  65.  
  66. [1] = {
  67. Name = "Gwyn", // The boss name to print into chat
  68. BossEntity = "npc_vj_ds_gwyn", // The boss Entity(number entityIndex)
  69. Health = 10000, // Their HP
  70. XP_Gain = 2000, // XP Gain
  71. RP_Cash = 10000, // Kill Ammount
  72. NumberOfBoss = 1, // How many do we spawn
  73. },
  74.  
  75. [2] = {
  76. Name = "Ornstein",
  77. BossEntity = "npc_vj_ds_ornstein",
  78. Health = 10000,
  79. XP_Gain = 3000,
  80. RP_Cash = 10000,
  81. NumberOfBoss = 2,
  82. }
  83.  
  84. }
  85.  
  86. ///////////////////////////////////////////////////
  87. // server code below
  88. ///////////////////////////////////////////////////
  89.  
  90. local function BossKilled( npc, killer )
  91.  
  92. if Bossfight_ON && npc:GetClass() == BossTable.BossEntity then
  93.  
  94. if IsValid(killer) then
  95. killer:addMoney( BossTable.RP_Cash )
  96. DarkRP.notify( killer, 2, 6, "You have received " .. BossTable.RP_Cash .. " XP for participating in the boss fight!" )
  97. DarkRP.notify( killer, 2, 6, "You have received " .. DarkRP.formatMoney( BossTable.XP_Gain ) .. " for participating in the boss fight!" )
  98. end
  99.  
  100. // These hooks handle our event, make sure to rid of them when the boss dies
  101. hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
  102. hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
  103. hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
  104.  
  105. BossTable = {} // Empty our boss selection
  106. BossPlayers = {} // Empty our table
  107. Bossfight_ON = false
  108.  
  109. end
  110.  
  111. end
  112.  
  113. local function BossThink( npc, killer )
  114.  
  115. if Bossfight_ON then
  116.  
  117. if #BossPlayers == 0 then
  118.  
  119. Bossfight_ON = false
  120. DarkRP.notifyAll( 1, 5, "The boss fight has ended!" )
  121.  
  122. // These hooks handle our event, make sure to rid of them when the boss dies
  123. hook.Remove("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight" )
  124. hook.Remove("Think", "RP.BossFights.CheckIfAllAreGone" )
  125. hook.Remove("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn" )
  126.  
  127. end
  128.  
  129. end
  130.  
  131. end
  132.  
  133. local function PlayerSpawnBoss( ply )
  134. if Bossfight_ON && ply.BossFightSpawn then
  135. timer.Simple( 0, function()
  136. ply:SetPos( ply.BossFightSpawn )
  137. end )
  138. end
  139. end
  140.  
  141.  
  142. local function doBossFight()
  143.  
  144. if #BossPlayers == 0 then
  145. DarkRP.notifyAll( 1, 5, "No one entered the boss fight!" )
  146. return
  147. end
  148.  
  149. local NPC_ENT = ents.Create( BossTable.BossEntity )
  150. NPC_ENT:SetHealth( BossTable.Health )
  151. NPC_ENT:SetPos( BossConfig.BossSpawnLocation.Location )
  152. NPC_ENT:SetAngles( BossConfig.BossSpawnLocation.Rotation )
  153. NPC_ENT:Spawn()
  154. Bossfight_ON = true
  155.  
  156. for k, v in pairs( BossPlayers ) do
  157.  
  158. v:ChatPrint( tostring(v) )
  159. v.BossFightSpawn = BossConfig.RandomBossLocations[v:EntIndex()].Location
  160. v:SetPos( v.BossFightSpawn )
  161. v:StripWeapons()
  162. v:Give( BossConfig.Weapons )
  163. for i = 1, 3 do
  164. v:GiveAmmo( BossConfig.AmmoAmount, BossConfig.AmmoType, false )
  165. end
  166.  
  167. end
  168.  
  169. hook.Add("OnNPCKilled", "RP.BoosFights.OnNPCKilledFight", BossKilled )
  170. hook.Add("PlayerSpawn", "RP.BossFight.PlayerDiedSpawn", PlayerSpawnBoss )
  171. hook.Add("Think", "RP.BossFights.CheckIfAllAreGone", BossThink )
  172.  
  173. end
  174.  
  175. local function doBossFightQuestion(answer, player, initiator, target, Trigger)
  176.  
  177. if tobool(answer) && !BossPlayers[player:EntIndex()] && ( #BossPlayers != #BossConfig.RandomBossLocations ) then
  178.  
  179. BossPlayers[player:EntIndex()] = player
  180. player:ChatPrint("You have entered the fight!")
  181.  
  182. elseif answer ~= nil and !BossPlayers[player:EntIndex()] or ( #BossPlayers == #BossConfig.RandomBossLocations ) then
  183.  
  184. BossPlayers[player:EntIndex()] = nil // Possible fall back to possible future bullshit
  185. player:ChatPrint("You have chosen not to fight!")
  186. end
  187.  
  188.  
  189. if tobool( Trigger ) then
  190.  
  191. doBossFight()
  192.  
  193. end
  194.  
  195. end
  196.  
  197. local function questionEnterBossFight()
  198.  
  199. BossTable = BossConfig.BossFights[math.random(#BossConfig.BossFights)]
  200. BossAmount = BossTable.NumberOfBoss // How many are we spawning?
  201.  
  202. for k, v in pairs( player.GetAll() ) do
  203.  
  204. v:ChatPrint( "Boss: " .. BossTable.Name )
  205. v:ChatPrint( "Cash Reward: " .. DarkRP.formatMoney( BossTable.RP_Cash ) )
  206. v:ChatPrint( "XP Gain: " .. BossTable.XP_Gain )
  207.  
  208. DarkRP.createQuestion("Enter Boss Fight?", "rp.boosfights_", v, BossConfig.QuestionTimerExecute or 15, doBossFightQuestion, nil, nil)
  209.  
  210. end
  211.  
  212. timer.Create("BossFights_RP", BossConfig.QuestionTimerExecute or 15, 1, function() doBossFightQuestion( nil, nil, nil, nil, true ) end)
  213.  
  214. end
  215.  
  216. timer.Create("RP.BoosFights.CheckQuestion", BossConfig.RandomEvenTimerDelay or 5, 1, function()
  217. questionEnterBossFight()
  218. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement