Guest User

Untitled

a guest
Mar 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. function CalculateAndRun( Percentage )
  2.  
  3. local Amount = Percentage * #player.GetAll()
  4. local ChosenPlayers = {}
  5. local Cur = 0
  6. table.Empty(ChosenPlayers)
  7.  
  8.  
  9. local function ChoosePlayer( )
  10.  
  11. local Player = player.GetAll()[ math.random( 1 , #player.GetAll() ) ]
  12.  
  13. if !table.HasValue( ChosenPlayers , Player ) then
  14.  
  15. return Player
  16.  
  17. else
  18.  
  19. return ChoosePlayer( )
  20.  
  21. end
  22.  
  23. end
  24.  
  25.  
  26. while Cur < Amount do
  27.  
  28. Cur = Cur + 1
  29. ChosenPlayers[ #ChosenPlayers + 1 ] = ChoosePlayer( )
  30.  
  31. end
  32. PrintTable(ChosenPlayers)
  33. return ChosenPlayers
  34.  
  35. end
Add Comment
Please, Sign In to add comment