-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.cc
116 lines (86 loc) · 2.82 KB
/
plugin.cc
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
#include "plugin.h"
#include "hl2sdk/public/eiface.h"
#include "hl2sdk/public/server_class.h"
static const char kPluginDescription[] = "Da 1337 w3p0n dis4bler by tr0nald dump & f1nncr1me";
static const bool kPluginIsProfi = true;
static IVEngineServer* engine = nullptr;
const char* Plugin::GetPluginDescription() {
return kPluginDescription;
}
bool Plugin::Load(
CreateInterfaceFn interfaceFactory,
CreateInterfaceFn gameServerFactory) {
Msg("Loading Plugin: %s\n", kPluginDescription);
engine = static_cast<IVEngineServer*>(
interfaceFactory(INTERFACEVERSION_VENGINESERVER, NULL));
if(!engine) {
Msg("ERROR: Can't load engine");
return false;
}
return true;
}
void Plugin::Unload() {}
void Plugin::Pause() {}
void Plugin::UnPause() {}
void Plugin::LevelInit(char const* pMapName) {}
void Plugin::ServerActivate(edict_t* pEdictList, int edictCount, int clientMax) {}
void Plugin::GameFrame(bool simulating) {}
void Plugin::LevelShutdown() {}
void Plugin::OnQueryCvarValueFinished(
QueryCvarCookie_t iCookie,
edict_t* pPlayerEntity,
EQueryCvarValueStatus eStatus,
const char* pCvarName,
const char* pCvarValue) {}
void Plugin::OnEdictAllocated(edict_t* edict) {}
void Plugin::OnEdictFreed(const edict_t* edict) {}
PLUGIN_RESULT Plugin::ClientConnect(
bool* bAllowConnect,
edict_t* pEntity,
const char* pszName,
const char* pszAddress,
char* reject,
int maxrejectlen) {
return PLUGIN_CONTINUE;
}
void Plugin::ClientFullyConnect(edict_t* pEntity) {}
void Plugin::ClientPutInServer(edict_t* entity, const char* playername) {}
void Plugin::ClientActive(edict_t* pEntity) {}
void Plugin::ClientDisconnect(edict_t* pEntity) {}
void Plugin::SetCommandClient(int index) {}
void Plugin::ClientSettingsChanged(edict_t* pEdict){}
PLUGIN_RESULT Plugin::ClientCommand(edict_t* pEntity, const CCommand& args) {
// prevent user from buying forbidden weapons
if (strcmp(args[0], "buy") == 0) {
if (strcmp(args[1], "awp") == 0 ||
strcmp(args[1], "scar20") == 0 ||
strcmp(args[1], "g3sg1") == 0) {
engine->ClientCommand(pEntity, "buy bizon");
engine->ClientCommand(pEntity, "buy elite");
return PLUGIN_STOP;
}
}
return PLUGIN_CONTINUE;
}
PLUGIN_RESULT Plugin::NetworkIDValidated(
const char* pszUserName,
const char* pszNetworkID) {
return PLUGIN_CONTINUE;
}
bool Plugin::BNetworkCryptKeyCheckRequired(
uint32 unFromIP,
uint16 usFromPort,
uint32 unAccountIdProvidedByClient,
bool bClientWantsToUseCryptKey) {
return false;
}
bool Plugin::BNetworkCryptKeyValidate(
uint32 unFromIP,
uint16 usFromPort,
uint32 unAccountIdProvidedByClient,
int nEncryptionKeyIndexFromClient,
int numEncryptedBytesFromClient,
byte* pbEncryptedBufferFromClient,
byte* pbPlainTextKeyForNetchan) {
return false;
}