gmcl_extras - Opening up the menu

This module is a module I’ve been using to learn c++ and how the source engine works. I’ve just added anything I thought would be useful.

[img_thumb]http://www.blackopsservers.com/imageupload/?di=15130143381410[/img_thumb]

Commands



lua_run_mn
lua_openscript_mn


Function list…

[lua]// Console stuff
console.Command( String )
console.IsVisible()
console.PrintColor( Color, String )
console.Clear()
console.Hide()
console.Popup()
console.AddText( String ) // Practically print without the automatic

console.UnrestrictedCommand( String ) // It's in the menu state, so who gives a shit
console.ServerCommand( String ) // Not really usefull :V

// Player stuff
client.GetAllPlayers(): Table of unique ids
client.GetPlayerSteamID( UserID )
client.GetFriendID( UserID )
client.IsPlayerMuted( EntIndex )
client.SetPlayerMuted( EntIndex )
client.GetPlayerLogo( UserID )
client.GetPlayerIndex( UserID )
client.GetPlayerName( UserID )
client.IsFakePlayer( UserID )
client.LocalPlayerUserID()
client.SetEyeAngles( Angle )
client.GetEyeAngles()

client.IsPaused()
client.IsRecordingDemo()
client.GetVideoModes() // Returns all possible video resolution modes
client.Time() // Same as curtime..
client.GetAppID()
client.GetEngineBuildNumber()
client.GetScreenAspectRatio()
client.GetMapName()
client.GetDXSupportLevel()
client.GetIP() // Current server IP
client.GetMaxPlayers()
client.IsInGame()
client.SupportsHDR()
client.GetKeyForBinding( String )
client.IsTakingScreenshot()
client.IsDrawingLoadingImage()
client.IsPlayingTimeDemo()
client.IsConnectedToVACSecureServer()
client.IsConnected()
client.ForceConVar( CVar, value )
client.IsPlayingDemo()

client.IsHammerRunning()
client.GetProductVersionString()
client.IsLowViolence()
client.IsInEditMode()[/lua]

This can be used on the client also, it just wont load the lua_run_menu and lua_openscript_menu commands.

Download: http://blackopsservers.com/blackops/files/gmcl_extras.rar
Download includes most of the stuff I use on my menu state. It also includes a player meta that makes use of all of those player functions.

About time someone made something like this

Global functions aren’t called when loaded in menu_plugins… :frowning:

very good

very good indeed

The last 4 Fuctions work fine for me. Your engine class is probably outdated, I’ll send you mine when I get home. Alternatively you can get it yourself by extracting the symbols from the Mac/Linux libs


