-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvsp.cpp
More file actions
84 lines (65 loc) · 1.8 KB
/
vsp.cpp
File metadata and controls
84 lines (65 loc) · 1.8 KB
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
#include "functions.h"
#include "hud_basechat_2013.h"
#include "sv_plugin.h"
#include "vsp.h"
CSigScan* client = nullptr;
CSigScan* engine = nullptr;
ICvar* s_pCVar = nullptr;
// hl2sdk-episode1
#include "engine/iserverplugin.h"
class VSP_NAME: public IServerPluginCallbacks
{
public:
// IServerPluginCallbacks
virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory);
virtual void Unload();
virtual void Pause();
virtual void UnPause();
virtual const char* GetPluginDescription();
};
VSP_NAME VSP_SUFFIX(g_);
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(VSP_NAME, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, VSP_SUFFIX(g_));
bool VSP_NAME::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
{
client = CSigScan::Create(Sys_GetFactory("client.dll"));
if (client == nullptr)
{
Report("client.dll: CSigScan::Create() failed\n");
return false;
}
engine = CSigScan::Create(Sys_GetFactory("engine.dll"));
if (engine == nullptr)
{
Report("engine.dll: CSigScan::Create() failed\n");
return false;
}
s_pCVar = (ICvar*)interfaceFactory(VENGINE_CVAR_INTERFACE_VERSION, nullptr);
if (s_pCVar == nullptr)
{
Report("Unable to get '" VENGINE_CVAR_INTERFACE_VERSION "' interface\n");
return false;
}
if (!BaseChat_Load())
return false;
if (!Functions_Load())
return false;
if (!sv_plugin_Load())
return false;
return true;
}
void VSP_NAME::Unload()
{
BaseChat_Unload();
}
void VSP_NAME::Pause()
{
BaseChat_Pause();
}
void VSP_NAME::UnPause()
{
BaseChat_UnPause();
}
const char* VSP_NAME::GetPluginDescription()
{
return TO_STRING(VSP_NAME) " " VSP_VERSION " (" GITHUB_REPOSITORY ")";
}