-
Notifications
You must be signed in to change notification settings - Fork 1
/
fakeranks.h
112 lines (94 loc) · 2.74 KB
/
fakeranks.h
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
#ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
#define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
#include <ISmmPlugin.h>
#include <igameevents.h>
#include "engine/igameeventsystem.h"
#include <irecipientfilter.h>
#include <sh_vector.h>
#include "iserver.h"
//#include <entity2/entitysystem.h>
//#include <entitysystem.h>
class CRecipientFilter : public IRecipientFilter
{
public:
CRecipientFilter()
{
m_nBufType = BUF_RELIABLE;
m_bInitMessage = false;
}
CRecipientFilter(IRecipientFilter *source, int iExcept = -1)
{
m_nBufType = source->GetNetworkBufType();
m_bInitMessage = source->IsInitMessage();
m_Recipients.RemoveAll();
for (int i = 0; i < source->GetRecipientCount(); i++)
{
if (source->GetRecipientIndex(i).Get() != iExcept)
m_Recipients.AddToTail(source->GetRecipientIndex(i));
}
}
~CRecipientFilter() override {}
NetChannelBufType_t GetNetworkBufType(void) const override { return m_nBufType; }
bool IsInitMessage(void) const override { return m_bInitMessage; }
int GetRecipientCount(void) const override { return m_Recipients.Count(); }
CPlayerSlot GetRecipientIndex(int slot) const override
{
if (slot < 0 || slot >= GetRecipientCount())
return CPlayerSlot(-1);
return m_Recipients[slot];
}
/*void AddAllPlayers(void)
{
m_Recipients.RemoveAll();
for (int i = 0; i < MAXPLAYERS; i++)
{
if (!g_playerManager->GetPlayer(i))
continue;
AddRecipient(i);
}
}
*/
void AddRecipient(CPlayerSlot slot)
{
// Don't add if it already exists
if (m_Recipients.Find(slot) != m_Recipients.InvalidIndex())
return;
m_Recipients.AddToTail(slot);
}
private:
NetChannelBufType_t m_nBufType;
bool m_bInitMessage;
CUtlVectorFixed<CPlayerSlot, 65> m_Recipients;
};
class FakeRank_RevealAll : public ISmmPlugin, public IMetamodListener
{
public:
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
bool Unload(char *error, size_t maxlen);
void UpdatePlayers();
bool Pause(char *error, size_t maxlen);
bool Unpause(char *error, size_t maxlen);
void AllPluginsLoaded();
void Hook_StartupServer(const GameSessionConfiguration_t& config, ISource2WorldSession*, const char*);
public: //hooks
void OnLevelInit( char const *pMapName,
char const *pMapEntities,
char const *pOldLevel,
char const *pLandmarkName,
bool loadGame,
bool background );
void OnLevelShutdown();
void Hook_GameFrame( bool simulating, bool bFirstTick, bool bLastTick );
public:
const char *GetAuthor();
const char *GetName();
const char *GetDescription();
const char *GetURL();
const char *GetLicense();
const char *GetVersion();
const char *GetDate();
const char *GetLogTag();
};
extern FakeRank_RevealAll g_FakeRanks;
PLUGIN_GLOBALVARS();
#endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_