View Single Post
Old 27/03/2020, 09:33 AM   #1
pollo97
Big Clucker
 
pollo97's Avatar
 
Join Date: Sep 2011
Location: Italy
Posts: 83
Reputation: 4
Default Issue on creating DynamicObject using y_hooks

Hi to everyone!
I'm programming using modules and in a first try I separeted my maps in three different files, hooking those to OnGameModeInit callback, but I noticed that only 1000 out of 1300 objects were created.
I tried to move all the maps under OnGameModeInitEx, that is the first OnGameModeInit being called and it worked!
In the 'main.pwn' I've got this code:

Code:
#include <a_samp>
public OnGameModeInit()
{

    OnGameModeInitEx();

    #if defined main_OnGameModeInit
        return main_OnGameModeInit();
    #else
        return 1;
    #endif
}
#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif
 
#define OnGameModeInit main_OnGameModeInit
#if defined main_OnGameModeInit
    forward main_OnGameModeInit();
#endif
 
// includes and definitions

OnGameModeInitEx()
{
    // maps here works
}
Instead, in one of the map file where I hook OnGameModeInit, the code is:
Code:
#include <YSI_Coding\y_hooks>

hook OnGameModeInit()
{
  // CreateDynamicObject
  return 1;
}
I want to understand if there are some problems related with streamer and hooks or if is due to my inexperience in hooking callbacks.
pollo97 is offline   Reply With Quote