SA-MP Forums Archive
Weird Error but why? - 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: Weird Error but why? (/showthread.php?tid=367253)



Weird Error but why? - Sniper Kitty - 09.08.2012

Edit: Go here instead: http://forum.sa-mp.com/showpost.php?...4&postcount=14

pawn Код:
for(new dialogID = 1; dialogID <= MAX_DIALOGS; dialogID++) {
        if(Dialog[dialogID][SK94_dialogCreated] == 0) { // Line 535
I'm getting an error with these lines.

Код:
C:\Users\TheLazySloth\Desktop\San Andreas Multiplayer\Server\pawno\include\SKFunctions.inc(535) : error 001: expected token: ")", but found "["
C:\Users\TheLazySloth\Desktop\San Andreas Multiplayer\Server\pawno\include\SKFunctions.inc(535) : error 029: invalid expression, assumed zero
C:\Users\TheLazySloth\Desktop\San Andreas Multiplayer\Server\pawno\include\SKFunctions.inc(535) : warning 215: expression has no effect
C:\Users\TheLazySloth\Desktop\San Andreas Multiplayer\Server\pawno\include\SKFunctions.inc(535) : error 001: expected token: ";", but found "]"
C:\Users\TheLazySloth\Desktop\San Andreas Multiplayer\Server\pawno\include\SKFunctions.inc(535) : fatal error 107: too many error messages on one line



Re: Weird Error but why? - Syntax - 09.08.2012

Can you paste the whole section of that code, please?


Re: Weird Error but why? - Sniper Kitty - 09.08.2012

Certainly...

pawn Код:
stock CreateDialog(Type, Format[], {Float,_}:...) {
    if(Type != DIALOG_STYLE_MSGBOX && Type != DIALOG_STYLE_LIST && Type != DIALOG_STYLE_INPUT && Type != DIALOG_STYLE_PASSWORD) {
        return 0;
    }

    for(new dialogID = 1; dialogID <= MAX_DIALOGS; dialogID++) {
        if(Dialog[dialogID][SK94_dialogCreated] == 0) { // Line 535
            new Title[MAX_DIALOG_STRING],
                Arg = 2;
   
            for(new FormatPos = 0; FormatPos < strlen(Format); FormatPos++) {
                if(Format[FormatPos] == '%') {
                    switch(Format[(FormatPos + 1)]) {
                        case 's': {
                            for(new Index = 0; getarg(Arg, Index); Index++) {
                                Title[strlen(Title)] = getarg(Arg, Index);
                            }
                           
                            FormatPos++;
                            Arg++;
                        }
                        case 'd', 'i': {
                            new Result = getarg(Arg);
                           
                            if(strlen(Title)) {
                                format(Title, MAX_DIALOG_STRING, "%s%d", Title, Result);
                            }
                            else {
                                format(Title, MAX_DIALOG_STRING, "%d", Result);
                            }
                           
                            FormatPos++;
                            Arg++;
                        }
                        case 'f': {
                            new Float: Result = Float: getarg(Arg);
                           
                            if(strlen(Title)) {
                                format(Title, MAX_DIALOG_STRING, "%s%f", Title, Result);
                            }
                            else {
                                format(Title, MAX_DIALOG_STRING, "%f", Result);
                            }
                           
                            FormatPos++;
                            Arg++;
                        }
                        default: {
                            Title[strlen(Title)] = Format[FormatPos];
                        }
                    }
                }
                else {
                    Title[strlen(Title)] = Format[FormatPos];
                }
            }
   
            Dialog[dialogID][SK94_dialogCreated] = true;
            Dialog[dialogID][SK94_dialogType] = Type;
            format(Dialog[dialogID][SK94_dialogTitle], MAX_DIALOG_STRING, "%s", Title);
            return dialogID;
        }
    }
    return 0;
}



Re: Weird Error but why? - IceMeteor - 09.08.2012

Is it the include? because the error is on your include


Re: Weird Error but why? - Sniper Kitty - 09.08.2012

Quote:
Originally Posted by IceMeteor
Посмотреть сообщение
you forgot the ;
pawn Код:
for(new dialogID = 1; dialogID <= MAX_DIALOGS; dialogID++) {
        if(Dialog[dialogID][SK94_dialogCreated] == 0;) {
You don't end a if statement with a ; in any scripting language,
I just tried it incase you were right and I'm still getting the same error.

Quote:
Originally Posted by IceMeteor
Посмотреть сообщение
Is it the include? because the error is on your include
It is my custom include, I've compiled the include and it shows no errors.

So it has to be the gamemode, the gamemode is the one showing the errors when compiling.


Re: Weird Error but why? - IceMeteor - 09.08.2012

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
You don't end a if statement with a ; in any scripting language,
I just tried it incase you were right and I'm still getting the same error.
Sorry i made a mistake XD


Re: Weird Error but why? - Sniper Kitty - 09.08.2012

Quote:
Originally Posted by IceMeteor
Посмотреть сообщение
Sorry i made a mistake XD
It's okay.


Re: Weird Error but why? - IceMeteor - 09.08.2012

Can you show the line 535 in your include ?


Re: Weird Error but why? - Sniper Kitty - 09.08.2012

The if statement you tried correcting me on is line 535


Re: Weird Error but why? - leonardo1434 - 09.08.2012

Show us how you have made this array.

pawn Код:
Dialog[dialogID][SK94_dialogCreated]