AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   detect when pev_body changes (https://forums.alliedmods.net/showthread.php?t=254999)

Jhob94 01-09-2015 09:24

detect when pev_body changes
 
Hello. I have a question.
Is there anyway to know when pev_body changes without tasks?
Can i get it with fakemeta/engine? Or maybe a new module, or with orpheu/rage if possible. Or is it impossible?

Arkshine 01-09-2015 09:51

Re: detect when pev_body changes
 
You can either:

- Hooking AddToFullPack, which is probably a bad idea
- Hooking specific functions where pev->body is used, which sounds like a pain in the ass
- Explaining what you want really to do, avoiding a XY problem, which sounds the most reasonable with high chance to have a better solution.

Jhob94 01-09-2015 10:05

Re: detect when pev_body changes
 
Somehow it seems that the game resets pev_body in some moments of the game. Not sure if is spawning, end round. Idk when, so i should hook something when pev_body changes. A note that must be said is that i tested the plugin in a server that changes teams on end round. So maybe it resets when the team changes. But model change is blocked so i really dont see why this is happening. I need this so i can know when pev_body is being reseted.

Arkshine 01-09-2015 10:29

Re: detect when pev_body changes
 
So you're talking player's pev->body. Because it's used by others entities.

From game:

- Set to 1:
when you buy defuser kit (BuyItem)
when C4 is given (CHalfLifeMultiplay::GiveC4)
when you grab the c4 on the ground (CWeaponBox::Touch)
when you get defuser kit on the ground (CItemThighPack::MyTouch)
when you spawn and you have already a defuser kit (CBasePlayer::Spawn)
- Set to 0:
when you choose appereance (HandleMenu_ChooseAppearance)
when all items are removed and you have whatever c4/defuser (RemoveAllItems)
when you are killed and you have a defuser kit (CBasePlayer::Killed)
when you become VIP (CBasePlayer::MakeVIP)
when VIP has touched the safe zone, when you disappears and if you have defuser kit (CBasePlayer::Disappear)
when you spawn and you don't have defuser kit (CBasePlayer::Spawn)
when you drop C4 (CBasePlayer::DropPlayerItem)
when you switch team and you have the defuser kit (CBasePlayer::SwitchTeam)
when you plant the bomb (CC4::PrimaryAttack)
You still don't explain what are you trying to do.

Jhob94 01-09-2015 10:38

Re: detect when pev_body changes
 
I am trying to block all the sets by the default game. But hooking all of that seems huge. Is it all necessary or i can do something else with some module like orpheu (or a new module)?

Edit: If is possible with orpheu/rage/okapi, dont do it by your own. Just give me some tips of what i must do :3

Arkshine 01-09-2015 10:56

Re: detect when pev_body changes
 
XY problem. Could you stop that please, and explaining what are you trying to do, not what you think the solution is.

Jhob94 01-09-2015 11:37

Re: detect when pev_body changes
 
I am trying to use player models with sub-models so i can use unlimited player models and only 1 model will be precached. But since pev_body is changed, i must block game from changing it so the plugin will be the only thing able to modify it. I can use a bool to allow changing when plugin calls and turn the bool false after change the pev.

RateX 01-09-2015 12:26

Re: detect when pev_body changes
 
When exactly did this happen?
If you absolutely sure it happened when change team, you can hook spawn post with ham and reset to your desire submodel.
Also, you can try to follow conditions given by Arkshine and change to your sub accordingly.
I myself have never seen something like what you have described

Jhob94 01-09-2015 12:30

Re: detect when pev_body changes
 
Well idk when, and yes, i change in ham spawn. But the game gives a bomb itself, so i guess it's normal this is happening, since the bomb is given after the spawn event.

RateX 01-09-2015 13:24

Re: detect when pev_body changes
 
Then hook weapon pickup message->change to your sub again:)


All times are GMT -4. The time now is 15:28.

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