![]() |
how to see if the player is "actually" shooting/reloading
use if (pPlayer->v.oldbuttons & IN_ATTACK) (or IN_RELOAD) sometimes doesn't work correctly (eg, when the player has no ammo in clip but still pressing the mouse)
anyone has a better idea ? thanks. |
Re: how to see if the player is "actually" shooting/reloading
Checking which animation they are playing?
botman |
Re: how to see if the player is "actually" shooting/reloading
yes, that would work. FoxBot does this (it's a TFC bot). The source code is available so you might want to give it a look :)
|
Re: how to see if the player is "actually" shooting/reloading
I've tried this myself but it doesn't always work. With my bots in SvenCoop I tried checking if the bots animation was the ACT_RELOAD animation, but no animations had that set as the animation activity... guess it depends on what MOD you use.
|
Re: how to see if the player is "actually" shooting/reloading
for reloading, i guess you can simply check if a reload button is pressed, and then set a timer so you know the 'animation' is being played. it probably depends per mod, but hence i bet the avarage time taken to reload is 1 to 5 seconds (depending on the gun).
|
Re: how to see if the player is "actually" shooting/reloading
@Cheeseh:
that's not what FoxBot does. FoxBot hooks the pfnPlaybackEvent() to check for player animations. To my knowledge this function is 100% reliable. |
Re: how to see if the player is "actually" shooting/reloading
I beg your pardon ?
...from foxbot: Code:
void pfnPlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, here I'm catching CurWeapon message sent to ALL clients (not just bots), and when ammo decreased means a bullet has fired: Code:
bool CClient::MessageWrite(void *p) { Code:
class CClient |
Re: how to see if the player is "actually" shooting/reloading
eh? well, that changed, then.
I am positive they DID use pfnPlaybackEvent() and I recall Tom (RedFox) explaining me over there at botman's why it was just what I wanted and how to use this function to hook for various player animations. |
All times are GMT +2. The time now is 01:52. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.