Kenix Posted January 1, 2011 Share Posted January 1, 2011 please help does not work on a script idea he must choose one player, but when the server is greater than 2 players, he begins to select all or choose all but one player. function playerzmtake () local array = {} for i,pl in ipairs(getElementsByType("player")) do array[i]=pl end if #array>0 then local c = 0 while true do c=math.random(1,#array) if array[c]~=nil then break end end setPlayerTeam" class="kw6">setPlayerTeam (array[c], teamzombie ) array[c]=nil end end Link to comment
Kenix Posted January 1, 2011 Author Share Posted January 1, 2011 getRandomPlayer thanks a lot Link to comment
Kenix Posted January 1, 2011 Author Share Posted January 1, 2011 I tried to do but he still picks more than 1 player function playerszmtake () local randomPlayer = getRandomPlayer ( ) setPlayerTeam" class="kw6">setPlayerTeam (source, teamzombie ) end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now