[Tutorial] ALS Hook Method 7
#3

Код:
public OnPlayerConnect(playerid)
{
    #if defined MyLib_OnPlayerConnect
        MyLib_OnPlayerConnect(playerid);
    #endif
    return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MyLib_OnPlayerConnect
#if defined MyLib_OnPlayerConnect
    forward MyLib_OnPlayerConnect(playerid);
#endif
You should add an else statement in case of returning 1 in callbacks; Because we don't always have to return 1 in callbacks.

Код:
public OnPlayerConnect(playerid)
{
    #if defined MyLib_OnPlayerConnect
        MyLib_OnPlayerConnect(playerid);
    #else
   	 	return 1;
	#endif

}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MyLib_OnPlayerConnect
#if defined MyLib_OnPlayerConnect
    forward MyLib_OnPlayerConnect(playerid);
#endif
Reply


Messages In This Thread
ALS Hook Method 7 - by !damo!spiderman - 18.05.2015, 03:51
Re: ALS Hook Method 7 - by Crayder - 18.05.2015, 03:56
Re: ALS Hook Method 7 - by Gammix - 18.05.2015, 08:36
Re: ALS Hook Method 7 - by Yashas - 18.05.2015, 08:59
Re: ALS Hook Method 7 - by Jonny5 - 07.06.2015, 14:33

Forum Jump:


Users browsing this thread: 2 Guest(s)