Weird Error but why?
#3

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;
}
Reply


Messages In This Thread
Weird Error but why? - by Sniper Kitty - 09.08.2012, 10:40
Re: Weird Error but why? - by Syntax - 09.08.2012, 10:43
Re: Weird Error but why? - by Sniper Kitty - 09.08.2012, 10:44
Re: Weird Error but why? - by IceMeteor - 09.08.2012, 11:00
Re: Weird Error but why? - by Sniper Kitty - 09.08.2012, 11:02
Re: Weird Error but why? - by IceMeteor - 09.08.2012, 11:04
Re: Weird Error but why? - by Sniper Kitty - 09.08.2012, 11:05
Re: Weird Error but why? - by IceMeteor - 09.08.2012, 11:07
Re: Weird Error but why? - by Sniper Kitty - 09.08.2012, 11:08
Re: Weird Error but why? - by leonardo1434 - 09.08.2012, 11:13

Forum Jump:


Users browsing this thread: 1 Guest(s)