SourceMod SDK  1.7
SourceMod::ISourceMod Class Referenceabstract

Contains miscellaneous helper functions. More...

#include <public/ISourceMod.h>

Inheritance diagram for SourceMod::ISourceMod:
SourceMod::SMInterface

Public Member Functions

virtual const char * GetInterfaceName ()
 Must return a string defining the interface's unique name.
 
virtual unsigned int GetInterfaceVersion ()
 Must return an integer defining the interface's version.
 
virtual const char * GetGamePath () const =0
 Returns the full path to the game directory. More...
 
virtual const char * GetSourceModPath () const =0
 Returns the full path to the SourceMod directory. More...
 
virtual size_t BuildPath (PathType type, char *buffer, size_t maxlength, const char *format,...)=0
 Builds a platform path for a specific target base path. More...
 
virtual void LogMessage (IExtension *pExt, const char *format,...)=0
 Logs a message to the SourceMod logs. More...
 
virtual void LogError (IExtension *pExt, const char *format,...)=0
 Logs a message to the SourceMod error logs. More...
 
virtual size_t FormatString (char *buffer, size_t maxlength, SourcePawn::IPluginContext *pContext, const cell_t *params, unsigned int param)=0
 Formats a string from a native. More...
 
virtual IDataPackCreateDataPack ()=0
 Creates a data pack object. More...
 
virtual void FreeDataPack (IDataPack *pack)=0
 Releases a data pack's resources so it can be re-used. More...
 
virtual HandleType_t GetDataPackHandleType (bool readonly=false)=0
 Not implemented, do not use. More...
 
virtual KeyValues * ReadKeyValuesHandle (Handle_t hndl, HandleError *err=NULL, bool root=false)=0
 Retrieves a KeyValues pointer from a handle. More...
 
virtual const char * GetGameFolderName () const =0
 Returns the name of the game directory. More...
 
virtual SourcePawn::ISourcePawnEngine * GetScriptingEngine ()=0
 Returns the scripting engine interface. More...
 
virtual SourcePawn::IVirtualMachine * GetScriptingVM ()=0
 Deprecated, do not use. More...
 
virtual time_t GetAdjustedTime ()=0
 Returns the adjusted server time. More...
 
virtual unsigned int SetGlobalTarget (unsigned int index)=0
 Sets the global client SourceMod will use for assisted translations (that is, t). More...
 
virtual unsigned int GetGlobalTarget () const =0
 Returns the global client SourceMod is currently using for assisted translations (that is, t). More...
 
virtual void AddGameFrameHook (GAME_FRAME_HOOK hook)=0
 Adds a function to be called each game frame. More...
 
virtual void RemoveGameFrameHook (GAME_FRAME_HOOK hook)=0
 Removes one game frame hook matching the given function. More...
 
virtual size_t Format (char *buffer, size_t maxlength, const char *fmt,...)=0
 Platform-safe wrapper around snprintf(). More...
 
virtual size_t FormatArgs (char *buffer, size_t maxlength, const char *fmt, va_list ap)=0
 Platform-safe wrapper around vsnprintf(). More...
 
virtual void AddFrameAction (FRAMEACTION fn, void *data)=0
 Adds an action to be executed on the next available frame. More...
 
virtual const char * GetCoreConfigValue (const char *key)=0
 Retrieves a core.cfg configuration value. More...
 
virtual int GetPluginId ()=0
 Returns SourceMod's Metamod:Source plugin ID. More...
 
virtual int GetShApiVersion ()=0
 Returns SourceHook's API version. More...
 
virtual bool IsMapRunning ()=0
 Returns whether or not a map is currently running. More...
 
- Public Member Functions inherited from SourceMod::SMInterface
virtual bool IsVersionCompatible (unsigned int version)
 Must return whether the requested version number is backwards compatible. Note: This can be overridden for breaking changes or custom versioning. More...
 

Detailed Description

Contains miscellaneous helper functions.

Member Function Documentation

virtual void SourceMod::ISourceMod::AddFrameAction ( FRAMEACTION  fn,
void *  data 
)
pure virtual

Adds an action to be executed on the next available frame.

This function is thread safe.

Parameters
fnFunction to execute.
dataData to pass to function.
virtual void SourceMod::ISourceMod::AddGameFrameHook ( GAME_FRAME_HOOK  hook)
pure virtual

Adds a function to be called each game frame.

Parameters
hookHook function.
virtual size_t SourceMod::ISourceMod::BuildPath ( PathType  type,
char *  buffer,
size_t  maxlength,
const char *  format,
  ... 
)
pure virtual

Builds a platform path for a specific target base path.

If the path starts with the string "file://" and the PathType is not relative, then the "file://" portion is stripped off, and the rest of the path is used without any modification (except for correcting slashes). This can be used to override the path builder to supply alternate absolute paths. Examples:

file://C:/Temp/file.txt file:///tmp/file.txt

Parameters
typeType of path to use as a base.
bufferBuffer to write to.
maxlengthSize of buffer.
formatFormat string.
...Format arguments.
Returns
Number of bytes written.
virtual IDataPack* SourceMod::ISourceMod::CreateDataPack ( )
pure virtual

Creates a data pack object.

Returns
A new IDataPack object.
virtual size_t SourceMod::ISourceMod::Format ( char *  buffer,
size_t  maxlength,
const char *  fmt,
  ... 
)
pure virtual

