Advertisement
GoodManUsernameGood

Untitled

Feb 13th, 2024
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. WR.renegade_job = JobVariant(JobPrefab.Get("renegadeteam"), 0)
  2. WR.coalition_job = JobVariant(JobPrefab.Get("coalitionteam"), 0)
  3.  
  4. Hook.Add('jobsAssigned', 'WR_JobBalance', function()
  5. local amountCoalition = 0
  6. local amountRenegade = 0
  7. for key, value in pairs(Client.ClientList) do
  8. if value.AssignedJob.Prefab.Identifier == 'renegadeteam' then
  9. amountRenegade = amountRenegade + 1
  10. elseif value.AssignedJob.Prefab.Identifier == 'coalitionteam' then
  11. amountCoalition = amountCoalition + 1
  12. end
  13. end
  14.  
  15. local difference = amountCoalition - amountRenegade
  16.  
  17. print("difference is", difference)
  18.  
  19. if difference > 1 then
  20. local amount = math.abs(difference) - 2
  21. local deadPlayers = WR.GetDeadPlayers()
  22. for key, value in pairs(deadPlayers) do
  23. if value.AssignedJob.Prefab.Identifier == 'coalitionteam' then
  24. value.AssignedJob = WR.renegade_job
  25. amount = amount - 1
  26. if amount == 0 then
  27. break
  28. end
  29. end
  30. end
  31. elseif difference < -1 then
  32. local amount = math.abs(difference) - 2
  33. local deadPlayers = WR.GetDeadPlayers()
  34. for key, value in pairs(deadPlayers) do
  35. if value.AssignedJob.Prefab.Identifier == 'renegadeteam' then
  36. value.AssignedJob = WR.coalition_job
  37. amount = amount - 1
  38. if amount == 0 then
  39. break
  40. end
  41. end
  42. end
  43. end
  44. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement