SA-MP Forums Archive
Little help here? - 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: Little help here? (/showthread.php?tid=205121)



Need help with inventory system. - Universal - 31.12.2010

Hello everyone, so I've been making a inventory system and i got these errors recently:

Код:
(1119) : error 002: only a single statement (or expression) can follow each "case"
(1119) : error 029: invalid expression, assumed zero
(1119) : warning 215: expression has no effect
(1119) : error 017: undefined symbol "i"
(1119) : fatal error 107: too many error messages on one line
and here are the code lines:

pawn Код:
if(dialogid == DIALOG_INV) {
        if(response) {
            new msg[100], Float:X,Float:Y,Float:Z;
            switch(listitem) {
                    for(new i=0; i<sizeof(listitem); i++) { // <--------- THE LINE
               
                    case i: {
                        if(PlayerInv[i][playerid] == 0) return SendClientMessage(playerid,CLR_GREY,"This slot is empty.");
                        else if(PlayerInv[i][playerid] == 1) {
                            GivePlayerWeapon(playerid,4,1);
                            PlayerInv[i][playerid] = 0;
                        }
                    }
                }
            }
        }
    }
Thanks in any advice!

P.S. yes, I created that code by myself and i know that it could be a wrong way of scripting that function, but I improvised. So, I would like to know how to make this done?