Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.12 KB | None | 0 0
  1. --include("classdata.lua")
  2. --AddCSLuaFile( "autorun/client/cl_classmod.lua" )
  3.  
  4.  
  5. CreateConVar("bur_class_walkspeed", "200", FCVAR_REPLICATED + FCVAR_NOTIFY + FCVAR_ARCHIVE , "Changes the walkspeed. Default walkspeed is 250." )
  6. CreateConVar("bur_class_runspeed", "400", FCVAR_REPLICATED + FCVAR_NOTIFY + FCVAR_ARCHIVE , "Changes the runspeed. Default walkspeed is 500." )
  7. CreateConVar("bur_class_jumppower", "200", FCVAR_REPLICATED + FCVAR_NOTIFY + FCVAR_ARCHIVE , "Changes the jumping power. Default jumppower is 200." )
  8.  
  9.  
  10. function ChangeClass( ply, cmd, args )
  11.  
  12. local num = tonumber(args[1])
  13.  
  14.  
  15.  
  16. if type(num) ~= "number" then return error("ERROR: CHANGECLASS NEEDS TO BE A NUMBER") end
  17.  
  18. if num <= table.Count(Class) then
  19.  
  20. ply.ClassNumberTo = num
  21.  
  22. ply.ClassName = Class[num]["name"]
  23. ply.ClassDescription = Class[num]["description"]
  24.  
  25. ply:ChatPrint("Your class will change to "..Class[num]["name"]..".")
  26. --ply.ClassChanged = true
  27. ply:Spawn()
  28.  
  29. else
  30. error("ERROR: CHANGECLASS DOESN'T EXIST")
  31. return end
  32.  
  33. end
  34.  
  35. concommand.Add("changeclass", ChangeClass)
  36.  
  37.  
  38.  
  39. function FirstClassSpawn( ply )
  40. ply.NextSwapTime = 0
  41. ply.NextTick = 0
  42. ply.ClassNumber = 1
  43. ply.ClassNumberTo = 1
  44. ply:SetNWInt("classnum",ply.ClassNumber)
  45. ply:SetNWInt("stamina",Class[ply.ClassNumber]["stamina"])
  46. ply.Energy = Class[ply.ClassNumber]["stamina"]
  47. end
  48.  
  49. hook.Add( "PlayerInitialSpawn", "Initialize Class", FirstClassSpawn )
  50.  
  51.  
  52. function PlayerClassSpawn(ply)
  53.  
  54. ply.NextTick = 0
  55.  
  56. if ply.ClassNumber == nil then
  57. ply.ClassNumber = 1
  58. end
  59.  
  60. if ply.ClassNumberTo == nil then
  61. ply.ClassNumberTo = 1
  62. end
  63.  
  64.  
  65. ply.ClassNumber = ply.ClassNumberTo
  66. ply.Energy = Class[ply.ClassNumber]["stamina"]
  67. ply:SetNWInt("stamina",Class[ply.ClassNumber]["stamina"])
  68.  
  69. ply:SetNWInt("classnum",ply.ClassNumber)
  70.  
  71. CheckPerks(ply)
  72.  
  73. local Players = player.GetAll()
  74.  
  75. print("-----------------------------------")
  76. print("DAMAGE DEALT TO "..string.upper(ply:Nick()) .. ":")
  77. for i=1, table.Count(Players) do
  78. if ply:GetNWInt(i,0) > 0 then
  79. print(Entity(i):Nick() .. ": " .. ply:GetNWInt(i,0))
  80. ply:SetNWInt(i,0)
  81. end
  82.  
  83. end
  84. print("-----------------------------------")
  85.  
  86.  
  87. timer.Simple(0.01, function()
  88. CheckPerks(ply)
  89. ply:SetNWInt("classnum",ply.ClassNumber)
  90. ply:SetHealth(Class[ply.ClassNumber]["health"])
  91. ply:SetArmor(Class[ply.ClassNumber]["armor"])
  92. ply:SetMaxHealth(Class[ply.ClassNumber]["health"])
  93. ply:SetWalkSpeed(Class[ply.ClassNumber]["walkspeedmul"] * GetConVar("bur_class_walkspeed"):GetInt() )
  94. ply:SetRunSpeed(Class[ply.ClassNumber]["runspeedmul"] * GetConVar("bur_class_runspeed"):GetInt() )
  95. ply:SetJumpPower(Class[ply.ClassNumber]["jumpmul"] * GetConVar("bur_class_jumppower"):GetInt() )
  96. ply:SetCrouchedWalkSpeed(Class[ply.ClassNumber]["crouchmul"]*0.5)
  97. end)
  98. end
  99.  
  100. hook.Add("PlayerSpawn", "Player Class Spawn", PlayerClassSpawn)
  101.  
  102.  
  103. function ScaleClassDamage( ply, hitgroup, dmginfo )
  104.  
  105. local DamageScale = 1
  106.  
  107. if dmginfo:GetAttacker():IsPlayer() and dmginfo:GetAttacker() ~= ply then
  108.  
  109. if TableSearcher(ply.ClassNumber,"Evasion") == true && math.random(0,100) >= 90 then
  110. DamageScale = 0
  111. ply:EmitSound("ui/freeze_cam.wav",100,math.Rand(90,110))
  112. dmginfo:ScaleDamage(0)
  113. return end
  114.  
  115.  
  116. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"Splash") == true then
  117. local result = ents.FindInSphere(ply:GetPos(),1000)
  118. local resultCount = table.Count(result)
  119. print(result)
  120. DamageScale = 0.9
  121. for i=1, resultCount do
  122. if result[i]:IsPlayer() == true then
  123. print(result[i]:Nick())
  124. if result[i] ~= ply and result[i] ~= dmginfo:GetAttacker() then
  125. if result[i]:Team() == dmginfo:GetAttacker():Team() and ply:Team() == 1001 then
  126. damage = dmginfo:GetBaseDamage()*0.1
  127. result[i]:TakeDamage(damage, dmginfo:GetAttacker(), dmginfo:GetAttacker():GetActiveWeapon())
  128. elseif result[i]:Team() ~= dmginfo:GetAttacker():Team() and ply:Team() ~= 1001 then
  129. damage = dmginfo:GetBaseDamage()*0.1
  130. result[i]:TakeDamage(damage, dmginfo:GetAttacker(), dmginfo:GetAttacker():GetActiveWeapon())
  131. end
  132. end
  133. end
  134. end
  135. end
  136.  
  137.  
  138. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"Stunner") == true && math.Rand(0,100) >= 100 - (dmginfo:GetBaseDamage()/2) then
  139. DamageScale = 2
  140. ply:EmitSound("player/crit_received1.wav",100,100)
  141. dmginfo:GetAttacker():EmitSound("player/crit_hit.wav",100,100)
  142. if ply:IsFrozen() == false then
  143. ply:Freeze(true)
  144. timer.Simple(0.5,function()
  145. ply:Freeze( false )
  146. end)
  147. end
  148. end
  149.  
  150.  
  151.  
  152.  
  153. if TableSearcher(ply.ClassNumber,"Swap") == true then
  154. --print("Swap")
  155. if ply:Health() < 50 then
  156. --print("Swaping")
  157. if ply:Alive() == false then return end
  158. if ply.NextSwapTime <= CurTime() then
  159. ply.NextSwapTime = CurTime() + 60
  160.  
  161. local Players = player.GetAll()
  162. local rand = math.random(1,table.Count(Players))
  163. local toSwap = Players[rand]
  164.  
  165. if toSwap == ply then
  166. if rand+1<= table.Count(Players) then
  167. toSwap = Players[rand+1]
  168. --print("debug" ..debugnum)
  169. debugnum = rand+1
  170. elseif rand-1 >= 1 then
  171. debugnum = rand-1
  172. --print("debug" .. debugnum)
  173. toSwap = Players[rand-1]
  174. else
  175. print("weird")
  176. end
  177. end
  178.  
  179. local pos1 = ply:GetPos()
  180. local pos2 = toSwap:GetPos()
  181.  
  182. ply:SetPos(pos2)
  183. toSwap:SetPos(pos1)
  184.  
  185. ply:EmitSound("ambient/machines/teleport4.wav",100,100)
  186. toSwap:EmitSound("ambient/machines/teleport4.wav",100,100)
  187. end
  188. end
  189. end
  190.  
  191.  
  192. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"LifeSteal") == true then
  193. if dmginfo:GetAttacker():Health() + math.max(0,dmginfo:GetDamage()*0.1) >= 200 then
  194. dmginfo:GetAttacker():SetHealth(200)
  195. else
  196. dmginfo:GetAttacker():SetHealth(dmginfo:GetAttacker():Health() + math.max(0,dmginfo:GetDamage()*0.1) )
  197. end
  198. end
  199.  
  200.  
  201. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"Survivor") == true then
  202. DamageScale = 1 + math.abs(dmginfo:GetAttacker():Health()-dmginfo:GetAttacker():GetMaxHealth())/1000
  203. end
  204.  
  205.  
  206. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"ArmorSteal") == true then
  207. if dmginfo:GetDamage()*0.15 < ply:Armor() then
  208. if dmginfo:GetAttacker():Armor() + dmginfo:GetDamage()*0.15 >= 200 then
  209. dmginfo:GetAttacker():SetArmor(200)
  210. else
  211. dmginfo:GetAttacker():SetArmor(dmginfo:GetAttacker():Armor() + dmginfo:GetDamage()*0.15 )
  212. end
  213. end
  214. end
  215.  
  216.  
  217. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"SoulAbsorb") == true then
  218. dmginfo:GetAttacker().SoulCount = dmginfo:GetAttacker().SoulCount + math.floor(dmginfo:GetDamage())
  219. dmginfo:GetAttacker().SoulsDelivered = dmginfo:GetAttacker().SoulCount + math.floor(dmginfo:GetDamage())
  220. end
  221.  
  222.  
  223. if TableSearcher(ply.ClassNumber,"Helmet") == true then
  224. if hitgroup == HITGROUP_HEAD then
  225. ply:EmitSound("player/kevlar"..math.random(1,5)".wav",100,100)
  226. DamageScale = DamageScale*0.9
  227. else
  228. DamageScale = DamageScale*1
  229. end
  230. end
  231.  
  232.  
  233. if TableSearcher(ply.ClassNumber,"Kevlar") == true then
  234. if hitgroup == HITGROUP_HEAD then
  235. DamageScale = DamageScale*1
  236. else
  237. DamageScale = DamageScale*0.85
  238. ply:EmitSound("player/kevlar"..math.random(1,5)".wav",100,100)
  239. end
  240. end
  241.  
  242.  
  243. if TableSearcher(ply.ClassNumber,"Shield") == true and math.random(0,100) >= 40 then
  244. if ply.ItemDurability > 0 then
  245. ply.ItemDurablity = ply.ItemDurability - 1
  246. DamageBlock = math.Rand(1,5*(ply.ItemDurability/100))
  247. dmginfo:SubtractDamage(DamageBlock)
  248. ply:EmitSound("player/bhit_helmet-1.wav",100,math.Rand(90,110))
  249. end
  250. end
  251.  
  252.  
  253. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"AP") == true then
  254. if ply:Armor() > 0 then
  255. DamageScale = DamageScale + (ply:Armor()*0.005) - 0.25
  256. ply:EmitSound("mvm/physics/robo_impact_bullet0"..math.random(1,4)..".wav",100,math.Rand(90,110))
  257. end
  258. end
  259.  
  260.  
  261. if TableSearcher(ply.ClassNumber,"BrainDamage") == true then
  262. if hitgroup == HITGROUP_HEAD then
  263. DamageScale = DamageScale*3
  264. ply:EmitSound("player/headshot"..math.random(1,2)..".wav",100,100)
  265. else
  266. DamageScale = DamageScale*0.85
  267. end
  268. end
  269.  
  270.  
  271. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"HeadshotHunter") == true then
  272. if hitgroup == HITGROUP_HEAD then
  273. DamageScale = DamageScale*2
  274. ply:EmitSound("player/headshot"..math.random(1,2)..".wav",100,100)
  275. else
  276. DamageScale = DamageScale*0.5
  277. end
  278. end
  279.  
  280. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"ReflectDamage") == true then
  281. DamageScale = DamageScale*0.75
  282. end
  283.  
  284.  
  285. if TableSearcher(ply.ClassNumber,"ReflectDamage") == true then
  286. DamageScale = DamageScale*0.9
  287. if TableSearcher(dmginfo:GetAttacker().ClassNumber,"ReflectDamage") == false then
  288.  
  289. dmginfo:GetAttacker():TakeDamage(dmginfo:GetBaseDamage()*DamageScale*0.1, ply, dmginfo:GetAttacker():GetActiveWeapon())
  290. end
  291. end
  292.  
  293. if TableSearcher(ply.ClassNumber,"FlakJacketMajor") == true then
  294. if dmginfo:GetDamageType() == DMG_BLAST then
  295. DamageScale = DamageScale*0.75
  296. if math.random(1,100) >= 80 and dmginfo:GetBaseDamage() > 30 then
  297. dmginfo:GetAttacker():TakeDamage(dmginfo:GetBaseDamage() - 30, ply, dmginfo:GetAttacker():GetActiveWeapon())
  298. end
  299. end
  300. end
  301.  
  302. if TableSearcher(ply.ClassNumber,"FlakJacketMinor") == true then
  303. if dmginfo:GetDamageType() == DMG_BLAST then
  304. DamageScale = DamageScale*0.85
  305. end
  306. end
  307.  
  308. if TableSearcher(ply.ClassNumber,"Reversal") == true and math.random(0,100) >= 93 then
  309. ply:EmitSound("items/smallmedkit1.wav",100,100)
  310. if (ply:Health() + DamageScale * dmginfo:GetBaseDamage()) >= ply:GetMaxHealth() then
  311. ply:SetHealth(ply:GetMaxHealth())
  312. else
  313. ply:SetHealth(ply:Health() + DamageScale * dmginfo:GetBaseDamage() )
  314. end
  315.  
  316. DamageScale = DamageScale*0
  317. end
  318.  
  319. dmginfo:ScaleDamage(DamageScale)
  320.  
  321. if hitgroup == HITGROUP_HEAD then
  322. HiddenScale = 2
  323. else
  324. HiddenScale = 1
  325. end
  326.  
  327.  
  328.  
  329. ply:SetNWInt(dmginfo:GetAttacker():EntIndex(), ply:GetNWInt(dmginfo:GetAttacker():EntIndex()) + (HiddenScale * DamageScale * dmginfo:GetBaseDamage()))
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. end
  338.  
  339. --print(dmginfo:GetInflictor():GetClass())
  340. --print(dmginfo:GetAttacker():GetClass())
  341.  
  342.  
  343. end
  344.  
  345. hook.Add("ScalePlayerDamage","Scale Class Damage",ScaleClassDamage)
  346.  
  347.  
  348. function ScaleFallDamage(ply, speed)
  349. --print("you fell gg")
  350.  
  351.  
  352. --print(Class[ply.ClassNumber]["fallmul"])
  353.  
  354.  
  355.  
  356.  
  357. if GetConVarNumber("mp_falldamage") == 1 then
  358. speed = speed - 580
  359. local punch = math.max(0,speed/10) * Class[ply.ClassNumber]["fallmul"]
  360. --print(punch)
  361. ply:ViewPunch(Angle(punch,0,0))
  362.  
  363. return speed * (100/(1024-580)) * Class[ply.ClassNumber]["fallmul"]
  364. end
  365. return 10 * Class[ply.ClassNumber]["fallmul"]
  366.  
  367.  
  368.  
  369. end
  370.  
  371. hook.Add("GetFallDamage","ScaleFallDamage",ScaleFallDamage)
  372.  
  373.  
  374. function CheckPerks(ply)
  375.  
  376. if TableSearcher(ply.ClassNumber,"Shield") == true then
  377. ply.ItemDurability = 100
  378. end
  379.  
  380. if TableSearcher(ply.ClassNumber,"LifeRegen") == true then
  381. timer.Create( "LifeGainPerkTick" .. ply:EntIndex(), 1, 0, function()
  382.  
  383. if ply:IsValid() == false then timer.Destroy("LifeGainPerkTick" .. ply:EntIndex()) return end
  384. if ply:Alive() == false then timer.Destroy("LifeGainPerkTick" .. ply:EntIndex()) return end
  385. if TableSearcher(ply.ClassNumber,"LifeRegen") == false then timer.Destroy("LifeGainPerkTick" .. ply:EntIndex()) return end
  386. if ply:Health() >= ply:GetMaxHealth() then return end
  387.  
  388.  
  389.  
  390. ply:SetHealth(ply:Health() + 1)
  391.  
  392. end)
  393. end
  394.  
  395. if TableSearcher(ply.ClassNumber,"ArcLight") == true then
  396. timer.Create( "ArcLightTick" .. ply:EntIndex(), 0.5, 0, function()
  397.  
  398. if ply:IsValid() == false then timer.Destroy("ArcLightTick" .. ply:EntIndex()) return end
  399. if ply:Alive() == false then timer.Destroy("ArcLightTick" .. ply:EntIndex()) return end
  400. if TableSearcher(ply.ClassNumber,"ArcLight") == false then timer.Destroy("ArcLightTick" .. ply:EntIndex()) return end
  401.  
  402. local result = ents.FindInSphere(ply:GetPos(),300)
  403. local resultCount = table.Count(result)
  404.  
  405. for i=1, resultCount do
  406. if result[i]:IsPlayer() == true then
  407. if result[i] ~= ply then
  408. if result[i]:Team() == ply:Team() and ply:Team() ~= 1001 then return end
  409. local damage = (300 - ply:GetPos():Distance(result[i]:GetPos()))/200
  410. result[i]:TakeDamage(damage, ply, ply)
  411. end
  412. end
  413. end
  414. end)
  415. end
  416.  
  417.  
  418. if TableSearcher(ply.ClassNumber,"Medic") == true then
  419. timer.Create( "MedicAura" .. ply:EntIndex(), 1, 0, function()
  420. if ply:IsValid() == false then timer.Destroy("MedicAura" .. ply:EntIndex()) return end
  421. if ply:Alive() == false then timer.Destroy("MedicAura" .. ply:EntIndex()) return end
  422. if TableSearcher(ply.ClassNumber,"Medic") == false then timer.Destroy("MedicAura" .. ply:EntIndex()) return end
  423.  
  424. local Team = team.GetPlayers(ply:Team())
  425. local TeamCount = table.Count(Team)
  426.  
  427. for i=1, TeamCount do
  428. if Team[i]:Alive() == false then return end
  429. if Team[i]:Team() == 1001 then return end
  430. if Team[i]:Health() < Team[i]:GetMaxHealth() then
  431. Team[i]:SetHealth(Team[i]:Health() + 1)
  432. end
  433. end
  434. end)
  435. end
  436.  
  437.  
  438. if TableSearcher(ply.ClassNumber,"LifeSteal") == true then
  439. timer.Create( "HealthDecay" .. ply:EntIndex(), 3, 0, function()
  440. if ply:IsValid() == false then timer.Destroy("HealthDecay" .. ply:EntIndex()) return end
  441. if ply:Alive() == false then timer.Destroy("HealthDecay" .. ply:EntIndex()) return end
  442. if TableSearcher(ply.ClassNumber,"LifeSteal") == false then timer.Destroy("HealthDecay" .. ply:EntIndex()) return end
  443. if ply:Health() <= ply:GetMaxHealth() then return end
  444. ply:SetHealth(ply:Health() - 1)
  445. end)
  446. end
  447.  
  448.  
  449. if TableSearcher(ply.ClassNumber,"Snackbar") == true then
  450. timer.Create( "ExplodeCheck" .. ply:EntIndex(), 0.1, 0, function()
  451. if ply:IsValid() == false then timer.Destroy("ExplodeCheck" .. ply:EntIndex()) return end
  452. if TableSearcher(ply.ClassNumber,"Snackbar") == false then timer.Destroy("ExplodeCheck" .. ply:EntIndex()) return end
  453. if ply:Alive() == false then
  454. timer.Destroy("ExplodeCheck" .. ply:EntIndex())
  455.  
  456.  
  457.  
  458. local effectdata = EffectData()
  459. effectdata:SetStart( ply:GetPos() )
  460. effectdata:SetOrigin( ply:GetPos() )
  461. effectdata:SetScale( 1 )
  462. util.Effect( "Explosion", effectdata )
  463. util.BlastDamage(ply, ply, ply:GetPos(), 250, 100)
  464.  
  465.  
  466. util.Decal("Scorch", ply:GetPos(), ply:GetPos())
  467.  
  468.  
  469. if table.Count(ents.FindInSphere(ply:GetPos(),250)) > 0 then
  470. for k,v in pairs(ents.FindInSphere(ply:GetPos(),250)) do
  471. if v:GetClass() == "prop_physics" then
  472. if math.Rand(0,100) >= 70 then
  473. v:Ignite(250/20 - v:GetPos():Distance( ply:GetPos() )/20,0)
  474. end
  475.  
  476. timer.Simple(0,function()
  477. if v:IsValid() == false then return end
  478. constraint.RemoveAll(v)
  479. v:GetPhysicsObject():EnableMotion(true)
  480. v:GetPhysicsObject():Wake()
  481. end)
  482.  
  483. end
  484.  
  485. if v:GetClass() == "prop_door_rotating" then
  486. v:Fire( "Unlock", 0 )
  487. v:Fire( "Open", 0.1 )
  488. end
  489. end
  490. end
  491. end
  492. end)
  493. end
  494.  
  495.  
  496. if TableSearcher(ply.ClassNumber,"Cloak") == true then
  497.  
  498. ply.ArmorDrainCount = 0
  499.  
  500. timer.Create( "CloakCheckTick" .. ply:EntIndex(), 0.1, 0, function()
  501. if ply:IsValid() == false then timer.Destroy("CloakCheckTick" .. ply:EntIndex()) return end
  502. if ply:Alive() == false then timer.Destroy("CloakCheckTick" .. ply:EntIndex()) return end
  503. if TableSearcher(ply.ClassNumber,"Cloak") == false then timer.Destroy("CloakCheckTick" .. ply:EntIndex()) return end
  504.  
  505. if ply:Armor() > 0 then
  506.  
  507. -- ply:SetColor(255,255,255,255)
  508.  
  509. ply.MoveSpeed = ply:GetVelocity():Length()
  510.  
  511.  
  512. if ply.MoveSpeed < 10 then
  513. ply:SetMaterial("models/effects/vol_light001")
  514. --ply:GetActiveWeapon():SetMaterial("models/effects/vol_light001")
  515. elseif ply.MoveSpeed < 70 then
  516. ply:SetMaterial("models/shadertest/predator")
  517. --ply:GetActiveWeapon():SetMaterial("models/shadertest/predator")
  518. else
  519. ply:SetMaterial("")
  520. -- ply:GetActiveWeapon():SetMaterial("")
  521. end
  522.  
  523.  
  524. ply.ArmorDrainCount = ply.ArmorDrainCount + 1
  525.  
  526.  
  527. if ply.ArmorDrainCount >= 30 then
  528. ply.ArmorDrainCount = 0
  529. ply:SetArmor(ply:Armor() - 1)
  530. end
  531. else
  532. ply:SetMaterial("")
  533. end
  534.  
  535.  
  536. end)
  537.  
  538. end
  539.  
  540. if TableSearcher(ply.ClassNumber,"Necro") then
  541. timer.Create( "NecroTick" .. ply:EntIndex(), 1, 0, function()
  542. if ply:IsValid() == false then timer.Destroy("NecroTick" .. ply:EntIndex()) return end
  543. if ply:Alive() == false then timer.Destroy("NecroTick" .. ply:EntIndex()) return end
  544. if TableSearcher(ply.ClassNumber,"Necro") == false then timer.Destroy("NecroTick" .. ply:EntIndex()) return end
  545. ply:SetMaxHealth(1)
  546. end)
  547. end
  548.  
  549.  
  550. if TableSearcher(ply.ClassNumber,"SoulAbsorb") then
  551.  
  552. ply.SoulsDelivered = 100
  553. ply.SoulCount = 0
  554. ply.CountTick = 0
  555. ply.SmallSoulsWarning = true
  556. ply.ZeroSoulsWarning = true
  557. ply.PissedOffDemons = false
  558.  
  559. timer.Create( "SoulRegen" .. ply:EntIndex(), 1, 0, function()
  560. if ply:IsValid() == false then timer.Destroy("SoulRegen" .. ply:EntIndex()) return end
  561. if ply:Alive() == false then timer.Destroy("SoulRegen" .. ply:EntIndex()) return end
  562. if TableSearcher(ply.ClassNumber,"SoulAbsorb") == false then timer.Destroy("SoulRegen" .. ply:EntIndex()) return end
  563.  
  564. ply.SoulsDelivered = ply.SoulsDelivered - 1
  565.  
  566. --print(ply.SoulsDelivered)
  567.  
  568. if ply.SoulCount > 0 and ply:Armor() < ply.SoulCount*0.1 then
  569. ply:SetArmor(ply:Armor() + 1)
  570. end
  571.  
  572. if ply.SoulsDelivered <= 20 and ply.SmallSoulsWarning == true then
  573. ply.SmallSoulsWarning = false
  574. ply:ChatPrint("The keepers of oblivion are getting angry for your lack of souls.")
  575. ply:EmitSound("npc/stalker/breathing3.wav",100,50)
  576. end
  577.  
  578. if ply.SoulsDelivered < 0 and ply.ZeroSoulsWarning == true and ply.PissedOffDemons == false then
  579. ply.ZeroSoulsWarning = false
  580. ply.PissedOffDemons = true
  581. ply:ChatPrint("The keepers of oblivion is absorbing your very soul for your lack of commitment.")
  582. ply:ConCommand("pp_mat_overlay effects/invuln_overlay_red ")
  583. ply:ConCommand("pp_mat_overlay_refractamount 1")
  584. end
  585.  
  586. if ply.SoulsDelivered > 100 and ply.PissedOffDemons == true then
  587. ply.PissedOffDemons = false
  588. ply:ChatPrint("The keepers of oblivion have been appeased, but they have left a mark on your max health.")
  589. ply.SmallSoulsWarning = true
  590. ply.ZeroSoulsWarning = true
  591. ply:ConCommand("pp_mat_overlay \"\" ")
  592. ply:ConCommand("pp_mat_overlay_refractamount 0")
  593. end
  594.  
  595. if ply.PissedOffDemons == true then
  596. ply.CountTick = ply.CountTick + 1
  597. else
  598. ply.CountTick = 0
  599. end
  600.  
  601.  
  602. if ply.CountTick == 3 then
  603. ply.CountTick = 0
  604. if ply:Health() > 7 then
  605. ply:SetHealth(ply:Health() - 7)
  606. ply:SetMaxHealth(ply:GetMaxHealth() - 5)
  607. ply:EmitSound("npc/headcrab_poison/ph_hiss1.wav", 100, 50)
  608. ply:ViewPunch(Angle(math.random(-5,5),math.random(-5,5),math.random(-5,5)))
  609. else
  610. ply:Kill()
  611. ply:EmitSound("npc/vort/vort_dispell.wav", 100, 50)
  612. ply:ConCommand("pp_mat_overlay \"\" ")
  613. ply:ConCommand("pp_mat_overlay_refractamount 0")
  614. end
  615. end
  616.  
  617. end)
  618. end
  619. end
  620.  
  621.  
  622. function TableSearcher(num,tofind)
  623. local found = false
  624.  
  625.  
  626. if Class[num] == nil then error("RETURNED NIL") return false end
  627. if Class[num]["perks"][1] == "none" then return false end
  628.  
  629. for i=1, table.Count(Class[num]["perks"]) do
  630. --print(Class[num]["perks"][i])
  631. if table.HasValue(Class[num]["perks"],tofind) then
  632. found = true
  633. end
  634. end
  635.  
  636. return found end
  637.  
  638.  
  639. function SVSprintThink()
  640.  
  641. local PlayerTable = player.GetAll()
  642.  
  643. for i=1, table.Count(player.GetAll()) do
  644. local ply = PlayerTable[i]
  645.  
  646. --print(ply:GetVelocity():Length())
  647.  
  648. ply.Stamina = Class[ply.ClassNumber]["stamina"]
  649. local WalkSpeed = Class[ply.ClassNumber]["walkspeedmul"] * GetConVar("bur_class_walkspeed"):GetInt()
  650. local RunSpeed = Class[ply.ClassNumber]["runspeedmul"] * GetConVar("bur_class_runspeed"):GetInt()
  651.  
  652. if ply:KeyDown(IN_SPEED) then
  653. if ply.Energy >= 0.2 then
  654. if ply.NextTick < CurTime() then
  655. ply.NextTick = CurTime() + 0.2
  656. ply.Energy = ply.Energy - 0.2
  657. ply:SetRunSpeed(RunSpeed)
  658. end
  659. else
  660. ply:SetRunSpeed(WalkSpeed)
  661. end
  662. else
  663. if ply.Energy < ply.Stamina then
  664. if ply.NextTick < CurTime() then
  665. ply.NextTick = CurTime() + 0.25
  666. ply.Energy = ply.Energy + ply.Stamina*0.01
  667. end
  668. else
  669. ply.Energy = ply.Stamina
  670. end
  671. end
  672.  
  673. ply:SetNWInt("Energy",ply.Energy)
  674.  
  675. end
  676. end
  677.  
  678. hook.Add("Think", "Serverside Sprint Think", SVSprintThink)
  679.  
  680.  
  681.  
  682. function SelectClassMenu( ply )
  683. --ply:ConCommand("selectweapon")
  684. ply:ConCommand("selectclass")
  685. end
  686.  
  687. function SelectWeaponMenu( ply )
  688. ply:ConCommand("selectweapon")
  689. --ply:ConCommand("selectclass")
  690. end
  691.  
  692. hook.Add("ShowSpare1", "Select Class Menu", SelectClassMenu)
  693. hook.Add("ShowSpare2", "Select Weapon Menu", SelectWeaponMenu)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement