Here, I made list that hook these functions.
You can try mess and trace with your testing server.
There should not much wrong with params+returns and all those hooks work (at least Cs:s).
If do then tell.
I maybe add later descriptions to callbacks what can change and happens.
Player.h
Code:
/*
Player.h
// Observer functions
virtual bool StartObserverMode(int mode); // true, if successful
virtual void StopObserverMode( void ); // stop spectator mode
virtual bool ModeWantsSpectatorGUI( int iMode ) { return true; }
virtual bool SetObserverMode(int mode); // sets new observer mode, returns true if successful
virtual int GetObserverMode( void ); // returns observer mode or OBS_NONE
virtual bool SetObserverTarget(CBaseEntity * target);
virtual void ObserverUse( bool bIsPressed ); // observer pressed use
virtual CBaseEntity *GetObserverTarget( void ); // returns players targer or NULL
virtual CBaseEntity *FindNextObserverTarget( bool bReverse ); // returns next/prev player to follow or NULL
virtual int GetNextObserverSearchStartPoint( bool bReverse ); // Where we should start looping the player list in a FindNextObserverTarget call
virtual bool IsValidObserverTarget(CBaseEntity * target); // true, if player is allowed to see this target
virtual void CheckObserverSettings(); // checks, if target still valid (didn't die etc)
virtual void JumptoPosition(const Vector &origin, const QAngle &angles);
virtual void ForceObserverMode(int mode); // sets a temporary mode, force because of invalid targets
virtual void ResetObserverMode(); // resets all observer related settings
virtual void ValidateCurrentObserverTarget( void ); // Checks the current observer target, and moves on if it's not valid anymore
virtual void AttemptToExitFreezeCam( void );
*/
Almost forgot most important thing
As usually after friendly-valve-update in games, offsets can be change and lead to errors/crash/glitches !!
upgrade gamedata
Thanks to Bernihttp://www.sourcemodplugins.org/pages/vtableoffsets/
Check these box from web page and create gamedata file at bottom "Export for All Games" or for one game mod "Export for This Game"
Then edit, remove all "prefix":
CHL2MP_Player::
CBasePlayer::
CDODPlayer::
CINSPlayer::
CTerrorPlayer::
CPVK2Player::
CTFPlayer::
To get started, compile plugin yourself
Install:
Extension Dr!fterDHooks (Dynamic Hooks - Dev Preview)
...addons/sourcemod/gamedata/all.games-observer.txt
...addons/sourcemod/scripting/dhooks-test-observer.sp
My bug
*My problems with DHooks is this
If you get same problem, server not shutdown properly and stay background.
Try MetaMod:Source 1.8.8-hg775.zip or newer
*fixed all.games-observer.txt
Last edited by Bacardi; 04-29-2012 at 00:46.
Reason: update, close handle
As a note the return value you are getting on most of the hooks (the ones that aren't post hooks) is the default value assigned automatically to prevent issues. Its not the real return value. The only way to get the real return value is inside a post hook. So if you really want to get the return value you need to change them all to post hooks