kyleflow 35 Report post Posted November 17, 2023 I see some question about hook and serialize but none sharing the actual clear step on how to implement it. I see that I need to copy paste the hook files and made it as hook.lua but the loading part here is confusing. I did try to load it by putting it inside other files and called it by dofile but it will not load on my GS. And some says put it inside SDK. I don't know how to do so. Can some one do a step by step on how to implement hook and serialize files. Like the location of the files, the loading location and its called function. Thanks. Quote Share this post Link to post Share on other sites
Lua 35 Report post Posted November 17, 2023 I saw some1 saying that serialize crashs the gameserver too. Is it true? Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted November 17, 2023 2 hours ago, Lua said: I saw some1 saying that serialize crashs the gameserver too. Is it true? Same as the purpose of the question above, I yet to implement it. So I don't know personally if it does crash the GS Hope someone can explain it to us Quote Share this post Link to post Share on other sites
AlGhoul 66 Report post Posted November 18, 2023 The first Lua file that gets loaded after loading Lua libs, its dependencies and C API functions which are meant to be exposed to Lua, mentioned here in this function (method) BOOL CGameApp::Init(); which in turn calls InitLuaScript(); (which does what I described earlier), afterwards a call is made to this function LoadScript(); which calls the following function: void ReloadLuaInit() { lua_dofile( g_pLuaState, GetResPath("script/initial.lua") ); } So the first loaded file is at script directory, called initial.lua; I suggest that you load your hooks, globally needed functions, vars and definitions. With that said, I've seen some hooks and serializers that are not compatible with the recent versions of Lua (versions used in CO's for example), so double check them and use the correct ones depending on your Lua's version (meaning use older hooks/serializers if you are using an older version of lua). Quote Kind regards, AG. Share this post Link to post Share on other sites
kyleflow 35 Report post Posted November 18, 2023 5 hours ago, AlGhoul said: The first Lua file that gets loaded after loading Lua libs, its dependencies and C API functions which are meant to be exposed to Lua, mentioned here in this function (method) BOOL CGameApp::Init(); which in turn calls InitLuaScript(); (which does what I described earlier), afterwards a call is made to this function LoadScript(); which calls the following function: void ReloadLuaInit() { lua_dofile( g_pLuaState, GetResPath("script/initial.lua") ); } So the first loaded file is at script directory, called initial.lua; I suggest that you load your hooks, globally needed functions, vars and definitions. With that said, I've seen some hooks and serializers that are not compatible with the recent versions of Lua (versions used in CO's for example), so double check them and use the correct ones depending on your Lua's version (meaning use older hooks/serializers if you are using an older version of lua). Sorry AG, since this is your 1st reply, I did not know what you have explain previously. Seem like the code mentioned above is a SC script not a lua type script. Or did you try to explain that I can load hook.lua through initial.lua files ? I don't have SC and I try not to involve myself with SC since my knowledge is not there yet. Can you details out more about what you are trying to show there. Thanks AG Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted November 18, 2023 @AlGhoul I added a picture below of me loading the hook and serialize inside initial.lua. is this consider properly load? just for confirmation Quote Share this post Link to post Share on other sites