SourceMod SDK  1.7
IGameHelpers.h
Go to the documentation of this file.
1 
32 #ifndef _INCLUDE_SOURCEMOD_GAMEHELPERS_H_
33 #define _INCLUDE_SOURCEMOD_GAMEHELPERS_H_
34 
35 #include <IShareSys.h>
36 
42 #define SMINTERFACE_GAMEHELPERS_NAME "IGameHelpers"
43 #define SMINTERFACE_GAMEHELPERS_VERSION 10
44 
45 class CBaseEntity;
46 class CBaseHandle;
47 class SendProp;
48 class ServerClass;
49 class ICommandLine;
50 struct edict_t;
51 struct datamap_t;
52 struct typedescription_t;
53 
54 #define TEXTMSG_DEST_NOTIFY 1
55 #define TEXTMSG_DEST_CONSOLE 2
56 #define TEXTMSG_DEST_CHAT 3
57 #define TEXTMSG_DEST_CENTER 4
58 
59 namespace SourceMod
60 {
65  {
66  SendProp *prop;
67  unsigned int actual_offset;
68  };
69 
71  {
72  typedescription_t *prop;
73  unsigned int actual_offset;
74  };
75 
76  class IGameHelpers : public SMInterface
77  {
78  public:
79  virtual const char *GetInterfaceName()
80  {
81  return SMINTERFACE_GAMEHELPERS_NAME;
82  }
83  virtual unsigned int GetInterfaceVersion()
84  {
85  return SMINTERFACE_GAMEHELPERS_VERSION;
86  }
87  public:
95  virtual SendProp *FindInSendTable(const char *classname, const char *offset) =0;
96 
102  virtual ServerClass *FindServerClass(const char *classname) =0;
103 
112  virtual typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset) =0;
113 
120  virtual datamap_t *GetDataMap(CBaseEntity *pEntity) =0;
121 
128  virtual void SetEdictStateChanged(edict_t *pEdict, unsigned short offset) =0;
129 
138  virtual bool TextMsg(int client, int dest, const char *msg) =0;
139 
145  virtual bool IsLANServer() =0;
146 
158  virtual bool FindSendPropInfo(const char *classname,
159  const char *offset,
160  sm_sendprop_info_t *info) =0;
161 
168  virtual edict_t *EdictOfIndex(int index) =0;
169 
176  virtual int IndexOfEdict(edict_t *pEnt) =0;
177 
184  virtual edict_t *GetHandleEntity(CBaseHandle &hndl) =0;
185 
193  virtual void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt) =0;
194 
200  virtual const char *GetCurrentMap() =0;
201 
207  virtual void ServerCommand(const char *buffer) =0;
208 
217  virtual CBaseEntity *ReferenceToEntity(cell_t entRef) =0;
218 
225  virtual cell_t EntityToReference(CBaseEntity *pEntity) =0;
226 
233  virtual cell_t EntityToBCompatRef(CBaseEntity *pEntity) =0;
234 
241  virtual cell_t IndexToReference(int entIndex) =0;
242 
249  virtual int ReferenceToIndex(cell_t entRef) =0;
250 
257  virtual cell_t ReferenceToBCompatRef(cell_t entRef) =0;
258 
264  virtual void *GetGlobalEntityList() =0;
265 
276  virtual void AddDelayedKick(int client, int userid, const char *msg) =0;
277 
284  virtual int GetSendPropOffset(SendProp *prop) =0;
285 
293  virtual bool HintTextMsg(int client, const char *msg) =0;
294 
300  virtual ICommandLine *GetValveCommandLine() =0;
301 
308  virtual const char *GetEntityClassname(edict_t *pEdict) =0;
309 
316  virtual const char *GetEntityClassname(CBaseEntity *pEntity) =0;
317 
326  virtual bool IsMapValid(const char *map) =0;
327 
337  virtual bool FindDataMapInfo(datamap_t *pMap, const char *offset, sm_datatable_info_t *pDataTable) =0;
338  };
339 }
340 
341 #endif //_INCLUDE_SOURCEMOD_GAMEHELPERS_H_
SendProp * prop
Definition: IGameHelpers.h:66
virtual const char * GetEntityClassname(edict_t *pEdict)=0
Gets a Classname from an edict_t pointer.
virtual bool TextMsg(int client, int dest, const char *msg)=0
Sends a text message to a client.
virtual void AddDelayedKick(int client, int userid, const char *msg)=0
Adds a client to the kick queue, where they will be kicked next game frame.
virtual ServerClass * FindServerClass(const char *classname)=0
Finds a named server class.
virtual cell_t EntityToBCompatRef(CBaseEntity *pEntity)=0
Returns the entity reference for logical entities, or the index for networked entities.
virtual void * GetGlobalEntityList()=0
Returns the g_EntList pointer.
virtual bool IsLANServer()=0
Returns whether the server ls a LAN server.
virtual void ServerCommand(const char *buffer)=0
Wraps IVEngineServer::ServerCommand.
unsigned int actual_offset
Definition: IGameHelpers.h:67
virtual edict_t * EdictOfIndex(int index)=0
Converts an entity index into an edict pointer.
Defines the Share System, responsible for shared resources and dependencies.
virtual void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt)=0
Sets the edict pointer in a CBaseHandle object.
virtual unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version.
Definition: IGameHelpers.h:83
virtual bool IsMapValid(const char *map)=0
Returns whether or not a map name is valid to use with the engine's Changelevel functionality. It need not be an exact filename on some engines. For a check on the exact name, use IVEngineServer::IsMapValid.
Defines the base functionality required by a shared interface.
Definition: IShareSys.h:92
virtual int IndexOfEdict(edict_t *pEnt)=0
Converts an edict pointer into an entity index.
virtual bool HintTextMsg(int client, const char *msg)=0
Sends a hint message to a client.
Maps the heirarchy of a SendProp.
Definition: IGameHelpers.h:64
virtual cell_t EntityToReference(CBaseEntity *pEntity)=0
Returns the entity reference for an entity.
virtual int GetSendPropOffset(SendProp *prop)=0
Returns the uncomputed offset of a SendProp.
virtual cell_t ReferenceToBCompatRef(cell_t entRef)=0
Converts a reference into a bcompat version (index for networked entities).
virtual const char * GetInterfaceName()
Must return a string defining the interface's unique name.
Definition: IGameHelpers.h:79
virtual cell_t IndexToReference(int entIndex)=0
Converts an entity index into an entity reference.
virtual SendProp * FindInSendTable(const char *classname, const char *offset)=0
Deprecated; use FindSendPropInfo() instead.
virtual const char * GetCurrentMap()=0
Returns the current map name.
Definition: IAdminSystem.h:63
virtual bool FindSendPropInfo(const char *classname, const char *offset, sm_sendprop_info_t *info)=0
Finds a send property in a named ServerClass.
virtual bool FindDataMapInfo(datamap_t *pMap, const char *offset, sm_datatable_info_t *pDataTable)=0
Finds a datamap_t definition.
virtual datamap_t * GetDataMap(CBaseEntity *pEntity)=0
Retrieves an entity's datamap_t pointer.
virtual void SetEdictStateChanged(edict_t *pEdict, unsigned short offset)=0
Marks an edict as state changed for an offset.
virtual ICommandLine * GetValveCommandLine()=0
Retrieves the Valve command line pointer.
Definition: IGameHelpers.h:76
virtual CBaseEntity * ReferenceToEntity(cell_t entRef)=0
Looks up a reference and returns the CBasseEntity* it points to.
virtual int ReferenceToIndex(cell_t entRef)=0
Retrieves the entity index from a reference.
virtual edict_t * GetHandleEntity(CBaseHandle &hndl)=0
Retrieves the edict pointer from a CBaseHandle object.
Definition: IGameHelpers.h:70
virtual typedescription_t * FindInDataMap(datamap_t *pMap, const char *offset)=0
Finds a datamap_t definition.
typedescription_t * prop
Definition: IGameHelpers.h:72
unsigned int actual_offset
Definition: IGameHelpers.h:73