AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved How to hook SetModel using Orpheu (https://forums.alliedmods.net/showthread.php?t=334813)

Natsheh 10-21-2021 09:52

How to hook SetModel using Orpheu
 
As the title says how do i hook setting entity model or FM_SetModel through Orpheu i tried searching for the signature in cs.so but I've failed.

HamletEagle 10-21-2021 10:29

Re: How to hook CBaseEntity SetModel using Orpheu
 
pfnSetModel is an engine function, not present in cs.so
Also, since this function is exported, you do not need a signature.

You can check how it is done here(https://forums.alliedmods.net/showthread.php?t=259880) to hook pfnPrecache* and do the same for pfnSetModel. This is the info you need to build the proper file: https://github.com/alliedmodders/hls.../eiface.h#L111

Natsheh 10-21-2021 11:04

Re: How to hook CBaseEntity SetModel using Orpheu
 
Thanks alot i didn't know it was an engine function, doesn't engine functions require signatures?

Edit : oh nvm, now i see it needs only function arguments and return definitions


Code:

{
    "name" : "PrecacheModel",
    "library" : "engine",
    "arguments" :
    [
        {
            "type" : "char *"
        }
    ],
    "return" :
    {
        "type" : "int"
    }
}


HamletEagle 10-21-2021 12:56

Re: How to hook CBaseEntity SetModel using Orpheu
 
Yes, they do not need signatures because they are exported for use. You only need the name(as stated in the link I sent you for eiface.h), arguments and return value.

Natsheh 10-21-2021 17:06

Re: How to hook CBaseEntity SetModel using Orpheu
 
Quote:

Originally Posted by HamletEagle (Post 2761213)
Yes, they do not need signatures because they are exported for use. You only need the name(as stated in the link I sent you for eiface.h), arguments and return value.

A problem, argument edict_t is not defined in orpheu how i can define it?

HamletEagle 10-22-2021 03:00

Re: How to hook CBaseEntity SetModel using Orpheu
 
edict_s

Natsheh 10-22-2021 04:03

Re: How to hook CBaseEntity SetModel using Orpheu
 
Quote:

Originally Posted by HamletEagle (Post 2761290)
edict_s

What is the difference?

HamletEagle 10-22-2021 06:12

Re: How to hook CBaseEntity SetModel using Orpheu
 
No difference. edict means entity dictionary, it contains data about entities that are networked to the client.
"s" means structure so "entity dictionary structure". This struct is defined here: https://github.com/alliedmodders/hls...ne/edict.h#L19 (think of it like "enum" in pawn).

"t" in edict_t comes from "type". edict_t is an "alias" of "struct edict_s". https://github.com/dreamstalker/rehl...n/const.h#L786

In C, when you declare a structure and want to use it as a data type, you have to specify "struct struct_name" everywhere, which gets annoying. It is a common practice to define a type like "edict_t" which is a synonym of "struct edict_s". It is cleaner and shorter.

tl;dr
Code:

struct edict_s* my_var;
edict_t *my_other_var;

these are equivalent

Natsheh 10-22-2021 06:14

Re: How to hook CBaseEntity SetModel using Orpheu
 
You're amazing thanks for the explanation.


All times are GMT -4. The time now is 11:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.