Random number to each player.
I am basically trying to set a random number to each player and also making sure it doesn't equal anyone else's number. It works of course, but my server is crashing. I know this because when i comment this function out, crashes don't exist. Is there a more efficient way of doing this? Thanks in advance.
Code:
public round_start() set_numbers() |
Re: Random number to each player.
try this one
PHP Code:
|
Re: Random number to each player.
Better to use this method:
PHP Code:
|
Re: Random number to each player.
Thanks for the help. Exolent, is there a reason why you used random instead of random_num? Does random only randomize specific values? While random_num randomizes a range of values?
For example random can randomize numbers like 1, 3, 5, 8. random_num has to randomize numbers within the range of 1 - 8. So 2, 4, 6, 7 must be included. Not sure if i get this =P. |
Re: Random number to each player.
|
Re: Random number to each player.
use my
get_alivehumans()return maybe 8 so my sample give player 1 the 4 give player 2 the 6 give player 3 the 1 give player 4 the 4 O.o huch 4 already used search for non-used number....got one...give player 4 the 7 etc etc :) |
Re: Random number to each player.
Quote:
|
Re: Random number to each player.
Exolent, thank you. Crashes are not happening anymore. I didn't understand your method at first, but eventually it made sense to me. Thank you schmurgel for helpin out too.
|
| All times are GMT -4. The time now is 14:41. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.