SA-MP Forums Archive
Issue With ******'s Hooking When Having Strings as Parameter - 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: Issue With ******'s Hooking When Having Strings as Parameter (/showthread.php?tid=509430)



Issue With ******'s Hooking When Having Strings as Parameter - Campbell- - 26.04.2014

I'm hooking my callbacks according to this method: https://sampforum.blast.hk/showthread.php?tid=441293

Now, it seems to work perfectly fine ... just not for callbacks that have a string as a parameter. I'm getting the following error:

Код:
error 029: invalid expression, assumed zero
Code that's working fine:

pawn Код:
public OnPlayerConnect(playerid) {
    // My code here ...
   
    #if defined my_OnPlayerConnect
        my_OnPlayerConnect(playerid);
    #endif
    return 1;
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect my_OnPlayerConnect
#if defined my_OnPlayerConnect
    forward my_OnPlayerConnect(playerid);
#endif
Code that's not working due to having a string as a parameter:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    // My code here...

    #if defined my_OnDialogResponse
        my_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
    #endif
    return 1;
}

#if defined _ALS_OnDialogResponse
    #undef OnDialogResponse
#else
    #define _ALS_OnDialogResponse
#endif
#define OnDialogResponse my_OnDialogResponse
#if defined my_OnDialogResponse
    forward my_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
#endif



Re: Issue With ******'s Hooking When Having Strings as Parameter - iZN - 26.04.2014

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    // My code here...

    #if defined my_OnDialogResponse
        my_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); // remove []
    #endif
    return 1;
}

#if defined _ALS_OnDialogResponse
    #undef OnDialogResponse
#else
    #define _ALS_OnDialogResponse
#endif
#define OnDialogResponse my_OnDialogResponse
#if defined my_OnDialogResponse
    forward my_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
#endif



Re: Issue With ******'s Hooking When Having Strings as Parameter - Campbell- - 26.04.2014

Oh ... true, now pretty obvious. I'm passing a string, not accepting one. Thanks!