AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semiclip (https://forums.alliedmods.net/showthread.php?t=296265)

edon1337 04-16-2017 08:39

Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semiclip
 
Hey, my questions for today are :

1. What's the difference between Orpheu and Rage ?

2. Where can I find the list of functions that I can hook with OrpheuRegisterHook ?

3. Why doesn't Ham_AddPoints work when I Hook it (RegisterHam) but works when I call it (ExecuteHam/B) ?

4. How to make a permanent player trail? The existing plugin is really bad coded and I can't understand anything from it. I tried setting a task every 1 second and re-set the trail (TE_BEAMFOLLOW) but it lagged when player looked at it.

5. Why doesn't semiclip work when I hook FM_ShouldCollide, check if touched and toucher's classname is 'player' then use forward_return(FMV_CELL, 0) and return FMRES_SUPERCEDE ? But it works for grenades...

Thanks.

klippy 04-16-2017 09:08

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
1. It's explained in the Rage thread: https://forums.alliedmods.net/showthread.php?t=179706
But it seems like it never made it out of Beta and I didn't really see people use it. It's potentially more powerful, but it's more difficult to use (create hook handlers that is). Orpheu is good enough.

2. In your amxmodx/configs/orpheu/, in functions and virtualFunctions folders. There's not a set list of functions you can hook, it's totally dynamic and you have to provide data in these folders for Orpheu to use. That's done using JSON files containing signatures or other data for functions. You can find many around the forums as examples.

3. Looks like CBasePlayer::AddPoints() is only used by CGameScore ("game_score" entity?). It works, but it's probably not called when you expect it to be.

5. According to ReGameDLL_CS, it looks like CS doesn't even support ShouldCollide API in the first place. I.e: it's never called.

edon1337 04-16-2017 09:57

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
Quote:

Originally Posted by KliPPy (Post 2512690)
1. It's explained in the Rage thread: https://forums.alliedmods.net/showthread.php?t=179706
But it seems like it never made it out of Beta and I didn't really see people use it. It's potentially more powerful, but it's more difficult to use (create hook handlers that is). Orpheu is good enough.

That sounds cool, what can I do with Rage that I can't with Orpheu ?

2.
Quote:

Originally Posted by KliPPy (Post 2512690)
In your amxmodx/configs/orpheu/, in functions and virtualFunctions folders. There's not a set list of functions you can hook, it's totally dynamic and you have to provide data in these folders for Orpheu to use. That's done using JSON files containing signatures or other data for functions. You can find many around the forums as examples.

What's this 'InstallGameRules' signature?

3.
Quote:

Originally Posted by KliPPy (Post 2512690)
Looks like CBasePlayer::AddPoints() is only used by CGameScore ("game_score" entity?). It works, but it's probably not called when you expect it to be.

I added a print but it never happened. Maybe Arkshine should look forward to it :)

5.
Quote:

Originally Posted by KliPPy (Post 2512690)
According to ReGameDLL_CS, it looks like CS doesn't even support ShouldCollide API in the first place. I.e: it's never called.

I'm not using ReHLDS..
Quote:

Originally Posted by edon1337 (Post 2512685)
But it works for grenades...

Thanks Klippy :)

klippy 04-16-2017 13:23

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
1. Not sure. Possibly use it to hook stuff that can't be hooked otherwise by Orpheu because some data types are not supported. It should be possible to go around that stuff in Orpheu with some memory hacking though. You should just stick with Orpheu and not bang your head thinking about Rage.

2. InstallGameRules is a function in the game dll that gets called when a g_pGameRules global variable is to be initialized in the game.
HL version of this function (each mod can have its own, but they all return a CGameRules pointer): https://mxr.alliedmods.net/hlsdk/sou...erules.cpp#311
It's just an easy way of retrieving g_pGameRules which can be used to retrieve all kinds of game data or call some methods from CGameRules or CHalfLifeMultiplay classes. New 1.8.3 get_gamerules_* natives are dealing with this g_pGameRules.

3. When do you expect it to be called? As I said, it looks like it's only called by game_score entity and not when for example someone gets a frag by killing other player.

5. I believe ReGameDLL_CS accurately depicts what Valve's CS code is. I'll maybe take a deeper look into this.

HamletEagle 04-16-2017 15:10

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
Even if Klippy already answered, I feel like you are still confused. Maybe I can help, idk.

Quote:

2. Where can I find the list of functions that I can hook with OrpheuRegisterHook ?
You find that list in the game/engine dll's. Imagine that the game is a plugin. In your plugin you have functions for doing things. The game has functions too, be it inside the engine or inside the mod dll.
With orpheu you get access to this internal functions. That's why orpheu is great, you can interact directly with the game and change it's behaviour depending on what you want to do.
That way you don't need to create ugly workarounds or inneficient code.

