Help , samp error 014: invalid statement; not in switch
#1

pawn Код:
case 3333:
        {
            if(response)
            {
                new string[256];
                switch(listitem)
                {
                    case 0:
                    {
                        if(playerVariables[playerid][pWarns] <= 0) //
                            return SendClientMessage(playerid, COLOR_GRAD2, "You don't have any warn.");

                        if( HelperTokens[ playerid ] < 30)
                            return SendClientMessage(playerid, COLOR_GRAD2, "You need 30 helper/admin tokens for this action.");

                        new wakaname[25];
                        GetPlayerName(playerid,wakaname,25);
                        new str[128];
                        format(str,128,"UPDATE `playeraccounts` SET `playerVIP`='0' WHERE `playerName`='%s'",wakaname);
                        mysql_query(str);
                        HelperTokens[ playerid ] -= 30;
                        playerVariables[playerid][pWarns] = 0;
                        SendClientMessage(playerid, COLOR_WHITE, "(!) You have cleared your warns!(-30 -30 helper/admin tokens)"); // dupa ce ii se sterge 1 warn, ii apare acest mesaj.
                    }
                    case 1:
                    {
                        if(playerVariables[playerid][pCarID1] >= 1)
                    {
                        if (HelperTokens[ playerid ] < 50)
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "You need 50 helper/admin tokens for this action.");
                            return 1;
                        }
                        HelperTokens[ playerid ] -= 50;
                        playerVariables[playerid][pCarKM] = 0;
                        format(string,sizeof(string),"UPDATE playeraccounts SET playerCarTrunk1 = '0' WHERE playerID = '%d'",playerVariables[playerid][pInternalID]);
                        mysql_query(string);
                        SendClientMessage(playerid, COLOR_GRAD2, "You succesfull clear your car 1 kilometers! (-50 helper/admin tokens).");
                    }
                    case 2: // the line with the error
                    {
                        if(playerVariables[playerid][pCarID2] >= 1)
                    {
                        if (HelperTokens[ playerid ] < 50) // Aici verifica daca playerul are 0 warns, daca acesta are 0 warn i se va trimite un mesaj cu "Nu ai niciun warn." cel de mai jos.
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "You need 50 helper/admin tokens for this action.");
                            return 1;
                        }
                        HelperTokens[ playerid ] -= 50;
                        playerVariables[playerid][pCarKM2] = 0;
                        format(string,sizeof(string),"UPDATE playeraccounts SET playerCarKM2 = '0' WHERE playerID = '%d'",playerVariables[playerid][pInternalID]);
                        mysql_query(string);
                        SendClientMessage(playerid, COLOR_GRAD2, "You succesfull clear your car 2 kilometers! (-50 helper/admin tokens).");
                    }
                }
                }
            }
        }
Errors:
Код HTML:
F:xxxx(15437) : error 014: invalid statement; not in switch
F:xxxx15437) : warning 215: expression has no effect
F:xxxx(15437) : error 001: expected token: ";", but found ":"
F:xxxx(15437) : error 029: invalid expression, assumed zero
F:xxxx(15437) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Thanks for helping me.
Reply
#2

case 3333:
change to
else if(dialogid == 3333)
Reply
#3

oops no this, change case 1: to

Код:
case 1:
{
	if(playerVariables[playerid][pCarID1] >= 1)
 	{
  		if (HelperTokens[ playerid ] < 50)
  		{
    		SendClientMessage(playerid, COLOR_GRAD2, "You need 50 helper/admin tokens for this action.");
      		return 1;
        }
        HelperTokens[ playerid ] -= 50;
        playerVariables[playerid][pCarKM] = 0;
        format(string,sizeof(string),"UPDATE playeraccounts SET playerCarTrunk1 = '0' WHERE playerID = '%d'",playerVariables[playerid][pInternalID]);
        mysql_query(string);
        SendClientMessage(playerid, COLOR_GRAD2, "You succesfull clear your car 1 kilometers! (-50 helper/admin tokens).");
    }
}
forgotten last }


Fixed code:

Код:
case 3333:
{
	if(response)
 	{
  		new string[256];
    	switch(listitem)
     	{
      		case 0:
        	{
         		if(playerVariables[playerid][pWarns] <= 0) //
                return SendClientMessage(playerid, COLOR_GRAD2, "You don't have any warn.");
                if( HelperTokens[ playerid ] < 30)
                return SendClientMessage(playerid, COLOR_GRAD2, "You need 30 helper/admin tokens for this action.");
                new wakaname[25];
                GetPlayerName(playerid,wakaname,25);
                new str[128];
                format(str,128,"UPDATE `playeraccounts` SET `playerVIP`='0' WHERE `playerName`='%s'",wakaname);
                mysql_query(str);
                HelperTokens[ playerid ] -= 30;
                playerVariables[playerid][pWarns] = 0;
                SendClientMessage(playerid, COLOR_WHITE, "(!) You have cleared your warns!(-30 -30 helper/admin tokens)"); // dupa ce ii se sterge 1 warn, ii apare acest mesaj.
           }
           case 1:
           {
       			if(playerVariables[playerid][pCarID1] >= 1)
            	{
            		if (HelperTokens[ playerid ] < 50)
             		{
              			SendClientMessage(playerid, COLOR_GRAD2, "You need 50 helper/admin tokens for this action.");
                		return 1;
                	}
                	HelperTokens[ playerid ] -= 50;
                	playerVariables[playerid][pCarKM] = 0;
                	format(string,sizeof(string),"UPDATE playeraccounts SET playerCarTrunk1 = '0' WHERE playerID = '%d'",playerVariables[playerid][pInternalID]);
                	mysql_query(string);
                	SendClientMessage(playerid, COLOR_GRAD2, "You succesfull clear your car 1 kilometers! (-50 helper/admin tokens).");
   				}
			}
      		case 2: // the line with the error
        	{
         		if(playerVariables[playerid][pCarID2] >= 1)
                {
                	if (HelperTokens[ playerid ] < 50) // Aici verifica daca playerul are 0 warns, daca acesta are 0 warn i se va trimite un mesaj cu "Nu ai niciun warn." cel de mai jos.
                    {
                    	SendClientMessage(playerid, COLOR_GRAD2, "You need 50 helper/admin tokens for this action.");
                        return 1;
                 	}
                  	HelperTokens[ playerid ] -= 50;
                   	playerVariables[playerid][pCarKM2] = 0;
                    format(string,sizeof(string),"UPDATE playeraccounts SET playerCarKM2 = '0' WHERE playerID = '%d'",playerVariables[playerid][pInternalID]);
                    mysql_query(string);
                    SendClientMessage(playerid, COLOR_GRAD2, "You succesfull clear your car 2 kilometers! (-50 helper/admin tokens).");
                }
           	}
        }
   	}
}
Reply
#4

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)