Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/adminsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@ CON_COMMAND_CHAT_FLAGS(ban, "<name> <minutes|0 (permament)> - ban a player", ADM
PrintSingleAdminAction(pszCommandPlayerName, pTarget->GetPlayerName(), "permanently banned");
}

CON_COMMAND_CHAT_FLAGS(unban, "<steamid64> - unbans a player. Takes decimal STEAMID64", ADMFLAG_BAN)
{
if (args.ArgC() < 2)
{
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Usage: !unban <steamid64>");
return;
}

uint64 iTargetSteamId64 = V_StringToUint64(args[1], 0);

bool bResult = g_pAdminSystem->FindAndRemoveInfractionSteamId64(iTargetSteamId64, CInfractionBase::Ban);

if (!bResult)
{
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Couldn't find user with STEAMID64 <%llu> in ban infractions.", iTargetSteamId64);
return;
}

g_pAdminSystem->SaveInfractions();

// no need to broadcast this
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "User with STEAMID64 <%llu> has been unbanned.", iTargetSteamId64);
}

CON_COMMAND_CHAT_FLAGS(mute, "<name> <duration|0 (permament)> - mutes a player", ADMFLAG_CHAT)
{
if (args.ArgC() < 3)
Expand Down Expand Up @@ -1564,6 +1588,21 @@ bool CAdminSystem::FindAndRemoveInfraction(ZEPlayer *player, CInfractionBase::EI
return false;
}

bool CAdminSystem::FindAndRemoveInfractionSteamId64(uint64 steamid64, CInfractionBase::EInfractionType type)
{
FOR_EACH_VEC(m_vecInfractions, i)
{
if (m_vecInfractions[i]->GetSteamId64() == steamid64 && m_vecInfractions[i]->GetType() == type)
{
m_vecInfractions.Remove(i);

return true;
}
}

return false;
}

CAdmin *CAdminSystem::FindAdmin(uint64 iSteamID)
{
FOR_EACH_VEC(m_vecAdmins, i)
Expand Down
1 change: 1 addition & 0 deletions src/adminsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class CAdminSystem
void SaveInfractions();
bool ApplyInfractions(ZEPlayer *player);
bool FindAndRemoveInfraction(ZEPlayer *player, CInfractionBase::EInfractionType type);
bool FindAndRemoveInfractionSteamId64(uint64 steamid64, CInfractionBase::EInfractionType type);
CAdmin *FindAdmin(uint64 iSteamID);
uint64 ParseFlags(const char* pszFlags);
void AddDisconnectedPlayer(const char* pszName, uint64 xuid, const char* pszIP);
Expand Down