Quote:

What's this 'InstallGameRules' signature?
It's just a function like any other function from the game. You see it often used because it's useful, as Klippy already said, to retrieve the address of g_pGameRules object. Using this object you can alter game rules offsets(which basically control how the game works) or even hook functions without creating a signature(because you use that address as a base and increment from it, like a list).

Quote:

I'm not using ReHLDS..
Yeah, but ReGameDLL and ReHLDS are the same as original hlds. We use them as a reference, to understand how things work, because valve keeps the original sources private. For example, if you want to understand what happens on new round you just look inside regamedll for CHalfLifeMultiplay::RestartRound. There you have all the code that is executed at that point.
As a matter of fact, that's why we hook new round with HTLV event, because that message is fired from RestartRound.

Quote:

5. I believe ReGameDLL_CS accurately depicts what Valve's CS code is. I'll maybe take a deeper look into this.
They are the same, because they have the pure version and they claim that this one is producing the exact same output as the original hlds.

Quote:

I added a print but it never happened. Maybe Arkshine should look forward to it
Arkshine can't do anything about ham functions, nor anyone else except valve. Hamsandwich does the same thing as orpheu, it uses the functions from the game(only the virtual ones, which can be hooked without a signature, by providing an offset - i.e. their position in the respective function virtual table). This means that amxx has no control on what this functions do or how they work/don't work, game is responsible for that. AMXX only give access to them.

So for example Ham_Spawn is basically CBasePlayer::Spawn.

Also note that there are functions which can be called but can't be hooked, because they are not never called. You should not assume that any functions acts like you would expect it to, valve code is confusing. You should actually check the regamedll code for that specific function and see from where it's called, what this function really do, etc. That way you will know if your code is wrong or simply that function does not do what you expect it to.

PRoSToTeM@ 04-16-2017 15:36

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
Quote:

Originally Posted by edon1337 (Post 2512685)
5. Why doesn't semiclip work when I hook FM_ShouldCollide, check if touched and toucher's classname is 'player' then use forward_return(FMV_CELL, 0) and return FMRES_SUPERCEDE ? But it works for grenades...

ShouldCollide is used for non-player entity move. So it can be used for non-player against non-player and non-player against player collides. Player move uses its own "PlayerMove" (PM) code.

edon1337 04-16-2017 15:48

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
Quote:

Originally Posted by KliPPy (Post 2512739)
3. When do you expect it to be called?

Whenever ScoreBoard (Frags/Deaths) gets updated.

Quote:

Originally Posted by HamletEagle (Post 2512763)
You find that list in the game/engine dll's. Imagine that the game is a plugin. In your plugin you have functions for doing things. The game has functions too, be it inside the engine or inside the mod dll.
With orpheu you get access to this internal functions. That's why orpheu is great, you can interact directly with the game and change it's behaviour depending on what you want to do.
That way you don't need to create ugly workarounds or inneficient code.

So all functions can be found in mp.dll by using IDA ?

Quote:

Originally Posted by KliPPy (Post 2512739)
Arkshine can't do anything about ham functions, nor anyone else except valve.

Why ?

Quote:

Originally Posted by PRoSToTeM@ (Post 2512776)
ShouldCollide is used for non-player entity move. So it can be used for non-player against non-player and non-player against player collides. Player move uses its own "PlayerMove" (PM) code.

But PlayerMove can be hooked only with Orpheu, right ?

Thanks guys.

HamletEagle 04-16-2017 16:03

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
It's better to look in cs.so, because on linux function have names. Look into mp.dll when creating the windows signature.

I've already explained why. Ham functions are actually game functions, amxx has no control over them. Read again my post please.

edon1337 04-16-2017 16:11

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
Quote:

Originally Posted by HamletEagle (Post 2512784)
It's better to look in cs.so, because on linux function have names. Look into mp.dll when creating the windows signature.

I've already explained why. Ham functions are actually game functions, amxx has no control over them. Read again my post please.

Okay, thanks, and sorry :)

klippy 04-16-2017 16:21

Re: Orpheu&Rage | Ham_AddPoints Hook | Permanent Player Trail | FM_ShouldCollide Semi
 
Quote:

Originally Posted by edon1337 (Post 2512779)
Whenever ScoreBoard (Frags/Deaths) gets updated.

That's not when it gets called. It looks like it only gets called when a "game_score" entity is used.


All times are GMT -4. The time now is 17:59.

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