daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top