1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-08-20 06:47:09 +02:00

Add the ability to specify a custom header/payload when kicking/banning a player.

This commit is contained in:
Sandu Liviu Catalin
2016-08-17 13:48:29 +03:00
parent 4e039d415a
commit c4e82d6756
5 changed files with 57 additions and 1 deletions

View File

@@ -255,6 +255,21 @@ void CPlayer::Kick() const
{
// Validate the managed identifier
Validate();
// Store the default header and payload
Core::Get().GetPlayer(m_ID).mKickBanHeader = 0;
Core::Get().GetPlayer(m_ID).mKickBanPayload = NullObject();
// Perform the requested operation
_Func->KickPlayer(m_ID);
}
// ------------------------------------------------------------------------------------------------
void CPlayer::KickBecause(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Store the specified header and payload
Core::Get().GetPlayer(m_ID).mKickBanHeader = header;
Core::Get().GetPlayer(m_ID).mKickBanPayload = payload;
// Perform the requested operation
_Func->KickPlayer(m_ID);
}
@@ -264,6 +279,21 @@ void CPlayer::Ban() const
{
// Validate the managed identifier
Validate();
// Store the default header and payload
Core::Get().GetPlayer(m_ID).mKickBanHeader = 0;
Core::Get().GetPlayer(m_ID).mKickBanPayload = NullObject();
// Perform the requested operation
_Func->BanPlayer(m_ID);
}
// ------------------------------------------------------------------------------------------------
void CPlayer::BanBecause(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Store the specified header and payload
Core::Get().GetPlayer(m_ID).mKickBanHeader = header;
Core::Get().GetPlayer(m_ID).mKickBanPayload = payload;
// Perform the requested operation
_Func->BanPlayer(m_ID);
}
@@ -2289,6 +2319,8 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Func(_SC("StreamedFor"), &CPlayer::IsStreamedFor)
.Func(_SC("Kick"), &CPlayer::Kick)
.Func(_SC("Ban"), &CPlayer::Ban)
.Func(_SC("KickBecause"), &CPlayer::KickBecause)
.Func(_SC("BanBecause"), &CPlayer::BanBecause)
.Func(_SC("GetOption"), &CPlayer::GetOption)
.Func(_SC("SetOption"), &CPlayer::SetOption)
.Func(_SC("SetOptionEx"), &CPlayer::SetOptionEx)

View File

@@ -270,11 +270,21 @@ public:
*/
void Kick() const;
/* --------------------------------------------------------------------------------------------
* Kick the managed player entity from the server.
*/
void KickBecause(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* Ban the managed player entity from the server.
*/
void Ban() const;
/* --------------------------------------------------------------------------------------------
* Ban the managed player entity from the server.
*/
void BanBecause(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the key of the managed player entity.
*/