Posts: 2,286
Threads: 18
Joined: Jun 2010
Quote:
Originally Posted by admigo
You can test it by yourself. I thinks its right
|
Quote:
Originally Posted by Pizzy
yep, that is right, but I would do this (more organized)
pawn Код:
new rid = random(5); switch(rid) { case 1: { PlayAudioStreamForPlayer(i, "url here"); } case 2: { PlayAudioStreamForPlayer(i, "url here"); } case 3: { PlayAudioStreamForPlayer(i, "url here"); } case 4: { PlayAudioStreamForPlayer(i, "url here"); } case 5: { PlayAudioStreamForPlayer(i, "url here"); } }
|
No, it's NOT right. Let me quickly explain. random(5) (for example) runs a random number from 0 to 4. It doesn't count 5 in. So, it should be
Код:
switch(random(5))
{
case 0: { PlayAudioStreamForPlayer(i, "url here"); }
case 1: { PlayAudioStreamForPlayer(i, "url here"); }
case 2: { PlayAudioStreamForPlayer(i, "url here"); }
case 3: { PlayAudioStreamForPlayer(i, "url here"); }
case 4: { PlayAudioStreamForPlayer(i, "url here"); }
}
I mean seriously, don't you know the basics of computer languages? That cells start at 0 and not 1?