is it possible to randomly choose a player that is on a server ? and how do i do this?
ty 4 ur help
regards crazy
random script
Moderators: Forum moderators, developers
and how do i chooose the random player?
if i have privateslots (4 for example) how does he know from what number to what numer he is generating? if i have 4 guys on a server they may have slot numbers like 5 9 12 17 so if he chooses 10 theres no player...
i must return the mod if the slotnumber is not inuse and let him choose another number
how do i do this?
if i have privateslots (4 for example) how does he know from what number to what numer he is generating? if i have 4 guys on a server they may have slot numbers like 5 9 12 17 so if he chooses 10 theres no player...
i must return the mod if the slotnumber is not inuse and let him choose another number
how do i do this?
The easiest way:
Better way:
Code: Select all
.
.
local random_slot
repeat
random_slot = math.random(0,slots)
until not et.gentity_get(random_slot,"inuse")
.
.
Better way:
- get numbers of slots in use
- put these numbers in table
- to get random:
Code: Select all
local random_slot = your_table[math.random(number_of_elements_in_table)]
If you don't do it, someone else will.