Jump to content
Sign in to follow this  
kyleflow

Hook and Serialize

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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).


Kind regards, AG.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...