-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FCNPC_OnCreate isn't getting called. (Under OnGameModeInit) #200
Comments
One thing I can say is the following, which is also mentioned on the wiki: Is it only FCNPC_OnCreate, or also other FCNPC callbacks? |
Just tested on my own. It seems like FCNPC_OnCreate doesn't get called when you use FCNPC_Create under OnGameModeInit. I also tested FCNPC_Spawn and FCNPC_OnSpawn isn't getting called either. When I delay the creation of the NPC with a timer, the callback does get called. I also tested this on non-DL and the result is exactly the same. It seems that it has something to do with when the server is starting. EDIT:
and the following minimal gamemode: #include <a_samp>
#include <streamer>
#include <FCNPC>
main() {}
public OnGameModeInit()
{
new obj = CreateObject(1271, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
MoveObject(obj, 0.1, 0.1, 0.1, 1);
new obj2 = CreateDynamicObject(1271, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
MoveDynamicObject(obj2, 0.1, 0.1, 0.1, 1);
new npc = FCNPC_Create("testNPC");
FCNPC_Spawn(npc, 0, 0.0, 0.0, 0.0);
return 1;
}
public OnObjectMoved(objectid)
{
print("MOVED");
return 1;
}
public OnDynamicObjectMoved(STREAMER_TAG_OBJECT:objectid)
{
print("DYN MOVED");
return 1;
}
public FCNPC_OnCreate(npcid)
{
print("NPC CREATE");
return 1;
} This is the output:
As you can see, both MOVED from the regular object and DYN MOVED from the streamer object are displayed as should be, but NPC CREATE isn't. |
I also encountered this problem, any fix other than using it outside gamemode or using timer? |
Wait 5 ticks for each FCNPC_Create. (with PawnPlus for example) |
Or (BE CAREFUL!!!) call CallbackManager::Init inside OnSpawn or OnCreate callbacks, and recompile plugin. |
This can be easily fixed by moving the |
For some reason FCNPC_OnCreate isn't getting called at all after creating an NPC. I'm using the latest release as of making this (https://github.com/ziggi/FCNPC/releases/tag/v2.0.0-rc.7) specifically for 0.3.DL. I've also tried using the other 0.3.DL release and FCNPC_OnCreate isn't getting called. This is the test script:
The results (server-log):
It shows the NPC has connected, however it just doesn't call FCNPC_OnCreate, yeah. I've even tried printing within the include, specifically where it's hooking FCNPC_OnCreate and it doesn't print anything at all.
The text was updated successfully, but these errors were encountered: