Code for random...
Ok... I have this in my script...
PHP Code:
amx_play holdmusic.mp3 I added holdmusic2.mp3 and holdmusic3.mp3..... I would like to change this command to a random state.... sometimes it does amx_play holdmusic.mp3 sometimes amx_play holdmusic2.mp3 and sometimes amx_play holdmusic3.mp3 Can someone give me the command that does random?? Or a small script that does random.... this command only needs to be executed once per map change... and the rest of the plugin is already getting to and executing this command but I want to make it execute 3 different commands at random... Thanks!:up: |
Re: Code for random...
Code:
new num = random_num(1, 3); |
Re: Code for random...
Will this select all 3 at random??
|
Re: Code for random...
Just like that, it's enough...
Code:
|
Re: Code for random...
Why (1, 3)??
I want holdmusic, holdmusic2 and holdmusic3 THREE! Not 2 and 3 |
Re: Code for random...
Then rename holdmusic to holdmusic1.. This way you reduce code... It's not a big deal and better to do that... Oo
|
Re: Code for random...
So if it is:
holdmusic1 holdmusic2 holdmusic3 Than PHP Code:
|
Re: Code for random...
yep.
|
Re: Code for random...
Curious....
If I wanted to have a holdmusic4.mp3 than would I use: server_cmd("amx_play holdmusic%d.mp3", random_num(1, 4)); |
Re: Code for random...
Replace "curious" with "retarded" and that post's nothing but accurate.
EDIT: That may have been a little harsh ... Yes, that's what you want. random(x,y) returns an integer that could be x, y, or any integer between them. |
| All times are GMT -4. The time now is 11:12. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.