SA-MP Forums Archive
Make Random Words - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Make Random Words (/showthread.php?tid=413756)



Make Random Words - AphexCCFC - 06.02.2013

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

pawn Код:
random(46);



Re: Make Random Words - Misiur - 06.02.2013

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)];
}



Re: Make Random Words - Jeffry - 06.02.2013

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



Re: Make Random Words - DXM - 06.02.2013

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