Advertisement
GoodManUsernameGood

Untitled

Feb 13th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 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. if difference > 1 then
  15. local amount = math.abs(difference) - 1
  16. local deadPlayers = WR.GetDeadPlayers()
  17. for key, value in pairs(deadPlayers) do
  18. if value.AssignedJob.Prefab.Identifier == 'coalitionteam' then
  19. value.AssignedJob = WR.renegade_job
  20. amount = amount - 1
  21. if amount == 0 then
  22. break
  23. end
  24. end
  25. end
  26. elseif difference < -1 then
  27. local amount = math.abs(difference) - 1
  28. local deadPlayers = WR.GetDeadPlayers()
  29. for key, value in pairs(deadPlayers) do
  30. if value.AssignedJob.Prefab.Identifier == 'renegadeteam' then
  31. value.AssignedJob = WR.coalition_job
  32. amount = amount - 1
  33. if amount == 0 then
  34. break
  35. end
  36. end
  37. end
  38. end
  39. end)
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement