Advertisement
GoodManUsernameGood

Untitled

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