Choosing a random player
Can someone help with the code below?I dont know how to get a random player and give them the stuff
HTML Code:
#include <amxmodx> |
Re: Choosing a random player
you can get a random player like this
Code:
new id, players = get_playersnum() |
Re: Choosing a random player
Quote:
Code:
|
Re: Choosing a random player
random(num)
-> random_num(1, num) reason: invalid player 0. |
Re: Choosing a random player
Quote:
Quote:
|
Re: Choosing a random player
Based on what its said, it doesn't matter:
---------------------------------- native random(max); Description Returns a random number between 0 and a specified upper bound. ---------------------------------- |
Re: Choosing a random player
Quote:
run time error 4 : index out of bounds |
Re: Choosing a random player
Quote:
Quote:
Code:
|
Re: Choosing a random player
PHP Code:
|
Re: Choosing a random player
random() will select a random value from 0 to the specified max value.
random(7) -> {0,1,2,3,4,5,6,7} which sometimes, will lead to this: PHP Code:
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. |
All times are GMT -4. The time now is 15:28. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.