Platform-safe wrapper around snprintf().

Parameters
bufferString buffer.
maxlengthMaximum length of buffer.
fmtFormat specifier string.
...Format arguments.
Returns
Number of bytes (not including null terminator) written.
virtual size_t SourceMod::ISourceMod::FormatArgs ( char *  buffer,
size_t  maxlength,
const char *  fmt,
va_list  ap 
)
pure virtual

Platform-safe wrapper around vsnprintf().

Parameters
bufferString buffer.
maxlengthMaximum length of buffer.
fmtFormat specifier string.
apFormat arguments.
Returns
Number of bytes (not including null terminator) written.
virtual size_t SourceMod::ISourceMod::FormatString ( char *  buffer,
size_t  maxlength,
SourcePawn::IPluginContext *  pContext,
const cell_t *  params,
unsigned int  param 
)
pure virtual

Formats a string from a native.

Parameters
bufferBuffer to store message.
maxlengthMaximum length of buffer (including null terminator).
pContextPointer to the plugin's context.
paramsParameter array that was passed to the native.
paramParameter index where format string and variable arguments begin. Note: parameter indexes start at 1.
Returns
Number of bytes written, not including the null terminator.
virtual void SourceMod::ISourceMod::FreeDataPack ( IDataPack pack)
pure virtual

Releases a data pack's resources so it can be re-used.

Parameters
packAn IDataPack object to release.
virtual time_t SourceMod::ISourceMod::GetAdjustedTime ( )
pure virtual

Returns the adjusted server time.

Returns
Adjusted server time.
virtual const char* SourceMod::ISourceMod::GetCoreConfigValue ( const char *  key)
pure virtual

Retrieves a core.cfg configuration value.

Parameters
keyCore.cfg key phrase.
Returns
Value string, or NULL on failure. The string will be destroyed on core.cfg reparses.
virtual HandleType_t SourceMod::ISourceMod::GetDataPackHandleType ( bool  readonly = false)
pure virtual

Not implemented, do not use.

Parameters
readonlyIgnored
Returns
0
virtual const char* SourceMod::ISourceMod::GetGameFolderName ( ) const
pure virtual

Returns the name of the game directory.

Returns
A string containing the name of the game directory.
virtual const char* SourceMod::ISourceMod::GetGamePath ( ) const
pure virtual

Returns the full path to the game directory.

Returns
A string containing the full game path.
virtual unsigned int SourceMod::ISourceMod::GetGlobalTarget ( ) const
pure virtual

Returns the global client SourceMod is currently using for assisted translations (that is, t).

Deprecated:
Use ITranslator::GetGlobalTarget() instead.
Returns
Global client value.
virtual int SourceMod::ISourceMod::GetPluginId ( )
pure virtual

Returns SourceMod's Metamod:Source plugin ID.

Returns
Metamod:Source PluginId.
virtual SourcePawn::ISourcePawnEngine* SourceMod::ISourceMod::GetScriptingEngine ( )
pure virtual

Returns the scripting engine interface.

Returns
A pointer to the scripting engine interface.
virtual SourcePawn::IVirtualMachine* SourceMod::ISourceMod::GetScriptingVM ( )
pure virtual

Deprecated, do not use.

Returns
NULL.
virtual int SourceMod::ISourceMod::GetShApiVersion ( )
pure virtual

Returns SourceHook's API version.

Returns
SourceHook API version number.
virtual const char* SourceMod::ISourceMod::GetSourceModPath ( ) const
pure virtual

Returns the full path to the SourceMod directory.

Returns
A string containing the full SourceMod path.
virtual bool SourceMod::ISourceMod::IsMapRunning ( )
pure virtual

Returns whether or not a map is currently running.

Returns
True if a map is currently running, otherwise false.
virtual void SourceMod::ISourceMod::LogError ( IExtension pExt,
const char *  format,
  ... 
)
pure virtual

Logs a message to the SourceMod error logs.

Parameters
pExtExtension calling this function.
formatMessage format.
...Message format parameters.
virtual void SourceMod::ISourceMod::LogMessage ( IExtension pExt,
const char *  format,
  ... 
)
pure virtual

Logs a message to the SourceMod logs.

Parameters
pExtExtension calling this function.
formatMessage format.
...Message format parameters.
virtual KeyValues* SourceMod::ISourceMod::ReadKeyValuesHandle ( Handle_t  hndl,
HandleError *  err = NULL,
bool  root = false 
)
pure virtual

Retrieves a KeyValues pointer from a handle.

Parameters
hndlHandle_t from which to retrieve contents.
errOptional address to store a possible handle error.
rootIf true it will return the root KeyValues pointer for the whole structure.
Returns
The KeyValues pointer, or NULL for any error encountered.
virtual void SourceMod::ISourceMod::RemoveGameFrameHook ( GAME_FRAME_HOOK  hook)
pure virtual

Removes one game frame hook matching the given function.

Parameters
hookHook function.
virtual unsigned int SourceMod::ISourceMod::SetGlobalTarget ( unsigned int  index)
pure virtual

Sets the global client SourceMod will use for assisted translations (that is, t).

Parameters
indexClient index.
Deprecated:
Use ITranslator::GetGlobalTarget() instead.
Returns
Old global client value.

The documentation for this class was generated from the following file: