Sign in to follow this  
Viking

Extension of an existing function

Recommended Posts

Hey guys,

I would like to change a function of cod4 which is public in the cod4x source.

What do i have to do to make the server use my modified function instead the one in the cod4x binaries?

 

Thanks in advance

Share this post


Link to post
Share on other sites
Plugin_RemoveCommand( "name" )

Followed by:

Plugin_AddCommand

 

Share this post


Link to post
Share on other sites

I came across this when checking some existing plugins and noticed it in b3hide.

 

But i think this is not what i am looking for.

The function of cod4 i would like to modify is not called by gsc or server cmd directly. (not sure how to name it, i am not a programmer)

 

As a short example:

https://github.com/callofduty4x/CoD4x_Server/blob/0581a7dc6c53b834877103e5982d9c8ab845b3c3/src/scr_vm_main.c#L611

imagine i would like to add a debug print when this function finished.

But to be able to use it on any Server i would like to compile a plugin with that modification instead of compiling a custom cod4x server Binary.

Share this post


Link to post
Share on other sites

I don't think plugin system allows you to do that easily. I'd guess you'd have to hook the function you want and change it there.

Share this post


Link to post
Share on other sites
On 4/3/2021 at 11:51 AM, Viking said:

What do i have to do to make the server use my modified function instead the one in the cod4x binaries?

to change a function coded in C, you have to alter it, recompile the source code and use the newly compiled binary.

maybe you can tell us what you want to achieve.

Share this post


Link to post
Share on other sites

I thought it would be possible with a plugin, just like replacing a gsc with gsx to tell cod4x to use the function in the plugin instead the function from source.

 

my goal is pretty simple, i want to remove the scoreboard when the player sends the +score command to the server and the game is not in intermission.

 

https://github.com/callofduty4x/CoD4x_Server/blob/0581a7dc6c53b834877103e5982d9c8ab845b3c3/src/g_cmds.c#L708

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.   Paste as plain text instead

  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