Added Kick, Ban and IsInKickQueue to public extension API (bug 3907, r=dvander)

This commit is contained in:
Zach Kanzler 2009-08-24 09:05:54 +12:00
parent 1156d00538
commit 5710a35388
3 changed files with 40 additions and 5 deletions

View File

@ -79,6 +79,7 @@ public:
void SetAdminId(AdminId id, bool temporary); void SetAdminId(AdminId id, bool temporary);
AdminId GetAdminId(); AdminId GetAdminId();
void Kick(const char *str); void Kick(const char *str);
bool IsInKickQueue();
IPlayerInfo *GetPlayerInfo(); IPlayerInfo *GetPlayerInfo();
unsigned int GetLanguageId(); unsigned int GetLanguageId();
int GetUserId(); int GetUserId();
@ -87,7 +88,6 @@ public:
unsigned int GetSerial(); unsigned int GetSerial();
public: public:
void DoBasicAdminChecks(); void DoBasicAdminChecks();
bool IsInKickQueue();
void MarkAsBeingKicked(); void MarkAsBeingKicked();
int GetLifeState(); int GetLifeState();
private: private:

View File

@ -40,7 +40,7 @@
*/ */
#define SMINTERFACE_GAMEHELPERS_NAME "IGameHelpers" #define SMINTERFACE_GAMEHELPERS_NAME "IGameHelpers"
#define SMINTERFACE_GAMEHELPERS_VERSION 4 #define SMINTERFACE_GAMEHELPERS_VERSION 5
class CBaseEntity; class CBaseEntity;
class CBaseHandle; class CBaseHandle;
@ -250,6 +250,18 @@ namespace SourceMod
* @return g_EntList pointer. * @return g_EntList pointer.
*/ */
virtual void *GetGlobalEntityList() =0; virtual void *GetGlobalEntityList() =0;
/**
* @brief Adds a client to the kick queue, where they will be kicked
* next game frame.
*
* The user ID is used to ensure the correct player is kicked.
*
* @param client The index of the client to kick.
* @param userid The user ID of the client to kick.
* @param msg The kick message to show to the player.
*/
virtual void AddDelayedKick(int client, int userid, const char *msg) =0;
}; };
} }

View File

@ -41,7 +41,7 @@
#include <IAdminSystem.h> #include <IAdminSystem.h>
#define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager" #define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
#define SMINTERFACE_PLAYERMANAGER_VERSION 10 #define SMINTERFACE_PLAYERMANAGER_VERSION 11
struct edict_t; struct edict_t;
class IPlayerInfo; class IPlayerInfo;
@ -197,6 +197,29 @@ namespace SourceMod
* @return True if authorized, false otherwise. * @return True if authorized, false otherwise.
*/ */
virtual bool IsAuthorized() =0; virtual bool IsAuthorized() =0;
/**
* @brief Kicks the client with a message
*
* @param message The message shown to the client when kicked
*/
virtual void Kick(const char *message) =0;
/**
* @brief Returns whether the client is marked as being in the kick
* queue. The client doesn't necessarily have to be in the actual kick
* queue for this function to return true.
*
* @return True if in the kick queue, false otherwise.
*/
virtual bool IsInKickQueue() =0;
/**
* @brief Marks the client as being in the kick queue. They are not
* actually added to the kick queue. Use IGameHelpers::AddDelayedKick()
* to actually add them to the queue.
*/
virtual void MarkAsBeingKicked() =0;
}; };
/** /**