Jump to content
  • 0

Explicatie Y_Hook...


xxSPEEDYxx

Question

3 answers to this question

Recommended Posts

Nu stiu exact ce face y_hook,dar din cate am vazut foloseste o metoda prin care poti folosi de doua ori intr-un gm acelasi callback.

[pawn]public OnGameModeInit()

{

    // myinc OnGameModeInit

    return CallLocalFunction("myinc_OnGameModeInit", "");

}

#if defined _ALS_OnGameModeInit

    #undef OnGameModeInit

#else

    #define _ALS_OnGameModeInit

#endif

#define OnGameModeInit myinc_OnGameModeInit

forward myinc_OnGameModeInit();[/pawn]

De exemplu,faci in inc cu... 'cookie',si trebuie sa resetezi variabila cand intra jucatorul,si de obicei trebuia sa faci o functie separata,pe care cel care folosea inc-ul trebuia sa o puna la OnPlayerConnect,dar cu asta,nu mai trebuie sa faci o alta functi,trebuie doar sa pui variabilile la OnPlayerConnect si sub el folosesti metoda 'ALS'

[pawn]public OnPlayerConnect(playerid)

{

    Cokies[playerid] = 0;

    return CallLocalFunction("CookieSystem_OnPlayerConnect", "");

}

#if defined _ALS_OnPlayerConnect

    #undef CookieSystem_OnPlayerConnect

#else

    #define _ALS_OnPlayerConnect

#endif

#define OnPlayerConnect CookieSystem_OnPlayerConnect

forward CookieSystem_OnPlayerConnect();[/pawn]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.