abstract_class IVEngineClient
{
public:
	virtual int				GetIntersectingSurfaces( const model_t *model, const Vector &vCenter, const float radius, const bool bOnlyVisibleSurfaces, SurfInfo *pInfos, const int nMaxInfos ) = 0;
	virtual Vector			GetLightForPoint (const Vector &pos, bool bClamp) = 0;
	virtual IMaterial			*TraceLineMaterialAndLighting( const Vector &start, const Vector &end, Vector &diffuseLightColor, Vector& baseColor ) = 0;
	virtual const char			*ParseFile( const char *data, char *token, int maxlen ) = 0;
	virtual bool				CopyFile( const char *source, const char *destination ) = 0;
	virtual void				GetScreenSize( int& width, int& height ) = 0;
	virtual void				ServerCmd( const char *szCmdString, bool bReliable = true ) = 0;
	virtual void				ClientCmd( const char *szCmdString ) = 0;
	virtual bool				GetPlayerInfo( int ent_num, player_info_t *pinfo ) = 0;
	virtual int				GetPlayerForUserID( int userID ) = 0;
	virtual client_textmessage_t *TextMessageGet( const char *pName ) = 0;
	virtual bool				Con_IsVisible( void ) = 0;
	virtual int				GetLocalPlayer( void ) = 0;
	virtual const model_t		*LoadModel( const char *pName, bool bProp = false ) = 0;
	virtual float				Time( void ) = 0; 
	virtual float				GetLastTimeStamp( void ) = 0; 
	virtual CSentence			*GetSentence( CAudioSource *pAudioSource ) = 0;
	virtual float				GetSentenceLength( CAudioSource *pAudioSource ) = 0;
	virtual bool				IsStreaming( CAudioSource *pAudioSource ) const = 0;
	virtual void				GetViewAngles( QAngle& va ) = 0;
	virtual void				SetViewAngles( QAngle& va ) = 0;
	virtual int				GetMaxClients( void ) = 0;
	virtual	const char			*Key_LookupBinding( const char *pBinding ) = 0;
	virtual const char			*Key_BindingForKey( ButtonCode_t &code ) = 0;
	virtual void				StartKeyTrapMode( void ) = 0;
	virtual bool				CheckDoneKeyTrapping( ButtonCode_t &code ) = 0;
	virtual bool				IsInGame( void ) = 0;
	virtual bool				IsConnected( void ) = 0;
	virtual bool				IsDrawingLoadingImage( void ) = 0;
	virtual void				Con_NPrintf( int pos, const char *fmt, ... ) = 0;
	virtual void				Con_NXPrintf( const struct con_nprint_s *info, const char *fmt, ... ) = 0;
	virtual int				IsBoxVisible( const Vector& mins, const Vector& maxs ) = 0;
	virtual int				IsBoxInViewCluster( const Vector& mins, const Vector& maxs ) = 0;
	virtual bool				CullBox( const Vector& mins, const Vector& maxs ) = 0;
	virtual void				Sound_ExtraUpdate( void ) = 0;
	virtual const char			*GetGameDirectory( void ) = 0;
	virtual const VMatrix& 		WorldToScreenMatrix() = 0;
	virtual const VMatrix& 		WorldToViewMatrix() = 0;
	virtual int					GameLumpVersion( int lumpId ) const = 0;
	virtual int					GameLumpSize( int lumpId ) const = 0;
	virtual bool				LoadGameLump( int lumpId, void* pBuffer, int size ) = 0;
	virtual int					LevelLeafCount() const = 0;
	virtual ISpatialQuery*		GetBSPTreeQuery() = 0;

	virtual void		LinearToGamma( float* linear, float* gamma ) = 0;
	virtual float		LightStyleValue( int style ) = 0;
	virtual void		ComputeDynamicLighting( const Vector& pt, const Vector* pNormal, Vector& color ) = 0;
	virtual void		GetAmbientLightColor( Vector& color ) = 0;
	virtual int			GetDXSupportLevel() = 0;
	virtual bool        SupportsHDR() = 0;
	virtual void		Mat_Stub( IMaterialSystem *pMatSys ) = 0;
	virtual void		GetChapterName( char *pchBuff, int iMaxLength ) = 0;
	virtual char const	*GetLevelName( void ) = 0;
	virtual struct IVoiceTweak_s *GetVoiceTweakAPI( void ) = 0;
	virtual void		EngineStats_BeginFrame( void ) = 0;
	virtual void		EngineStats_EndFrame( void ) = 0;
	virtual void		FireEvents() = 0;
	virtual int			GetLeavesArea( int *pLeaves, int nLeaves ) = 0;
	virtual bool		DoesBoxTouchAreaFrustum( const Vector &mins, const Vector &maxs, int iArea ) = 0;
	virtual void		SetAudioState( const AudioState_t& state ) = 0;
	virtual int			SentenceGroupPick( int groupIndex, char *name, int nameBufLen ) = 0;
	virtual int			SentenceGroupPickSequential( int groupIndex, char *name, int nameBufLen, int sentenceIndex, int reset ) = 0;
	virtual int			SentenceIndexFromName( const char *pSentenceName ) = 0;
	virtual const char *SentenceNameFromIndex( int sentenceIndex ) = 0;
	virtual int			SentenceGroupIndexFromName( const char *pGroupName ) = 0;
	virtual const char *SentenceGroupNameFromIndex( int groupIndex ) = 0;
	virtual float		SentenceLength( int sentenceIndex ) = 0;
	virtual void		ComputeLighting( const Vector& pt, const Vector* pNormal, bool bClamp, Vector& color, Vector *pBoxColors=NULL ) = 0;
	virtual void		ActivateOccluder( int nOccluderIndex, bool bActive ) = 0;
	virtual bool		IsOccluded( const Vector &vecAbsMins, const Vector &vecAbsMaxs ) = 0;
	virtual void		*SaveAllocMemory( size_t num, size_t size ) = 0;
	virtual void		SaveFreeMemory( void *pSaveMem ) = 0;
	virtual INetChannelInfo	*GetNetChannelInfo( void ) = 0;
	virtual void		DebugDrawPhysCollide( const CPhysCollide *pCollide, IMaterial *pMaterial, matrix3x4_t& transform, const color32 &color ) = 0;
	virtual void		CheckPoint( const char *pName ) = 0;
	virtual void		DrawPortals() = 0;
	virtual bool		IsPlayingDemo( void ) = 0;
	virtual bool		IsRecordingDemo( void ) = 0;
	virtual bool		IsPlayingTimeDemo( void ) = 0;

	// unkown return values
	virtual void		*GetDemoRecordingTick ( void ) = 0;
	virtual void		*GetDemoPlaybackTick ( void ) = 0;
	virtual void		*GetDemoPlaybackStartTick ( void ) = 0;
	virtual void		*GetDemoPlaybackTimeScale ( void ) = 0;
	virtual void		*GetDemoPlaybackTotalTicks ( void ) = 0;

	virtual bool		IsPaused( void ) = 0;
	virtual bool		IsTakingScreenshot( void ) = 0;
	virtual bool		IsHLTV( void ) = 0;

	// Unknown return values
	virtual bool		IsReplay( void ) = 0;
	virtual void		*DownloadReplay ( int unknown1 ) = 0;
	virtual bool		IsReplayEnabled ( void ) = 0;
	virtual bool		IsReplayRecording ( void ) = 0;
	virtual void		*GetReplayRecordingTick ( void ) = 0;

	virtual bool		IsLevelMainMenuBackground( void ) = 0;
	virtual void		GetMainMenuBackgroundName( char *dest, int destlen ) = 0;
	virtual void		*GetVideoModes ( int& iUnknown, void *vmode_s ) = 0;
	virtual void		SetOcclusionParameters( const OcclusionParams_t &params ) = 0;
	virtual void		GetUILanguage( char *dest, int destlen ) = 0;
	virtual SkyboxVisibility_t IsSkyboxVisibleFromPoint( const Vector &vecPoint ) = 0;
	virtual const char*	GetMapEntitiesString() = 0;
	virtual bool		IsInEditMode( void ) = 0;
	virtual float		GetScreenAspectRatio() = 0;
	virtual bool		REMOVED_SteamRefreshLogin( const char *password, bool isSecure ) = 0;
	virtual bool		REMOVED_SteamProcessCall( bool & finished ) = 0;

	virtual unsigned int	GetEngineBuildNumber() = 0; // engines build
	virtual const char *	GetProductVersionString() = 0; // mods version number (steam.inf)
	virtual void			GrabPreColorCorrectedFrame( int x, int y, int width, int height ) = 0;
	virtual bool			IsHammerRunning( ) const = 0;
	virtual void			ExecuteClientCmd( const char *szCmdString ) = 0;
	virtual bool			MapHasHDRLighting(void) = 0;
	virtual int			GetAppID() = 0;
	virtual Vector		GetLightForPointFast(const Vector &pos, bool bClamp) = 0;
	virtual void			ClientCmd_Unrestricted( const char *szCmdString ) = 0;
	virtual void			SetRestrictServerCommands( bool bRestrict ) = 0;
	virtual void			SetRestrictClientCommands( bool bRestrict ) = 0;
	virtual void			SetOverlayBindProxy( int iOverlayID, void *pBindProxy ) = 0;
	virtual bool			CopyFrameBufferToMaterial( const char *pMaterialName ) = 0;
	virtual void			ChangeTeam( const char *pTeamName ) = 0;
	virtual void			ReadConfiguration( const bool readDefault = false ) = 0; 
	virtual void			SetAchievementMgr( IAchievementMgr *pAchievementMgr ) = 0;
	virtual IAchievementMgr *GetAchievementMgr() = 0;
	virtual bool			MapLoadFailed( void ) = 0;
	virtual void			SetMapLoadFailed( bool bState ) = 0;
	virtual bool			IsLowViolence() = 0;
	virtual const char		*GetMostRecentSaveGame( void ) = 0;
	virtual void			SetMostRecentSaveGame( const char *lpszFilename ) = 0;
	virtual void			StartXboxExitingProcess() = 0;
	virtual bool			IsSaveInProgress() = 0;
	virtual uint			OnStorageDeviceAttached( void ) = 0;
	virtual void			OnStorageDeviceDetached( void ) = 0;
	virtual void			ResetDemoInterpolation( void ) = 0;
	virtual void SetGamestatsData( CGamestatsData *pGamestatsData ) = 0;
	virtual CGamestatsData *GetGamestatsData() = 0;
	virtual void			LoadFilmmaker ( void ) = 0;
	virtual void			UnloadFilmmaker ( void ) = 0;
	virtual void			*GetMouseDelta ( int&, int&, bool ) = 0;
	virtual void			ServerCmdKeyValues ( void* ) = 0;
	virtual bool			IsInCommentaryMode ( void ) = 0;
};

