Getting random id
How can I get a random id of a player in CT team?
I tried using get_players but it didn't work for me. :( |
Re: Getting random id
Try this :
Code:
|
Re: Getting random id
Yeah, only I can be dumb enough to forgot to check if there's no CTs. :D
Thanks connorr. |
Re: Getting random id
Code edited, it should be better with switch.
|
Re: Getting random id
Code:
|
Re: Getting random id
Change random to random_num
|
Re: Getting random id
I'm only afraid that random_num(1, ctnum) has a chance of returning the id as 1, and you know there's not always someone who has it.
|
Re: Getting random id
You're retrieve a player list with get_players().
players[x] return a player id where 0 <= x <= ctnum - 1. also players[random_num(1, ctnum)] should be players[random(ctnum)] since players[] start at 0. It should work fine. Code:
|
Re: Getting random id
Code:
Error: Function uses both "return" and "return <value>" on line # |
Re: Getting random id
Code:
Then when you call the function, make sure to do nothing if it returns -1. |
| All times are GMT -4. The time now is 01:19. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.