Random number, then pick string out of an array depending on number?
#1

Ok so what i want is that i make a random number between 1 and 5 with my own function

rand(1, 5) --- duh

Then we have an array here:

pawn Code:
new Names[] = {"Michael", "John", "Katey", "Richard", "Robbin"};
Then if it outputs 5 or any other number, select that string from the array.
Like if rand(1, 5) outputs 2, then send the player a message with the name John in it.
If it outputs 3, send the player a message with the name Katey in it.

Can somebody explain me how?

Thanks!
Reply


Messages In This Thread
Random number, then pick string out of an array depending on number? - by Robbin237 - 26.02.2009, 14:06
Re: Random number, then pick string out of an array depending on number? - by Nero_3D - 26.02.2009, 15:11
Re: Random number, then pick string out of an array depending on number? - by Nero_3D - 26.02.2009, 18:26

Forum Jump:


Users browsing this thread: 1 Guest(s)