-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBATInterface.h
66 lines (59 loc) · 3.1 KB
/
BATInterface.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
/* ======== Basic Admin tool ========
* Copyright (C) 2004-2007 Erling K. Sæterdal
* No warranties of any kind
*
* License: zlib/libpng
*
* Author(s): Erling K. Sæterdal ( EKS )
* Credits:
* Menu code based on code from CSDM ( http://www.tcwonline.org/~dvander/cssdm ) Created by BAILOPAN
* Helping on misc errors/functions: BAILOPAN,karma,LDuke,sslice,devicenull,PMOnoTo,cybermind ( most who idle in #sourcemod on GameSurge realy )
* ============================ */
#ifndef _INCLUDE_BATINTERFACE
#define _INCLUDE_BATINTERFACE
#include "ismmplugin.h"
#define ADMININTERFACE_VERSION 1
#define ADMININTERFACE_MAXACCESSLENGTHTEXT 20 // This is the maximum length of a "flag" access text.
#define ADMININTERFACE_REGFLAGDESCRIPTIONLEN 120
//#include "BATMenu.h"
//extern menuId g_AdminMenu;
class AdminInterfaceListner
{
public:
virtual void OnAdminInterfaceUnload()=0;
virtual void Client_Authorized(int id)=0;
};
class AdminInterface
{
public:
virtual bool RegisterFlag(const char *Class,const char *Flag,const char *Description) = 0; // Registers a new admin access
virtual bool IsClient(int id) = 0; // returns false if client is bot, or NOT connected
virtual bool HasFlag(int id, const char *Class, const char *Flag) = 0; // returns true if the player has this access flag, case sensitive
virtual bool HasFlag(int id, const char *Flag) = 0; // returns true if the player has this access flag, case sensitive, Assumes the class type of 'Admin'
virtual int GetInterfaceVersion() = 0 ; // Returns the interface version of the admin mod
virtual const char* GetModName() = 0; // Returns the name of the current admin mod
virtual void AddEventListner(AdminInterfaceListner *ptr) = 0; // You should ALLWAYS set this, so you know when the "server" plugin gets unloaded
virtual void RemoveListner(AdminInterfaceListner *ptr) = 0; // You MUST CALL this function in your plugin unloads function, or the admin plugin will crash on next client connect.
};
class BATAdminInterface : public AdminInterface
{
public:
bool RegisterFlag(const char *Class,const char *Flag,const char *Description); // Max 1 admin access at the time, returns true if done successfully
bool IsClient(int id); // returns false if client is bot, or NOT connected
bool HasFlag(int id, const char *Class, const char *Flag); // returns true if the player has this access flag
bool HasFlag(int id,const char *Flag); // returns true if the player has this access flag
int GetInterfaceVersion() { return ADMININTERFACE_VERSION; } // Returns the interface version of the admin mod
const char* GetModName() { return "BAT"; } // Returns the name of the current admin mod
void AddEventListner(AdminInterfaceListner *ptr); // You should ALLWAYS set this, so you know when the "server" plugin gets unloaded
void RemoveListner(AdminInterfaceListner *ptr);
private:
char GetFlagFromInt(int CharIndex);
bool CustomAccessExistence(const char *Flag);
};
class MyListener : public IMetamodListener
{
public:
virtual void *OnMetamodQuery(const char *iface, int *ret);
};
extern BATAdminInterface g_BATInterface;
#endif