Idk if it changed in the meanwhile i dont have any more mac/linux libs to check. Valve should really add new functions at the end of the class rather then the start.

Menu scripts cant global RealTime, you need to make your own RealTime function.

SysTime works fine too.

What do you mean it works too? RealTime doesn’t work.

I mean you can use it instead of RealTime, in case you need it as a counter or so.

Sorry it’s just your Engrish confused me because you said it works too. When RealTime doesn’t work.

Line 152 of player_meta.lua should be

[lua]return string.format( “765%0.f”, FriendID + 61197960265728 + FAuthNum )[/lua]

but it is

[lua]return string.format( “765%0.f”, FriendID + 61197960265728 + AuthNum )[/lua]



'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global 'RealFrameTime' (a nil value)
[lua\menu_plugins\custom_menu\analogclock.lua:36] attempt to call global


You’re better than this blackops! xD Your analogue clock doesn’t seem to like me.

I’ve already posted that above.

Include or copy the RealFrameTime code so it’s run in the menu. I forgot to do that for the release.

Just use SysTime. It works exactly the same.

Can you use the console library you wrote outside of menu state?

Could you add something to clear the console auto-complete of past used commands aswell as accessing a list of past used commands?

It should work on the client yes. I fixed the menu detection, was using the wrong function. :v:

Not smart enough to do so.

Anyway, I updated the module with ColdFusion’s updated class file. I fixed it incorrectly pushing the EyeAngles and a few other things. I did add client.IsPlayerAlive( index) and client.GetPlayerHealth( index ), but I didn’t test it so there’s a good chance it’s broken.

Oh, also fixed those few lua errors in the EXAMPLES.

I am such a nice person

Woahh, I love it!