-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin.cpp
139 lines (105 loc) · 2.66 KB
/
plugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "plugin.h"
#include "sourcechat.h"
#include <base_feature.h>
#include <dbg.h>
#include <convar.h>
#include <interface.h>
//-----------------------------------------------------------------------------
// Export the global interface
//-----------------------------------------------------------------------------
CSourceChatPlugin g_SourceChatPlugin;
CSourceChatPlugin *g_pSourceChatPlugin = &g_SourceChatPlugin;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CSourceChatPlugin, IClientPlugin, CLIENT_PLUGIN_INTERFACE_VERSION, g_SourceChatPlugin );
//-----------------------------------------------------------------------------
// Implement plugin methods
//-----------------------------------------------------------------------------
api_version_t CSourceChatPlugin::GetAPIVersion()
{
return SVENMOD_API_VER;
}
bool CSourceChatPlugin::Load( CreateInterfaceFn pfnSvenModFactory, ISvenModAPI *pSvenModAPI, IPluginHelpers *pPluginHelpers )
{
BindApiToGlobals( pSvenModAPI );
if ( !LoadFeatures() )
{
Warning( "[Source Chat] Failed to initialize one of features. Check \"svenmod.log\" for detailed information\n" );
return false;
}
ConVar_Register();
ConColorMsg( { 40, 255, 40, 255 }, "[Source Chat] Successfully loaded\n" );
g_pEngineFuncs->ClientCmd( "exec sourcechat.cfg" );
return true;
}
void CSourceChatPlugin::PostLoad( bool bGlobalLoad )
{
PostLoadFeatures();
}
void CSourceChatPlugin::Unload( void )
{
ConVar_Unregister();
UnloadFeatures();
}
bool CSourceChatPlugin::Pause( void )
{
return false;
}
void CSourceChatPlugin::Unpause( void )
{
}
void CSourceChatPlugin::OnFirstClientdataReceived( client_data_t *pcldata, float flTime )
{
}
void CSourceChatPlugin::OnBeginLoading( void )
{
}
void CSourceChatPlugin::OnEndLoading( void )
{
g_SourceChat.OnEnterToServer();
}
void CSourceChatPlugin::OnDisconnect( void )
{
g_SourceChat.OnDisconnect();
}
void CSourceChatPlugin::GameFrame( client_state_t state, double frametime, bool bPostRunCmd )
{
if ( bPostRunCmd )
{
}
else
{
}
}
void CSourceChatPlugin::Draw( void )
{
}
void CSourceChatPlugin::DrawHUD( float time, int intermission )
{
}
const char *CSourceChatPlugin::GetName( void )
{
return "Source Chat";
}
const char *CSourceChatPlugin::GetAuthor( void )
{
return "Reality / Sw1ft";
}
const char *CSourceChatPlugin::GetVersion( void )
{
return "0.1.4b";
}
const char *CSourceChatPlugin::GetDescription( void )
{
return "Source-like chat";
}
const char *CSourceChatPlugin::GetURL( void )
{
return "https://github.com/0Reality/SourceChat";
}
const char *CSourceChatPlugin::GetDate( void )
{
return SVENMOD_BUILD_TIMESTAMP;
}
const char *CSourceChatPlugin::GetLogTag( void )
{
return "SOURCECHAT";
}