Skip to content

Commit 99c0c6b

Browse files
committed
add init function
1 parent eb2d042 commit 99c0c6b

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

api_custom_entities.sma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ public FMHook_Spawn(pEntity) {
400400

401401
@Entity_SetPData(pEntity, g_itPData);
402402
g_itPData = Invalid_Trie;
403+
404+
ExecuteHookFunction(CEFunction_Init, iId, pEntity);
403405
}
404406
}
405407

include/api_custom_entities.inc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ enum CEPreset {
3232
};
3333

3434
enum CEFunction {
35-
CEFunction_Spawn, // Call when entity spawned
36-
CEFunction_Kill, // Call when some plugin try to kill entity. return PLUGIN_HANDLED to discard kill.
37-
CEFunction_Killed, // Call when entity killed
38-
CEFunction_Remove, // Call when entity removed
39-
CEFunction_Picked, // Call when player pick item
40-
CEFunction_Pickup, // Call when player touch item. Should return PLUGIN_HANDLED if picked.
41-
CEFunction_KVD, // Call when new key value obtained
42-
CEFunction_Activate, // Call every trigger activation check
43-
CEFunction_Activated // Call when player activates trigger
35+
CEFunction_Spawn, // Calls when entity spawned
36+
CEFunction_Kill, // Calls when some plugin try to kill entity. return PLUGIN_HANDLED to discard kill.
37+
CEFunction_Killed, // Calls when entity killed
38+
CEFunction_Remove, // Calls when entity removed
39+
CEFunction_Picked, // Calls when player pick item
40+
CEFunction_Pickup, // Calls when player touch item. Should return PLUGIN_HANDLED if picked.
41+
CEFunction_KVD, // Calls when new key value obtained
42+
CEFunction_Activate, // Calls every trigger activation check
43+
CEFunction_Activated, // Calls when player activates trigger
44+
CEFunction_Init // Calls when entity is initialized (on first spawn)
4445
};
4546

4647
/*

0 commit comments

Comments
 (0)