SA-MP Forums Archive
Returning in Filterscripts. - 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: Returning in Filterscripts. (/showthread.php?tid=355485)



Returning in Filterscripts. - ReneG - 30.06.2012

What is the issue with returning of callbacks in filterscripts?

I'm using OnPlayerSpawn, OnPlayerConnect/Disconnect, and OnPlayerEditObject, what do I return to avoid bugs.

I've read you have to return 0, or the callback in the main mode doesn't get called.


Re: Returning in Filterscripts. - ikkentim - 30.06.2012

I think only onplayercommand handles the return value, but im not sure


Re: Returning in Filterscripts. - iggy1 - 30.06.2012

Also if you return 1 at the end of OnDialogResponse in your gamemode/filterscript when no dialogids have been found, your filterscripts dialogs will bug (any filterscript that is loaded after the one that returns 1).

It's fine to return 1 if a dialog is found.

EG how it should be (without response code to keep it short),

pawn Код:
#define SOME_DIALOG_ID      1

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    switch(dialogid)
    {
        case SOME_DIALOG_ID:
        {
            //dialog found return 1
            return 1;
        }
    }

    //no dialogs found return 0
    return 0;
}
This is why some people report dialogs not working. When they respond to a dialog and it does nothing but close it.