Quote:
Originally Posted by WATCH_D0GS UNITED
random() will select a random value from 0 to the specified max value.
random(7) -> {0,1,2,3,4,5,6,7}
|
No, random(7) = {0,1,2,3,4,5,6}
Quote:
Originally Posted by WATCH_D0GS UNITED
which sometimes, will lead to this:
iRandom = iPlayers [ 0 ]
Valid client entity indexes are from 1 to 32.
|
This is fine as you are not using the random number as the player index, you are using it as an index to the iPlayers array, which get_players() fills with all valid player id's.. The iPlayers[ 0 ] slot will contain a valid player id if iNum is > 0.
Quote:
Originally Posted by WATCH_D0GS UNITED
As an additional note, there are two more issues which are related to the use of get_players() native which we will not point out here,
but we are pretty sure that if someone knows how entity index slots works in the game this person will understand why.
|
There is no issues with the code I posted above to get a random player.
Please don't try to help others if you are not confident in what you are saying.
__________________