Make Random Words
#1

How do I make this show random fish names instead of numbers, like "Trout", "Shark", etc:

pawn Код:
random(46);
Reply
#2

pawn Код:
stock RandomFish() {
    #define TOTAL_FISHES 3;
    new fish[TOTAL_FISHES][32] = { "Trout", "Shark", "Swordfish" };
    return fish[random(TOTAL_FISHES)];
}
@e: This should work as well
pawn Код:
stock RandomFish() {
    new fish[3][32] = { "Trout", "Shark", "Swordfish" };
    return fish[random(sizeof fish)];
}
Reply
#3

pawn Код:
new name[25];
switch(random(46))
{
    case 0: name = "Fish";
    case 1: name = "Trout";
    (...)
    case 45: name = "Shark";
}
Reply
#4

Код:
randomNameFish () {
    new fish[][32] = { "Trout", "Shark", "Swordfish" };
    return fish[random (sizeof (fish))];
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)