SA-MP Forums Archive
Hook/CallLocalFunction causing crash. - 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: Hook/CallLocalFunction causing crash. (/showthread.php?tid=294067)



Hook/CallLocalFunction causing crash. - Norn - 31.10.2011

So I thought I had this working perfectly but apparently not, when I use dialogs in my gamemode with this included the server crashes.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) {
        case NRRADIO_DIALOG_ID:
        {
            if(response) {
                new radioid = RadioIDFromDialogOrder(playerid, listitem);
                RadioPlay(playerid, radioid);
                format(nrTextString,sizeof(nrTextString),"[nRadio:] Stream for %s started.", RadioNameFromID(radioid));
                SendClientMessage(playerid, 0xADD8E6FF, nrTextString);
            }
            else {
                RadioInitDialog(playerid);
            }
        }
        case NRCATEGORIES_DIALOG_ID:
        {
            if(response) {
                RadioCategoryBrowse(playerid, listitem);
            }
        }
    }
    return CallLocalFunction("nradio_OnDialogResponse", "dddds", playerid, dialogid, response, listitem, inputtext);
}

#if defined _ALS_OnDialogResponse
    #undef OnDialogResponse
#else
    #define _ALS_OnDialogResponse
#endif
#define OnDialogResponse nradio_OnDialogResponse
forward nradio_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
Quote:
Originally Posted by crashdetect.log
[00:47:36]: The server has been crashed by native CallLocalFunction called at line 280 in file C:\Users\Administrator\Desktop\SA-MP Server\pawno\include\nradio.inc.
[00:47:36]: Backtrace (most recent call first):
[00:47:36]: #0: OnDialogResponse (entry point) in file C:\Users\Administrator\Desktop\SA-MP Server\pawno\include\nradio.inc



Re: Hook/CallLocalFunction causing crash. - [HiC]TheKiller - 31.10.2011

Make sure that you're not returning a null value at all or it will crash. Make any null values into \1 and use IsNull. It's really stupid how CallLocalFunction / CallRemoteFunction crashes because of these issues.