SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/05/2014, 03:15 PM   #1
Grimrandomer
Big Clucker
 
Grimrandomer's Avatar
 
Join Date: Dec 2011
Posts: 131
Reputation: 64
Default Run time error 6: "Invalid instruction" [Fixed]

Hey all,

I made a simple textdraw menu, which you open by calling 'furni_showCatalog(playerid, _page=1) '

This works fine no errors, but when call it in the function ShowDialog (which is called from a dialog response) I get a Run time error 6: "Invalid instruction". I have tried calling showCatalog with local functions and timers but the error always occurs.


pawn Code:
furni_showCatalog(playerid, _page=1) {
    printf("furni_showCatalog (%i,%i)", playerid, _page);
    cat_player_page[playerid] = _page;
    TextDrawShowForPlayer(playerid, cat_background_0);
    TextDrawShowForPlayer(playerid, cat_background_1);
    TextDrawShowForPlayer(playerid, cat_background_2);
    TextDrawShowForPlayer(playerid, cat_background_next);
    TextDrawShowForPlayer(playerid, cat_background_back);
    furni_redrawCatalogItems(playerid);
    new pageText[20];
    format(pageText, 20, "Page %d of %d", _page, cat_list_pages);
    if (cat_page_text[playerid] == PlayerText:INVALID_TEXT_DRAW) {
        cat_page_text[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 376.000000, pageText);
        PlayerTextDrawAlignment(playerid,cat_page_text[playerid], 2);
        PlayerTextDrawBackgroundColor(playerid,cat_page_text[playerid], 255);
        PlayerTextDrawFont(playerid,cat_page_text[playerid], 1);
        PlayerTextDrawLetterSize(playerid,cat_page_text[playerid], 0.329999, 1.500000);
        PlayerTextDrawColor(playerid,cat_page_text[playerid], -1);
        PlayerTextDrawSetOutline(playerid,cat_page_text[playerid], 1);
        PlayerTextDrawSetProportional(playerid,cat_page_text[playerid], 1);
    } else {
        PlayerTextDrawSetString(playerid, cat_page_text[playerid], pageText);
    }
    PlayerTextDrawShow(playerid, cat_page_text[playerid]);
    SelectTextDraw(playerid, 0xFF4040AA);
}

furni_showDialog(playerid, furni_page=-1, furni_stage=0, furni_substage=0) {
    _furni_page[playerid] = furni_page;
    _furni_stage[playerid] = furni_stage;
    _furni_substage[playerid] = furni_substage;

    if (furni_page==-1) {
        ShowPlayerDialog(playerid, FURNI_DIALOGID_MAIN, DIALOG_STYLE_LIST, "House furniture", "Buy furniture\nEnable Select Mode\nSelect Item from list\nSell furniture", "Select", "Close");
    } else {
        switch (furni_page) {
            case FURNIPAGE_MAIN_BUY: {
                //furni_showCatalog(playerid);
                //CallLocalFunction("furni_showCatalog_pub", "i", playerid);
                print(">1");
                SetTimerEx("furni_showCatalog_pub", 5000, false, "i", playerid);
            }
        }
    }
    return 1;
}

furni_DialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    #pragma unused inputtext
    if (dialogid==FURNI_DIALOGID_MAIN) {
        new furni_page = _furni_page[playerid];
        new furni_stage = _furni_stage[playerid];
        //new furni_substage = _furni_substage[playerid];
        if (response) {
            switch (furni_page) {
                case -1: {
                    furni_showDialog(playerid, listitem); //When user selects 'Buy furniture' furni_showDialog(playerid,FURNIPAGE_MAIN_BUY) is called
                }
            }
        } else {
            _furni_page[playerid]=0;
            _furni_stage[playerid]=0;
            _furni_substage[playerid]=0;
            if (furni_page>-1) {
                furni_showDialog(playerid);
            }
        }
        return 1;
    }
    return 0;
}

Error:
pawn Code:
[16:19:08] >1
[16:19:08] [debug] Run time error 6: "Invalid instruction"
[16:19:08] [debug]  Unknown opcode 0x80000000 at address 0x0000001C
[16:19:08] [debug] AMX backtrace:
[16:19:08] [debug] #0 0000001c in public OnDialogResponse () from grimrandomerCNR.amx
[16:19:14] >2
[16:19:14] furni_showCatalog (0,1)


Any help appreciated.



Thanks, Grim.



Edit:
I found my own error xD

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if (furni_DialogResponse(playerid, dialogid, response, listitem)) return 1;
}

Should be:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if (furni_DialogResponse(playerid, dialogid, response, listitem, inputtext)) return 1;
}
__________________
Grimrandomer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error 6: "Invalid instruction" PakPak Scripting Help 1 21/12/2013 08:47 PM
Run time Error 6: "Invalid Instruction" Stephano Scripting Help 3 03/06/2013 03:40 AM
Run time error 06: "Invalid instruction" lukonic Server Support 0 18/03/2013 02:40 PM
Run Time Error 6 "Invalid Instruction" HighFlyer Scripting Help 2 17/09/2012 05:47 PM


All times are GMT. The time now is 01:18 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.