[Help] 4 errors on 1 line
#1

Hello,
I have an bigears command that you can see what some players are typing I'm getting this errors:
Код:
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88147) : error 014: invalid statement; not in switch
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88147) : warning 215: expression has no effect
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88147) : error 001: expected token: ";", but found ":"
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88147) : error 029: invalid expression, assumed zero
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88147) : fatal error 107: too many error messages on one line
This is the line:
pawn Код:
case BIGEARS3: if(response) {; //Bigears
Reply
#2

Can you show the code arround it ?
Reply
#3

Just check response before switch.

You don't need to check the response while switching

Код:
case BIGEARS3: /* Your codes here */ //Bigears
Reply
#4

How do you guys mean?
Reply
#5

Quote:
Originally Posted by Jarnu
Посмотреть сообщение
Just check response before switch.

You don't need to check the response while switching

Код:
case BIGEARS3: /* Your codes here */ //Bigears
Only if you wan't to return 1 at !response. But if you want to turn back to the dialog before, you will need this inside the case. So I think you can beter put it inside the case.

Edit your code to:

pawn Код:
case BIGEARS3:
{  
if(!response) return 1;
//Bigears
}
Reply
#6

I got the bigears command out of an dynamic street RP script and it's like this
pawn Код:
case BIGEARS3: if(response) {
            BigEar[playerid] = 5;
            BigEarFamily[playerid] = listitem;
            SendClientMessageEx(playerid, COLOR_WHITE, "You will now hear all messages from this family's chat.");
        }
        else ShowPlayerDialog(playerid, BIGEARS, DIALOG_STYLE_LIST, "Please choose an item to proceed", "Global Chat\nOOC Chat\nIC Chat\nFaction Chat\nFamily Chat\nPlayer\nDisable Bigears", "Select", "Cancel");
        case BIGEARS: if(response) switch(listitem) {
            case 0: {
                BigEar[playerid] = 1;
                SendClientMessage(playerid, COLOR_WHITE, "You have selected the Global Chat, you can now see all the messages server-wide.");
            }
            case 1: {
                BigEar[playerid] = 2;
                SendClientMessage(playerid, COLOR_WHITE, "You have selected the OOC Chat, you can now see all the OOC(/b) messages server-wide.");
            }
            case 2: {
                BigEar[playerid] = 3;
                SendClientMessage(playerid, COLOR_WHITE, "You have selected the IC Chat, you can now see all the IC(Includes /me's & /do's) messages server-wide.");
            }
            case 3: {
                ShowPlayerDialog(playerid, BIGEARS2, DIALOG_STYLE_LIST, "{3399FF}Please choose an item to proceed", "LSPD\nFBI\nSFPD\nFDSA\nJudicial System\nState Government\nSASD\nHitman Agency\nSANews\nSan Andreas Department of Transportation\nSAAS\nTierra Robada\nNOOSE", "Select", "Cancel");
            }
            case 4: {
                new bigstring[512];
                for(new i = 0; i < sizeof(FamilyInfo); i++)
                {
                    format(bigstring, sizeof(bigstring), "%s%s\n",bigstring,FamilyInfo[i][FamilyName]);
                }
                ShowPlayerDialog(playerid, BIGEARS3, DIALOG_STYLE_LIST, "{3399FF}Please choose an item to proceed", bigstring, "Select", "Back");
            }
            case 5: {
                ShowPlayerDialog(playerid, BIGEARS4, DIALOG_STYLE_INPUT, "{3399FF}Big Ears Player", "Please type in the name or the Id of the person you want to use the Big Ears function", "Select", "Back");
            }
            case 6: {
                BigEar[playerid]= 0;
                BigEarFaction[playerid] = 0;
                BigEarPlayer[playerid] = INVALID_PLAYER_ID;
                BigEarFamily[playerid] = 255;
                SendClientMessage(playerid, COLOR_WHITE, "You have disabled the bigears feature, you no longer see anything on your screen.");
            }
        }
Reply
#7

Surround the case with { }

pawn Код:
case BIGEARS3:
{ // open case
if(response) {
            BigEar[playerid] = 5;
            BigEarFamily[playerid] = listitem;
            SendClientMessageEx(playerid, COLOR_WHITE, "You will now hear all messages from this family's chat.");
        }
        else ShowPlayerDialog(playerid, BIGEARS, DIALOG_STYLE_LIST, "Please choose an item to proceed", "Global Chat\nOOC Chat\nIC Chat\nFaction Chat\nFamily Chat\nPlayer\nDisable Bigears", "Select", "Cancel");
        case BIGEARS: if(response) switch(listitem) {
            case 0: {
                BigEar[playerid] = 1;
                SendClientMessage(playerid, COLOR_WHITE, "You have selected the Global Chat, you can now see all the messages server-wide.");
            }
            case 1: {
                BigEar[playerid] = 2;
                SendClientMessage(playerid, COLOR_WHITE, "You have selected the OOC Chat, you can now see all the OOC(/b) messages server-wide.");
            }
            case 2: {
                BigEar[playerid] = 3;
                SendClientMessage(playerid, COLOR_WHITE, "You have selected the IC Chat, you can now see all the IC(Includes /me's & /do's) messages server-wide.");
            }
            case 3: {
                ShowPlayerDialog(playerid, BIGEARS2, DIALOG_STYLE_LIST, "{3399FF}Please choose an item to proceed", "LSPD\nFBI\nSFPD\nFDSA\nJudicial System\nState Government\nSASD\nHitman Agency\nSANews\nSan Andreas Department of Transportation\nSAAS\nTierra Robada\nNOOSE", "Select", "Cancel");
            }
            case 4: {
                new bigstring[512];
                for(new i = 0; i < sizeof(FamilyInfo); i++)
                {
                    format(bigstring, sizeof(bigstring), "%s%s\n",bigstring,FamilyInfo[i][FamilyName]);
                }
                ShowPlayerDialog(playerid, BIGEARS3, DIALOG_STYLE_LIST, "{3399FF}Please choose an item to proceed", bigstring, "Select", "Back");
            }
            case 5: {
                ShowPlayerDialog(playerid, BIGEARS4, DIALOG_STYLE_INPUT, "{3399FF}Big Ears Player", "Please type in the name or the Id of the person you want to use the Big Ears function", "Select", "Back");
            }
            case 6: {
                BigEar[playerid]= 0;
                BigEarFaction[playerid] = 0;
                BigEarPlayer[playerid] = INVALID_PLAYER_ID;
                BigEarFamily[playerid] = 255;
                SendClientMessage(playerid, COLOR_WHITE, "You have disabled the bigears feature, you no longer see anything on your screen.");
            }
        }
} // close
Reply
#8

Now I'm getting this errors:
Код:
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88149) : warning 217: loose indentation
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88149 -- 88151) : error 017: undefined symbol "Surround"
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88151) : error 017: undefined symbol "the"
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88151) : warning 215: expression has no effect
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88151) : error 001: expected token: ";", but found "case"
C:\Users\Patrick\Desktop\samp server\Hawkins RP\gamemodes\hawkins_main.pwn(88151) : fatal error 107: too many error messages on one line
Reply
#9

OMG, only copy the code that's inside the box, not my message haha
Reply
#10

Don't copy his post.
Copy only in the box.

,

It's not funny @Roel, laughing a beginner?, It's not funny.

Anyway i see that you are very VERY beginner in the forum and in scripting.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)