SA-MP Forums Archive
How to make this easier? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make this easier? (/showthread.php?tid=66088)



How to make this easier? - Robbin237 - 19.02.2009

EDIT
Nevermind i got it.

Heres the code

pawn Код:
switch (strval(params))
    {
        case 1: printf("Player has chosen: %d (Los Santos)", strval(params));
        case 2: printf("Player has chosen: %d (San Fierro)", strval(params));
        case 3: printf("Player has chosen: %d (Las Venturas)", strval(params));
    }
--------
Hi guys, im checking each number of the params. Look:

pawn Код:
if (strval(params) == 1)
    {
        printf("Player has chosen: %d (Los Santos)", strval(params));
        return 0;
    }
   
    if (strval(params) == 2)
    {
        printf("Player has chosen: %d (San Fierro)", strval(params));
        return 0;
    }

    if (strval(params) == 3)
    {
        printf("Player has chosen: %d (Las Venturas)", strval(params));
        return 0;
    }
I know this can be done simpler.

Can somebody give me an example?