Compare commits
3 Commits
1.10-fork
...
feature-Me
Author | SHA1 | Date | |
---|---|---|---|
|
7185be1121 | ||
|
5ac1379b67 | ||
|
d67d6321ad |
12
.gitattributes
vendored
12
.gitattributes
vendored
@ -1,12 +0,0 @@
|
|||||||
# GitHub views all .h files as C, let's assume it's C++
|
|
||||||
*.h linguist-language=c++
|
|
||||||
|
|
||||||
# Internal tools overriding
|
|
||||||
tools/* linguist-vendored
|
|
||||||
editor/* linguist-vendored
|
|
||||||
|
|
||||||
# Third-party overriding
|
|
||||||
extensions/curl/curl-src/* linguist-vendored
|
|
||||||
extensions/geoip/GeoIP.c linguist-vendored
|
|
||||||
extensions/geoip/GeoIP.h linguist-vendored
|
|
||||||
extensions/sqlite/sqlite-source/* linguist-vendored
|
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -3,4 +3,4 @@
|
|||||||
url = https://github.com/alliedmodders/amtl
|
url = https://github.com/alliedmodders/amtl
|
||||||
[submodule "sourcepawn"]
|
[submodule "sourcepawn"]
|
||||||
path = sourcepawn
|
path = sourcepawn
|
||||||
url = https://github.com/BotoX/sourcepawn.git
|
url = https://github.com/alliedmodders/sourcepawn
|
||||||
|
@ -1313,7 +1313,7 @@ bool CHalfLife2::IsMapValid(const char *map)
|
|||||||
if (!map || !map[0])
|
if (!map || !map[0])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return FindMap(map) == SMFindMapResult::Found;
|
return FindMap(map) != SMFindMapResult::NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add ep1 support for this. (No IServerTools available there)
|
// TODO: Add ep1 support for this. (No IServerTools available there)
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PlayerManager.h"
|
#include "PlayerManager.h"
|
||||||
#include "sourcemod.h"
|
|
||||||
#include "IAdminSystem.h"
|
#include "IAdminSystem.h"
|
||||||
#include "ConCmdManager.h"
|
#include "ConCmdManager.h"
|
||||||
#include "MenuStyle_Valve.h"
|
#include "MenuStyle_Valve.h"
|
||||||
@ -93,12 +92,6 @@ SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &)
|
|||||||
#else
|
#else
|
||||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
#endif
|
#endif
|
||||||
SH_DECL_HOOK2_void(IVEngineServer, ClientPrintf, SH_NOATTRIB, 0, edict_t *, const char *);
|
|
||||||
|
|
||||||
static void PrintfBuffer_FrameAction(void *data)
|
|
||||||
{
|
|
||||||
g_Players.OnPrintfFrameAction(reinterpret_cast<unsigned int>(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
ConCommand *maxplayersCmd = NULL;
|
ConCommand *maxplayersCmd = NULL;
|
||||||
|
|
||||||
@ -179,7 +172,6 @@ void PlayerManager::OnSourceModAllInitialized()
|
|||||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
||||||
SH_ADD_HOOK(IServerGameDLL, SetServerHibernation, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
SH_ADD_HOOK(IServerGameDLL, SetServerHibernation, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
||||||
#endif
|
#endif
|
||||||
SH_ADD_HOOK(IVEngineServer, ClientPrintf, engine, SH_MEMBER(this, &PlayerManager::OnClientPrintf), false);
|
|
||||||
|
|
||||||
sharesys->AddInterface(NULL, this);
|
sharesys->AddInterface(NULL, this);
|
||||||
|
|
||||||
@ -212,9 +204,6 @@ void PlayerManager::OnSourceModAllInitialized()
|
|||||||
SH_ADD_HOOK(ConCommand, Dispatch, pCmd, SH_STATIC(CmdMaxplayersCallback), true);
|
SH_ADD_HOOK(ConCommand, Dispatch, pCmd, SH_STATIC(CmdMaxplayersCallback), true);
|
||||||
maxplayersCmd = pCmd;
|
maxplayersCmd = pCmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameevents->AddListener(this, "player_connect", true);
|
|
||||||
gameevents->AddListener(this, "player_disconnect", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerManager::OnSourceModShutdown()
|
void PlayerManager::OnSourceModShutdown()
|
||||||
@ -236,7 +225,6 @@ void PlayerManager::OnSourceModShutdown()
|
|||||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
||||||
SH_REMOVE_HOOK(IServerGameDLL, SetServerHibernation, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
SH_REMOVE_HOOK(IServerGameDLL, SetServerHibernation, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
||||||
#endif
|
#endif
|
||||||
SH_REMOVE_HOOK(IVEngineServer, ClientPrintf, engine, SH_MEMBER(this, &PlayerManager::OnClientPrintf), false);
|
|
||||||
|
|
||||||
/* Release forwards */
|
/* Release forwards */
|
||||||
forwardsys->ReleaseForward(m_clconnect);
|
forwardsys->ReleaseForward(m_clconnect);
|
||||||
@ -262,8 +250,6 @@ void PlayerManager::OnSourceModShutdown()
|
|||||||
{
|
{
|
||||||
SH_REMOVE_HOOK(ConCommand, Dispatch, maxplayersCmd, SH_STATIC(CmdMaxplayersCallback), true);
|
SH_REMOVE_HOOK(ConCommand, Dispatch, maxplayersCmd, SH_STATIC(CmdMaxplayersCallback), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
gameevents->RemoveListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
||||||
@ -860,88 +846,6 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerManager::OnClientPrintf(edict_t *pEdict, const char *szMsg)
|
|
||||||
{
|
|
||||||
int client = IndexOfEdict(pEdict);
|
|
||||||
|
|
||||||
CPlayer &player = m_Players[client];
|
|
||||||
if (!player.IsConnected())
|
|
||||||
RETURN_META(MRES_IGNORED);
|
|
||||||
|
|
||||||
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(client));
|
|
||||||
if (pNetChan == NULL)
|
|
||||||
RETURN_META(MRES_IGNORED);
|
|
||||||
|
|
||||||
size_t nMsgLen = strlen(szMsg);
|
|
||||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
|
||||||
static const int nNumBitsWritten = 0;
|
|
||||||
#else
|
|
||||||
int nNumBitsWritten = pNetChan->GetNumBitsWritten(false); // SVC_Print uses unreliable netchan
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if the msg is bigger than allowed then just let it fail
|
|
||||||
if (nMsgLen + 1 >= SVC_Print_BufferSize) // +1 for NETMSG_TYPE_BITS
|
|
||||||
RETURN_META(MRES_IGNORED);
|
|
||||||
|
|
||||||
// enqueue msgs if we'd overflow the SVC_Print buffer (+7 as ceil)
|
|
||||||
if (!player.m_PrintfBuffer.empty() || (nNumBitsWritten + NETMSG_TYPE_BITS + 7) / 8 + nMsgLen >= SVC_Print_BufferSize)
|
|
||||||
{
|
|
||||||
// Don't send any more messages for this player until the buffer is empty.
|
|
||||||
// Queue up a gameframe hook to empty the buffer (if we haven't already)
|
|
||||||
if (player.m_PrintfBuffer.empty())
|
|
||||||
g_SourceMod.AddFrameAction(PrintfBuffer_FrameAction, (void *)(uintptr_t)player.GetSerial());
|
|
||||||
|
|
||||||
player.m_PrintfBuffer.append(szMsg);
|
|
||||||
|
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlayerManager::OnPrintfFrameAction(unsigned int serial)
|
|
||||||
{
|
|
||||||
int client = GetClientFromSerial(serial);
|
|
||||||
CPlayer &player = m_Players[client];
|
|
||||||
if (!player.IsConnected())
|
|
||||||
{
|
|
||||||
player.ClearNetchannelQueue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(client));
|
|
||||||
if (pNetChan == NULL)
|
|
||||||
{
|
|
||||||
player.ClearNetchannelQueue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!player.m_PrintfBuffer.empty())
|
|
||||||
{
|
|
||||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
|
||||||
static const int nNumBitsWritten = 0;
|
|
||||||
#else
|
|
||||||
int nNumBitsWritten = pNetChan->GetNumBitsWritten(false); // SVC_Print uses unreliable netchan
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ke::AString &string = player.m_PrintfBuffer.front();
|
|
||||||
|
|
||||||
// stop if we'd overflow the SVC_Print buffer (+7 as ceil)
|
|
||||||
if ((nNumBitsWritten + NETMSG_TYPE_BITS + 7) / 8 + string.length() >= SVC_Print_BufferSize)
|
|
||||||
break;
|
|
||||||
|
|
||||||
SH_CALL(engine, &IVEngineServer::ClientPrintf)(player.m_pEdict, string.chars());
|
|
||||||
|
|
||||||
player.m_PrintfBuffer.popFront();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.m_PrintfBuffer.empty())
|
|
||||||
{
|
|
||||||
// continue processing it on the next gameframe as buffer is not empty
|
|
||||||
g_SourceMod.AddFrameAction(PrintfBuffer_FrameAction, (void *)(uintptr_t)player.GetSerial());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientConsolePrint(edict_t *e, const char *fmt, ...)
|
void ClientConsolePrint(edict_t *e, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
@ -1429,11 +1333,6 @@ int PlayerManager::GetNumPlayers()
|
|||||||
return m_PlayerCount;
|
return m_PlayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PlayerManager::GetNumClients()
|
|
||||||
{
|
|
||||||
return m_ClientCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
int PlayerManager::GetClientOfUserId(int userid)
|
int PlayerManager::GetClientOfUserId(int userid)
|
||||||
{
|
{
|
||||||
if (userid < 0 || userid > USHRT_MAX)
|
if (userid < 0 || userid > USHRT_MAX)
|
||||||
@ -2029,27 +1928,6 @@ bool PlayerManager::HandleConVarQuery(QueryCvarCookie_t cookie, int client, EQue
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* IGameEventListener2::FireGameEvent */
|
|
||||||
void PlayerManager::FireGameEvent(IGameEvent *pEvent)
|
|
||||||
{
|
|
||||||
const char *name = pEvent->GetName();
|
|
||||||
|
|
||||||
if (strcmp(name, "player_connect") == 0)
|
|
||||||
{
|
|
||||||
const int client = pEvent->GetInt("index") + 1;
|
|
||||||
const int userid = pEvent->GetInt("userid");
|
|
||||||
|
|
||||||
m_ClientCount++;
|
|
||||||
}
|
|
||||||
else if (strcmp(name, "player_disconnect") == 0)
|
|
||||||
{
|
|
||||||
const int userid = pEvent->GetInt("userid");
|
|
||||||
const int client = m_UserIdLookUp[userid];
|
|
||||||
|
|
||||||
m_ClientCount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
*** PLAYER CODE ***
|
*** PLAYER CODE ***
|
||||||
@ -2267,13 +2145,6 @@ void CPlayer::Disconnect()
|
|||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
m_LanguageCookie = InvalidQueryCvarCookie;
|
m_LanguageCookie = InvalidQueryCvarCookie;
|
||||||
#endif
|
#endif
|
||||||
ClearNetchannelQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayer::ClearNetchannelQueue(void)
|
|
||||||
{
|
|
||||||
while (!m_PrintfBuffer.empty())
|
|
||||||
m_PrintfBuffer.popFront();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::SetName(const char *name)
|
void CPlayer::SetName(const char *name)
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include <sh_list.h>
|
#include <sh_list.h>
|
||||||
#include <sh_vector.h>
|
#include <sh_vector.h>
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
#include <am-deque.h>
|
|
||||||
#include "ConVarManager.h"
|
#include "ConVarManager.h"
|
||||||
|
|
||||||
#include <steam/steamclientpublic.h>
|
#include <steam/steamclientpublic.h>
|
||||||
@ -124,7 +123,6 @@ private:
|
|||||||
bool IsAuthStringValidated();
|
bool IsAuthStringValidated();
|
||||||
bool SetEngineString();
|
bool SetEngineString();
|
||||||
bool SetCSteamID();
|
bool SetCSteamID();
|
||||||
void ClearNetchannelQueue(void);
|
|
||||||
private:
|
private:
|
||||||
bool m_IsConnected = false;
|
bool m_IsConnected = false;
|
||||||
bool m_IsInGame = false;
|
bool m_IsInGame = false;
|
||||||
@ -154,13 +152,11 @@ private:
|
|||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
QueryCvarCookie_t m_LanguageCookie = InvalidQueryCvarCookie;
|
QueryCvarCookie_t m_LanguageCookie = InvalidQueryCvarCookie;
|
||||||
#endif
|
#endif
|
||||||
ke::Deque<ke::AString> m_PrintfBuffer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerManager :
|
class PlayerManager :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IPlayerManager,
|
public IPlayerManager
|
||||||
public IGameEventListener2
|
|
||||||
{
|
{
|
||||||
friend class CPlayer;
|
friend class CPlayer;
|
||||||
public:
|
public:
|
||||||
@ -194,8 +190,6 @@ public:
|
|||||||
void OnClientSettingsChanged(edict_t *pEntity);
|
void OnClientSettingsChanged(edict_t *pEntity);
|
||||||
//void OnClientSettingsChanged_Pre(edict_t *pEntity);
|
//void OnClientSettingsChanged_Pre(edict_t *pEntity);
|
||||||
void OnServerHibernationUpdate(bool bHibernating);
|
void OnServerHibernationUpdate(bool bHibernating);
|
||||||
void OnClientPrintf(edict_t *pEdict, const char *szMsg);
|
|
||||||
void OnPrintfFrameAction(unsigned int serial);
|
|
||||||
public: //IPlayerManager
|
public: //IPlayerManager
|
||||||
void AddClientListener(IClientListener *listener);
|
void AddClientListener(IClientListener *listener);
|
||||||
void RemoveClientListener(IClientListener *listener);
|
void RemoveClientListener(IClientListener *listener);
|
||||||
@ -203,7 +197,6 @@ public: //IPlayerManager
|
|||||||
IGamePlayer *GetGamePlayer(edict_t *pEdict);
|
IGamePlayer *GetGamePlayer(edict_t *pEdict);
|
||||||
int GetMaxClients();
|
int GetMaxClients();
|
||||||
int GetNumPlayers();
|
int GetNumPlayers();
|
||||||
int GetNumClients();
|
|
||||||
int GetClientOfUserId(int userid);
|
int GetClientOfUserId(int userid);
|
||||||
bool IsServerActivated();
|
bool IsServerActivated();
|
||||||
int FilterCommandTarget(IGamePlayer *pAdmin, IGamePlayer *pTarget, int flags);
|
int FilterCommandTarget(IGamePlayer *pAdmin, IGamePlayer *pTarget, int flags);
|
||||||
@ -214,8 +207,6 @@ public: //IPlayerManager
|
|||||||
int GetClientFromSerial(unsigned int serial);
|
int GetClientFromSerial(unsigned int serial);
|
||||||
void ClearAdminId(AdminId id);
|
void ClearAdminId(AdminId id);
|
||||||
void RecheckAnyAdmins();
|
void RecheckAnyAdmins();
|
||||||
public: // IGameEventListener2
|
|
||||||
void FireGameEvent(IGameEvent *pEvent);
|
|
||||||
public:
|
public:
|
||||||
inline int MaxClients()
|
inline int MaxClients()
|
||||||
{
|
{
|
||||||
@ -276,10 +267,6 @@ private:
|
|||||||
int m_SourceTVUserId;
|
int m_SourceTVUserId;
|
||||||
int m_ReplayUserId;
|
int m_ReplayUserId;
|
||||||
bool m_bInCCKVHook;
|
bool m_bInCCKVHook;
|
||||||
int m_ClientCount;
|
|
||||||
private:
|
|
||||||
static const int NETMSG_TYPE_BITS = 5; // SVC_Print overhead for netmsg type
|
|
||||||
static const int SVC_Print_BufferSize = 2048 - 1; // -1 for terminating \0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
@ -85,7 +85,6 @@ for arch in SM.archs:
|
|||||||
'smn_halflife.cpp',
|
'smn_halflife.cpp',
|
||||||
'FrameIterator.cpp',
|
'FrameIterator.cpp',
|
||||||
'DatabaseConfBuilder.cpp',
|
'DatabaseConfBuilder.cpp',
|
||||||
'NativeInvoker.cpp',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if arch == 'x64':
|
if arch == 'x64':
|
||||||
|
@ -1,321 +0,0 @@
|
|||||||
// vim: set sts=2 ts=8 sw=2 tw=99 et:
|
|
||||||
//
|
|
||||||
// Copyright (C) 2006-2015 AlliedModders LLC
|
|
||||||
//
|
|
||||||
// This file is part of SourcePawn. SourcePawn is free software: you can
|
|
||||||
// redistribute it and/or modify it under the terms of the GNU General Public
|
|
||||||
// License as published by the Free Software Foundation, either version 3 of
|
|
||||||
// the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along with
|
|
||||||
// SourcePawn. If not, see http://www.gnu.org/licenses/.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "NativeInvoker.h"
|
|
||||||
|
|
||||||
/********************
|
|
||||||
* FUNCTION CALLING *
|
|
||||||
********************/
|
|
||||||
|
|
||||||
NativeInvoker::NativeInvoker(IPluginContext *pContext, const ke::RefPtr<Native> &native)
|
|
||||||
: context_(pContext),
|
|
||||||
m_curparam(0),
|
|
||||||
m_errorstate(SP_ERROR_NONE),
|
|
||||||
native_(native)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeInvoker::~NativeInvoker()
|
|
||||||
{
|
|
||||||
Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
NativeInvoker::IsRunnable()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPluginContext *
|
|
||||||
NativeInvoker::GetParentContext()
|
|
||||||
{
|
|
||||||
return context_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NativeInvoker::PushCell(cell_t cell)
|
|
||||||
{
|
|
||||||
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
|
||||||
return SetError(SP_ERROR_PARAMS_MAX);
|
|
||||||
|
|
||||||
m_info[m_curparam].marked = false;
|
|
||||||
m_params[m_curparam] = cell;
|
|
||||||
m_curparam++;
|
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::PushCellByRef(cell_t *cell, int flags)
|
|
||||||
{
|
|
||||||
return PushArray(cell, 1, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::PushFloat(float number)
|
|
||||||
{
|
|
||||||
cell_t val = sp::FloatCellUnion(number).cell;
|
|
||||||
|
|
||||||
return PushCell(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::PushFloatByRef(float *number, int flags)
|
|
||||||
{
|
|
||||||
return PushCellByRef((cell_t *)number, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::PushArray(cell_t *inarray, unsigned int cells, int copyback)
|
|
||||||
{
|
|
||||||
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
|
||||||
{
|
|
||||||
return SetError(SP_ERROR_PARAMS_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
ParamInfo *info = &m_info[m_curparam];
|
|
||||||
|
|
||||||
info->flags = inarray ? copyback : 0;
|
|
||||||
info->marked = true;
|
|
||||||
info->size = cells;
|
|
||||||
info->str.is_sz = false;
|
|
||||||
info->orig_addr = inarray;
|
|
||||||
|
|
||||||
m_curparam++;
|
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::PushString(const char *string)
|
|
||||||
{
|
|
||||||
return _PushString(string, SM_PARAM_STRING_COPY, 0, strlen(string)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags)
|
|
||||||
{
|
|
||||||
return _PushString(buffer, sz_flags, cp_flags, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::_PushString(const char *string, int sz_flags, int cp_flags, size_t len)
|
|
||||||
{
|
|
||||||
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
|
||||||
return SetError(SP_ERROR_PARAMS_MAX);
|
|
||||||
|
|
||||||
ParamInfo *info = &m_info[m_curparam];
|
|
||||||
|
|
||||||
info->marked = true;
|
|
||||||
info->orig_addr = (cell_t *)string;
|
|
||||||
info->flags = cp_flags;
|
|
||||||
info->size = len;
|
|
||||||
info->str.sz_flags = sz_flags;
|
|
||||||
info->str.is_sz = true;
|
|
||||||
|
|
||||||
m_curparam++;
|
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
NativeInvoker::Cancel()
|
|
||||||
{
|
|
||||||
if (!m_curparam)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_errorstate = SP_ERROR_NONE;
|
|
||||||
m_curparam = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::Execute(cell_t *result, cell_t buffer, cell_t size)
|
|
||||||
{
|
|
||||||
context_->ClearLastNativeError();
|
|
||||||
|
|
||||||
// For backward compatibility, we have to clear the exception state.
|
|
||||||
// Otherwise code like this:
|
|
||||||
//
|
|
||||||
// static cell_t native(cx, params) {
|
|
||||||
// for (auto callback : callbacks) {
|
|
||||||
// callback->Execute();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Could unintentionally leak a pending exception back to the caller,
|
|
||||||
// which wouldn't have happened before the Great Exception Refactoring.
|
|
||||||
|
|
||||||
SourcePawn::ExceptionHandler eh(context_);
|
|
||||||
eh.Debug(!size);
|
|
||||||
|
|
||||||
if (!Invoke(result)) {
|
|
||||||
if(size)
|
|
||||||
context_->StringToLocalUTF8(buffer, size, eh.Message(), NULL);
|
|
||||||
int Err = context_->GetLastNativeError();
|
|
||||||
context_->ClearLastNativeError();
|
|
||||||
return Err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
NativeInvoker::Invoke(cell_t *result)
|
|
||||||
{
|
|
||||||
if (!IsRunnable()) {
|
|
||||||
Cancel();
|
|
||||||
context_->ReportErrorNumber(SP_ERROR_NOT_RUNNABLE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (int err = m_errorstate) {
|
|
||||||
Cancel();
|
|
||||||
context_->ReportErrorNumber(err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//This is for re-entrancy!
|
|
||||||
cell_t _temp_params[SP_MAX_EXEC_PARAMS + 1];
|
|
||||||
cell_t *temp_params = &_temp_params[1];
|
|
||||||
ParamInfo temp_info[SP_MAX_EXEC_PARAMS];
|
|
||||||
unsigned int numparams = m_curparam;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if (numparams)
|
|
||||||
{
|
|
||||||
//Save the info locally, then reset it for re-entrant calls.
|
|
||||||
memcpy(temp_info, m_info, numparams * sizeof(ParamInfo));
|
|
||||||
}
|
|
||||||
m_curparam = 0;
|
|
||||||
|
|
||||||
/* Initialize 0th parameter */
|
|
||||||
_temp_params[0] = numparams;
|
|
||||||
|
|
||||||
/* Browse the parameters and build arrays */
|
|
||||||
bool ok = true;
|
|
||||||
for (i=0; i<numparams; i++) {
|
|
||||||
/* Is this marked as an array? */
|
|
||||||
if (temp_info[i].marked) {
|
|
||||||
if (!temp_info[i].str.is_sz) {
|
|
||||||
/* Allocate a normal/generic array */
|
|
||||||
int err = context_->HeapAlloc(
|
|
||||||
temp_info[i].size,
|
|
||||||
&(temp_info[i].local_addr),
|
|
||||||
&(temp_info[i].phys_addr));
|
|
||||||
if (err != SP_ERROR_NONE) {
|
|
||||||
context_->ReportErrorNumber(err);
|
|
||||||
ok = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (temp_info[i].orig_addr)
|
|
||||||
{
|
|
||||||
memcpy(temp_info[i].phys_addr, temp_info[i].orig_addr, sizeof(cell_t) * temp_info[i].size);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Calculate cells required for the string */
|
|
||||||
size_t cells = (temp_info[i].size + sizeof(cell_t) - 1) / sizeof(cell_t);
|
|
||||||
|
|
||||||
/* Allocate the buffer */
|
|
||||||
int err = context_->HeapAlloc(
|
|
||||||
cells,
|
|
||||||
&(temp_info[i].local_addr),
|
|
||||||
&(temp_info[i].phys_addr));
|
|
||||||
if (err != SP_ERROR_NONE) {
|
|
||||||
context_->ReportErrorNumber(err);
|
|
||||||
ok = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy original string if necessary */
|
|
||||||
if ((temp_info[i].str.sz_flags & SM_PARAM_STRING_COPY) && (temp_info[i].orig_addr != NULL))
|
|
||||||
{
|
|
||||||
/* Cut off UTF-8 properly */
|
|
||||||
if (temp_info[i].str.sz_flags & SM_PARAM_STRING_UTF8) {
|
|
||||||
context_->StringToLocalUTF8(
|
|
||||||
temp_info[i].local_addr,
|
|
||||||
temp_info[i].size,
|
|
||||||
(const char *)temp_info[i].orig_addr,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
/* Copy a binary blob */
|
|
||||||
else if (temp_info[i].str.sz_flags & SM_PARAM_STRING_BINARY)
|
|
||||||
{
|
|
||||||
memmove(temp_info[i].phys_addr, temp_info[i].orig_addr, temp_info[i].size);
|
|
||||||
}
|
|
||||||
/* Copy ASCII characters */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
context_->StringToLocal(
|
|
||||||
temp_info[i].local_addr,
|
|
||||||
temp_info[i].size,
|
|
||||||
(const char *)temp_info[i].orig_addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* End array/string calculation */
|
|
||||||
/* Update the pushed parameter with the byref local address */
|
|
||||||
temp_params[i] = temp_info[i].local_addr;
|
|
||||||
} else {
|
|
||||||
/* Just copy the value normally */
|
|
||||||
temp_params[i] = m_params[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make the call if we can */
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
*result = native_->func()(context_, _temp_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* i should be equal to the last valid parameter + 1 */
|
|
||||||
bool docopies = ok;
|
|
||||||
while (i--) {
|
|
||||||
if (!temp_info[i].marked)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (docopies && (temp_info[i].flags & SM_PARAM_COPYBACK)) {
|
|
||||||
if (temp_info[i].orig_addr) {
|
|
||||||
if (temp_info[i].str.is_sz) {
|
|
||||||
memcpy(temp_info[i].orig_addr, temp_info[i].phys_addr, temp_info[i].size);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (temp_info[i].size == 1) {
|
|
||||||
*temp_info[i].orig_addr = *(temp_info[i].phys_addr);
|
|
||||||
} else {
|
|
||||||
memcpy(temp_info[i].orig_addr,
|
|
||||||
temp_info[i].phys_addr,
|
|
||||||
temp_info[i].size * sizeof(cell_t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (int err = context_->HeapPop(temp_info[i].local_addr))
|
|
||||||
context_->ReportErrorNumber(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return context_->GetLastNativeError() == SP_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NativeInvoker::SetError(int err)
|
|
||||||
{
|
|
||||||
m_errorstate = err;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NativeInvoker::CallFunction(const cell_t *params, unsigned int num_params, cell_t *result) { return 0; }
|
|
||||||
funcid_t NativeInvoker::GetFunctionID() { return 0; }
|
|
||||||
int NativeInvoker::Execute2(IPluginContext *ctx, cell_t *result) { return 0; }
|
|
||||||
int NativeInvoker::CallFunction2(IPluginContext *ctx, const cell_t *params, unsigned int num_params, cell_t *result) { return 0; }
|
|
||||||
IPluginRuntime *NativeInvoker::GetParentRuntime() { return NULL; }
|
|
@ -1,79 +0,0 @@
|
|||||||
// vim: set sts=2 ts=8 sw=2 tw=99 et:
|
|
||||||
//
|
|
||||||
// Copyright (C) 2006-2015 AlliedModders LLC
|
|
||||||
//
|
|
||||||
// This file is part of SourcePawn. SourcePawn is free software: you can
|
|
||||||
// redistribute it and/or modify it under the terms of the GNU General Public
|
|
||||||
// License as published by the Free Software Foundation, either version 3 of
|
|
||||||
// the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along with
|
|
||||||
// SourcePawn. If not, see http://www.gnu.org/licenses/.
|
|
||||||
//
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
|
|
||||||
#define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
|
|
||||||
|
|
||||||
#include <sp_vm_api.h>
|
|
||||||
#include <amtl/am-autoptr.h>
|
|
||||||
#include <amtl/am-refcounting.h>
|
|
||||||
#include "Native.h"
|
|
||||||
|
|
||||||
struct ParamInfo
|
|
||||||
{
|
|
||||||
int flags; /* Copy-back flags */
|
|
||||||
bool marked; /* Whether this is marked as being used */
|
|
||||||
cell_t local_addr; /* Local address to free */
|
|
||||||
cell_t *phys_addr; /* Physical address of our copy */
|
|
||||||
cell_t *orig_addr; /* Original address to copy back to */
|
|
||||||
ucell_t size; /* Size of array in bytes */
|
|
||||||
struct {
|
|
||||||
bool is_sz; /* is a string */
|
|
||||||
int sz_flags; /* has sz flags */
|
|
||||||
} str;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NativeInvoker : public IPluginFunction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NativeInvoker(IPluginContext *pContext, const ke::RefPtr<Native> &native);
|
|
||||||
virtual ~NativeInvoker();
|
|
||||||
|
|
||||||
public:
|
|
||||||
int PushCell(cell_t cell);
|
|
||||||
int PushCellByRef(cell_t *cell, int flags);
|
|
||||||
int PushFloat(float number);
|
|
||||||
int PushFloatByRef(float *number, int flags);
|
|
||||||
int PushArray(cell_t *inarray, unsigned int cells, int copyback);
|
|
||||||
int PushString(const char *string);
|
|
||||||
int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
|
|
||||||
int Execute(cell_t *result, cell_t buffer=0, cell_t size=0);
|
|
||||||
void Cancel();
|
|
||||||
int CallFunction(const cell_t *params, unsigned int num_params, cell_t *result);
|
|
||||||
IPluginContext *GetParentContext();
|
|
||||||
bool Invoke(cell_t *result);
|
|
||||||
bool IsRunnable();
|
|
||||||
funcid_t GetFunctionID();
|
|
||||||
int Execute2(IPluginContext *ctx, cell_t *result);
|
|
||||||
int CallFunction2(IPluginContext *ctx,
|
|
||||||
const cell_t *params,
|
|
||||||
unsigned int num_params,
|
|
||||||
cell_t *result);
|
|
||||||
IPluginRuntime *GetParentRuntime();
|
|
||||||
const char *DebugName() {
|
|
||||||
return native_->name();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
|
|
||||||
int SetError(int err);
|
|
||||||
|
|
||||||
private:
|
|
||||||
IPluginContext *context_;
|
|
||||||
cell_t m_params[SP_MAX_EXEC_PARAMS];
|
|
||||||
ParamInfo m_info[SP_MAX_EXEC_PARAMS];
|
|
||||||
unsigned int m_curparam;
|
|
||||||
int m_errorstate;
|
|
||||||
ke::RefPtr<Native> native_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
|
|
@ -35,8 +35,6 @@
|
|||||||
#include <IForwardSys.h>
|
#include <IForwardSys.h>
|
||||||
#include <ISourceMod.h>
|
#include <ISourceMod.h>
|
||||||
#include <amtl/am-autoptr.h>
|
#include <amtl/am-autoptr.h>
|
||||||
#include "ShareSys.h"
|
|
||||||
#include "NativeInvoker.h"
|
|
||||||
|
|
||||||
HandleType_t g_GlobalFwdType = 0;
|
HandleType_t g_GlobalFwdType = 0;
|
||||||
HandleType_t g_PrivateFwdType = 0;
|
HandleType_t g_PrivateFwdType = 0;
|
||||||
@ -45,7 +43,6 @@ static bool s_CallStarted = false;
|
|||||||
static ICallable *s_pCallable = NULL;
|
static ICallable *s_pCallable = NULL;
|
||||||
static IPluginFunction *s_pFunction = NULL;
|
static IPluginFunction *s_pFunction = NULL;
|
||||||
static IForward *s_pForward = NULL;
|
static IForward *s_pForward = NULL;
|
||||||
static NativeInvoker *s_pInvoker = NULL;
|
|
||||||
|
|
||||||
class ForwardNativeHelpers :
|
class ForwardNativeHelpers :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
@ -105,9 +102,6 @@ inline void ResetCall()
|
|||||||
s_pFunction = NULL;
|
s_pFunction = NULL;
|
||||||
s_pForward = NULL;
|
s_pForward = NULL;
|
||||||
s_pCallable = NULL;
|
s_pCallable = NULL;
|
||||||
if(s_pInvoker)
|
|
||||||
delete s_pInvoker;
|
|
||||||
s_pInvoker = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_GetFunctionByName(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_GetFunctionByName(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -372,27 +366,6 @@ static cell_t sm_CallStartForward(IPluginContext *pContext, const cell_t *params
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_CallStartNative(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
ResetCall();
|
|
||||||
|
|
||||||
char *name;
|
|
||||||
pContext->LocalToString(params[1], &name);
|
|
||||||
|
|
||||||
ke::RefPtr<Native> pNative = g_ShareSys.FindNative(name);
|
|
||||||
|
|
||||||
if (!pNative)
|
|
||||||
return 0;//pContext->ThrowNativeError("Invalid native \"%s\"", name);
|
|
||||||
|
|
||||||
s_pInvoker = new NativeInvoker(pContext, pNative);
|
|
||||||
|
|
||||||
s_pCallable = static_cast<ICallable *>(s_pInvoker);
|
|
||||||
|
|
||||||
s_CallStarted = true;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t sm_CallPushCell(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_CallPushCell(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -683,39 +656,6 @@ static cell_t sm_CallFinish(IPluginContext *pContext, const cell_t *params)
|
|||||||
IForward *pForward = s_pForward;
|
IForward *pForward = s_pForward;
|
||||||
ResetCall();
|
ResetCall();
|
||||||
err = pForward->Execute(result, NULL);
|
err = pForward->Execute(result, NULL);
|
||||||
} else if (s_pInvoker) {
|
|
||||||
err = s_pInvoker->Execute(result);
|
|
||||||
ResetCall();
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t sm_CallFinishEx(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
int err = SP_ERROR_NOT_RUNNABLE;
|
|
||||||
cell_t *result;
|
|
||||||
|
|
||||||
if (!s_CallStarted)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Cannot finish call when there is no call in progress");
|
|
||||||
}
|
|
||||||
|
|
||||||
pContext->LocalToPhysAddr(params[1], &result);
|
|
||||||
|
|
||||||
// Note: Execute() swallows exceptions, so this is okay.
|
|
||||||
if (s_pFunction)
|
|
||||||
{
|
|
||||||
IPluginFunction *pFunction = s_pFunction;
|
|
||||||
ResetCall();
|
|
||||||
err = pFunction->Execute(result, params[2], params[3]);
|
|
||||||
} else if (s_pForward) {
|
|
||||||
IForward *pForward = s_pForward;
|
|
||||||
ResetCall();
|
|
||||||
err = pForward->Execute(result, NULL);
|
|
||||||
} else if (s_pInvoker) {
|
|
||||||
err = s_pInvoker->Execute(result, params[2], params[3]);
|
|
||||||
ResetCall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -802,7 +742,6 @@ REGISTER_NATIVES(functionNatives)
|
|||||||
{"RemoveAllFromForward", sm_RemoveAllFromForward},
|
{"RemoveAllFromForward", sm_RemoveAllFromForward},
|
||||||
{"Call_StartFunction", sm_CallStartFunction},
|
{"Call_StartFunction", sm_CallStartFunction},
|
||||||
{"Call_StartForward", sm_CallStartForward},
|
{"Call_StartForward", sm_CallStartForward},
|
||||||
{"Call_StartNative", sm_CallStartNative},
|
|
||||||
{"Call_PushCell", sm_CallPushCell},
|
{"Call_PushCell", sm_CallPushCell},
|
||||||
{"Call_PushCellRef", sm_CallPushCellRef},
|
{"Call_PushCellRef", sm_CallPushCellRef},
|
||||||
{"Call_PushFloat", sm_CallPushFloat},
|
{"Call_PushFloat", sm_CallPushFloat},
|
||||||
@ -814,7 +753,6 @@ REGISTER_NATIVES(functionNatives)
|
|||||||
{"Call_PushNullVector", sm_CallPushNullVector},
|
{"Call_PushNullVector", sm_CallPushNullVector},
|
||||||
{"Call_PushNullString", sm_CallPushNullString},
|
{"Call_PushNullString", sm_CallPushNullString},
|
||||||
{"Call_Finish", sm_CallFinish},
|
{"Call_Finish", sm_CallFinish},
|
||||||
{"Call_FinishEx", sm_CallFinishEx},
|
|
||||||
{"Call_Cancel", sm_CallCancel},
|
{"Call_Cancel", sm_CallCancel},
|
||||||
{"RequestFrame", sm_AddFrameAction},
|
{"RequestFrame", sm_AddFrameAction},
|
||||||
|
|
||||||
|
@ -64,13 +64,10 @@ static const int kActivityAdmins = 4; // Show admin activity to admins anonymo
|
|||||||
static const int kActivityAdminsNames = 8; // If 4 is specified, admin names will be shown.
|
static const int kActivityAdminsNames = 8; // If 4 is specified, admin names will be shown.
|
||||||
static const int kActivityRootNames = 16; // Always show admin names to root users.
|
static const int kActivityRootNames = 16; // Always show admin names to root users.
|
||||||
|
|
||||||
#define FEATURECAP_MULTITARGETFILTER_CLIENTPARAM "SourceMod MultiTargetFilter ClientParam"
|
|
||||||
|
|
||||||
class PlayerLogicHelpers :
|
class PlayerLogicHelpers :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IPluginsListener,
|
public IPluginsListener,
|
||||||
public ICommandTargetProcessor,
|
public ICommandTargetProcessor
|
||||||
public IFeatureProvider
|
|
||||||
{
|
{
|
||||||
struct SimpleMultiTargetFilter
|
struct SimpleMultiTargetFilter
|
||||||
{
|
{
|
||||||
@ -144,7 +141,6 @@ public: //ICommandTargetProcessor
|
|||||||
|
|
||||||
smtf->fun->PushString(info->pattern);
|
smtf->fun->PushString(info->pattern);
|
||||||
smtf->fun->PushCell(ahc.getClone());
|
smtf->fun->PushCell(ahc.getClone());
|
||||||
smtf->fun->PushCell(info->admin);
|
|
||||||
cell_t result = 0;
|
cell_t result = 0;
|
||||||
if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result)
|
if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result)
|
||||||
return false;
|
return false;
|
||||||
@ -189,7 +185,6 @@ public: //SMGlobalClass
|
|||||||
void OnSourceModAllInitialized()
|
void OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
pluginsys->AddPluginsListener(this);
|
pluginsys->AddPluginsListener(this);
|
||||||
sharesys->AddCapabilityProvider(NULL, this, FEATURECAP_MULTITARGETFILTER_CLIENTPARAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSourceModShutdown()
|
void OnSourceModShutdown()
|
||||||
@ -199,7 +194,6 @@ public: //SMGlobalClass
|
|||||||
playerhelpers->UnregisterCommandTargetProcessor(this);
|
playerhelpers->UnregisterCommandTargetProcessor(this);
|
||||||
filterEnabled = false;
|
filterEnabled = false;
|
||||||
}
|
}
|
||||||
sharesys->DropCapabilityProvider(NULL, this, FEATURECAP_MULTITARGETFILTER_CLIENTPARAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public: //IPluginsListener
|
public: //IPluginsListener
|
||||||
@ -217,13 +211,6 @@ public: //IPluginsListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public: //IFeatureProvider
|
|
||||||
|
|
||||||
FeatureStatus GetFeatureStatus(FeatureType type, const char *name)
|
|
||||||
{
|
|
||||||
return FeatureStatus_Available;
|
|
||||||
}
|
|
||||||
} s_PlayerLogicHelpers;
|
} s_PlayerLogicHelpers;
|
||||||
|
|
||||||
static cell_t
|
static cell_t
|
||||||
@ -270,7 +257,18 @@ static cell_t sm_GetClientCount(IPluginContext *pCtx, const cell_t *params)
|
|||||||
return playerhelpers->GetNumPlayers();
|
return playerhelpers->GetNumPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
return playerhelpers->GetNumClients();
|
int maxplayers = playerhelpers->GetMaxClients();
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 1; i <= maxplayers; ++i)
|
||||||
|
{
|
||||||
|
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(i);
|
||||||
|
if ((pPlayer->IsConnected()) && !(pPlayer->IsInGame()))
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (playerhelpers->GetNumPlayers() + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
|
static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
|
||||||
@ -1460,23 +1458,24 @@ static cell_t IsClientInKickQueue(IPluginContext *pContext, const cell_t *params
|
|||||||
return pPlayer->IsInKickQueue() ? 1 : 0;
|
return pPlayer->IsInKickQueue() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_target_info_t g_ProcessTargetString_info;
|
|
||||||
static cell_t ProcessTargetString(IPluginContext *pContext, const cell_t *params)
|
static cell_t ProcessTargetString(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
pContext->LocalToString(params[1], (char **) &g_ProcessTargetString_info.pattern);
|
cmd_target_info_t info;
|
||||||
g_ProcessTargetString_info.admin = params[2];
|
|
||||||
pContext->LocalToPhysAddr(params[3], &g_ProcessTargetString_info.targets);
|
pContext->LocalToString(params[1], (char **) &info.pattern);
|
||||||
g_ProcessTargetString_info.max_targets = params[4];
|
info.admin = params[2];
|
||||||
g_ProcessTargetString_info.flags = params[5];
|
pContext->LocalToPhysAddr(params[3], &info.targets);
|
||||||
pContext->LocalToString(params[6], &g_ProcessTargetString_info.target_name);
|
info.max_targets = params[4];
|
||||||
g_ProcessTargetString_info.target_name_maxlength = params[7];
|
info.flags = params[5];
|
||||||
|
pContext->LocalToString(params[6], &info.target_name);
|
||||||
|
info.target_name_maxlength = params[7];
|
||||||
|
|
||||||
cell_t *tn_is_ml;
|
cell_t *tn_is_ml;
|
||||||
pContext->LocalToPhysAddr(params[8], &tn_is_ml);
|
pContext->LocalToPhysAddr(params[8], &tn_is_ml);
|
||||||
|
|
||||||
playerhelpers->ProcessCommandTarget(&g_ProcessTargetString_info);
|
playerhelpers->ProcessCommandTarget(&info);
|
||||||
|
|
||||||
if (g_ProcessTargetString_info.target_name_style == COMMAND_TARGETNAME_ML)
|
if (info.target_name_style == COMMAND_TARGETNAME_ML)
|
||||||
{
|
{
|
||||||
*tn_is_ml = 1;
|
*tn_is_ml = 1;
|
||||||
}
|
}
|
||||||
@ -1485,30 +1484,16 @@ static cell_t ProcessTargetString(IPluginContext *pContext, const cell_t *params
|
|||||||
*tn_is_ml = 0;
|
*tn_is_ml = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_ProcessTargetString_info.num_targets == 0)
|
if (info.num_targets == 0)
|
||||||
{
|
{
|
||||||
return g_ProcessTargetString_info.reason;
|
return info.reason;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return g_ProcessTargetString_info.num_targets;
|
return info.num_targets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetLastProcessTargetString(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
cell_t *admin, *flags;
|
|
||||||
|
|
||||||
pContext->StringToLocalUTF8(params[1], params[2], g_ProcessTargetString_info.pattern, NULL);
|
|
||||||
pContext->LocalToPhysAddr(params[3], &admin);
|
|
||||||
pContext->LocalToPhysAddr(params[4], &flags);
|
|
||||||
|
|
||||||
*admin = g_ProcessTargetString_info.admin;
|
|
||||||
*flags = g_ProcessTargetString_info.flags;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t FormatActivitySource(IPluginContext *pContext, const cell_t *params)
|
static cell_t FormatActivitySource(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
@ -1660,7 +1645,6 @@ REGISTER_NATIVES(playernatives)
|
|||||||
{ "NotifyPostAdminCheck", NotifyPostAdminCheck },
|
{ "NotifyPostAdminCheck", NotifyPostAdminCheck },
|
||||||
{ "IsClientInKickQueue", IsClientInKickQueue },
|
{ "IsClientInKickQueue", IsClientInKickQueue },
|
||||||
{ "ProcessTargetString", ProcessTargetString },
|
{ "ProcessTargetString", ProcessTargetString },
|
||||||
{ "GetLastProcessTargetString", GetLastProcessTargetString },
|
|
||||||
{ "FormatActivitySource", FormatActivitySource },
|
{ "FormatActivitySource", FormatActivitySource },
|
||||||
{ "GetClientSerial", sm_GetClientSerial },
|
{ "GetClientSerial", sm_GetClientSerial },
|
||||||
{ "GetClientFromSerial", sm_GetClientFromSerial },
|
{ "GetClientFromSerial", sm_GetClientFromSerial },
|
||||||
|
@ -789,16 +789,6 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_IsCommandCallback(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
const ICommandArgs *pCmd = g_HL2.PeekCommandStack();
|
|
||||||
|
|
||||||
if (!pCmd)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t sm_GetCmdArgs(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_GetCmdArgs(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
const ICommandArgs *pCmd = g_HL2.PeekCommandStack();
|
const ICommandArgs *pCmd = g_HL2.PeekCommandStack();
|
||||||
@ -1477,7 +1467,6 @@ REGISTER_NATIVES(consoleNatives)
|
|||||||
{"GetConVarDefault", GetConVarDefault},
|
{"GetConVarDefault", GetConVarDefault},
|
||||||
{"RegServerCmd", sm_RegServerCmd},
|
{"RegServerCmd", sm_RegServerCmd},
|
||||||
{"RegConsoleCmd", sm_RegConsoleCmd},
|
{"RegConsoleCmd", sm_RegConsoleCmd},
|
||||||
{"IsCommandCallback", sm_IsCommandCallback},
|
|
||||||
{"GetCmdArgString", sm_GetCmdArgString},
|
{"GetCmdArgString", sm_GetCmdArgString},
|
||||||
{"GetCmdArgs", sm_GetCmdArgs},
|
{"GetCmdArgs", sm_GetCmdArgs},
|
||||||
{"GetCmdArg", sm_GetCmdArg},
|
{"GetCmdArg", sm_GetCmdArg},
|
||||||
|
@ -356,27 +356,6 @@ static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
|
|||||||
return sp_ftoc(value);
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_GetClientIClient(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
int client = params[1];
|
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
|
||||||
if (!pPlayer)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
|
||||||
}
|
|
||||||
else if (!pPlayer->IsConnected())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Client %d is not connected", client);
|
|
||||||
}
|
|
||||||
else if (pPlayer->IsFakeClient())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (cell_t)pPlayer->GetIClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params)
|
static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
@ -413,7 +392,6 @@ REGISTER_NATIVES(playernatives)
|
|||||||
{"GetClientAvgChoke", GetAvgChoke},
|
{"GetClientAvgChoke", GetAvgChoke},
|
||||||
{"GetClientAvgData", GetAvgData},
|
{"GetClientAvgData", GetAvgData},
|
||||||
{"GetClientAvgPackets", GetAvgPackets},
|
{"GetClientAvgPackets", GetAvgPackets},
|
||||||
{"GetClientIClient", sm_GetClientIClient },
|
|
||||||
{"RunAdminCacheChecks", RunAdminCacheChecks},
|
{"RunAdminCacheChecks", RunAdminCacheChecks},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -112,7 +112,6 @@ IServerTools *servertools = NULL;
|
|||||||
|
|
||||||
// global hooks and forwards
|
// global hooks and forwards
|
||||||
IForward *g_pOnEntityCreated = NULL;
|
IForward *g_pOnEntityCreated = NULL;
|
||||||
IForward *g_pOnEntitySpawned = NULL;
|
|
||||||
IForward *g_pOnEntityDestroyed = NULL;
|
IForward *g_pOnEntityDestroyed = NULL;
|
||||||
|
|
||||||
#ifdef GAMEDESC_CAN_CHANGE
|
#ifdef GAMEDESC_CAN_CHANGE
|
||||||
@ -253,7 +252,6 @@ bool SDKHooks::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
plsys->AddPluginsListener(&g_Interface);
|
plsys->AddPluginsListener(&g_Interface);
|
||||||
|
|
||||||
g_pOnEntityCreated = forwards->CreateForward("OnEntityCreated", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
g_pOnEntityCreated = forwards->CreateForward("OnEntityCreated", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
||||||
g_pOnEntitySpawned = forwards->CreateForward("OnEntitySpawned", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
|
||||||
g_pOnEntityDestroyed = forwards->CreateForward("OnEntityDestroyed", ET_Ignore, 1, NULL, Param_Cell);
|
g_pOnEntityDestroyed = forwards->CreateForward("OnEntityDestroyed", ET_Ignore, 1, NULL, Param_Cell);
|
||||||
#ifdef GAMEDESC_CAN_CHANGE
|
#ifdef GAMEDESC_CAN_CHANGE
|
||||||
g_pOnGetGameNameDescription = forwards->CreateForward("OnGetGameDescription", ET_Hook, 2, NULL, Param_String);
|
g_pOnGetGameNameDescription = forwards->CreateForward("OnGetGameDescription", ET_Hook, 2, NULL, Param_String);
|
||||||
@ -346,7 +344,6 @@ void SDKHooks::SDK_OnUnload()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
forwards->ReleaseForward(g_pOnEntityCreated);
|
forwards->ReleaseForward(g_pOnEntityCreated);
|
||||||
forwards->ReleaseForward(g_pOnEntitySpawned);
|
|
||||||
forwards->ReleaseForward(g_pOnEntityDestroyed);
|
forwards->ReleaseForward(g_pOnEntityDestroyed);
|
||||||
#ifdef GAMEDESC_CAN_CHANGE
|
#ifdef GAMEDESC_CAN_CHANGE
|
||||||
forwards->ReleaseForward(g_pOnGetGameNameDescription);
|
forwards->ReleaseForward(g_pOnGetGameNameDescription);
|
||||||
@ -423,7 +420,6 @@ void SDKHooks::OnClientPutInServer(int client)
|
|||||||
CBaseEntity *pPlayer = gamehelpers->ReferenceToEntity(client);
|
CBaseEntity *pPlayer = gamehelpers->ReferenceToEntity(client);
|
||||||
|
|
||||||
HandleEntityCreated(pPlayer, client, gamehelpers->EntityToReference(pPlayer));
|
HandleEntityCreated(pPlayer, client, gamehelpers->EntityToReference(pPlayer));
|
||||||
HandleEntitySpawned(pPlayer, client, gamehelpers->EntityToReference(pPlayer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDKHooks::OnClientDisconnecting(int client)
|
void SDKHooks::OnClientDisconnecting(int client)
|
||||||
@ -883,27 +879,6 @@ void SDKHooks::OnEntityCreated(CBaseEntity *pEntity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDKHooks::OnEntitySpawned(CBaseEntity *pEntity)
|
|
||||||
{
|
|
||||||
// Call OnEntitySpawned forward
|
|
||||||
int ref = gamehelpers->EntityToReference(pEntity);
|
|
||||||
int index = gamehelpers->ReferenceToIndex(ref);
|
|
||||||
|
|
||||||
// This can be -1 for player ents before any players have connected
|
|
||||||
if ((unsigned)index == INVALID_EHANDLE_INDEX || (index > 0 && index <= playerhelpers->GetMaxClients()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsEntityIndexInRange(index))
|
|
||||||
{
|
|
||||||
g_pSM->LogError(myself, "SDKHooks::OnEntitySpawned - Got entity index out of range (%d)", index);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleEntitySpawned(pEntity, index, ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GAMEDESC_CAN_CHANGE
|
#ifdef GAMEDESC_CAN_CHANGE
|
||||||
const char *SDKHooks::Hook_GetGameDescription()
|
const char *SDKHooks::Hook_GetGameDescription()
|
||||||
{
|
{
|
||||||
@ -1816,32 +1791,6 @@ void SDKHooks::HandleEntityCreated(CBaseEntity *pEntity, int index, cell_t ref)
|
|||||||
m_EntityCache[index] = ref;
|
m_EntityCache[index] = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDKHooks::HandleEntitySpawned(CBaseEntity *pEntity, int index, cell_t ref)
|
|
||||||
{
|
|
||||||
if (g_pOnEntitySpawned->GetFunctionCount() || m_EntListeners.size())
|
|
||||||
{
|
|
||||||
cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity);
|
|
||||||
const char *pName = gamehelpers->GetEntityClassname(pEntity);
|
|
||||||
if (!pName)
|
|
||||||
pName = "";
|
|
||||||
|
|
||||||
// Send OnEntitySpawned to SM listeners
|
|
||||||
for (SourceHook::List<ISMEntityListener *>::iterator iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
|
|
||||||
{
|
|
||||||
ISMEntityListener *pListener = (*iter);
|
|
||||||
pListener->OnEntitySpawned(pEntity, pName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call OnEntitySpawned forward
|
|
||||||
if (g_pOnEntitySpawned->GetFunctionCount())
|
|
||||||
{
|
|
||||||
g_pOnEntitySpawned->PushCell(bcompatRef);
|
|
||||||
g_pOnEntitySpawned->PushString(pName);
|
|
||||||
g_pOnEntitySpawned->Execute(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDKHooks::HandleEntityDeleted(CBaseEntity *pEntity)
|
void SDKHooks::HandleEntityDeleted(CBaseEntity *pEntity)
|
||||||
{
|
{
|
||||||
cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity);
|
cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity);
|
||||||
|
@ -238,7 +238,6 @@ public: // IFeatureProvider
|
|||||||
|
|
||||||
public: // IEntityListener
|
public: // IEntityListener
|
||||||
virtual void OnEntityCreated(CBaseEntity *pEntity);
|
virtual void OnEntityCreated(CBaseEntity *pEntity);
|
||||||
virtual void OnEntitySpawned(CBaseEntity *pEntity);
|
|
||||||
virtual void OnEntityDeleted(CBaseEntity *pEntity);
|
virtual void OnEntityDeleted(CBaseEntity *pEntity);
|
||||||
|
|
||||||
public: // IClientListener
|
public: // IClientListener
|
||||||
@ -331,7 +330,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void HandleEntityCreated(CBaseEntity *pEntity, int index, cell_t ref);
|
void HandleEntityCreated(CBaseEntity *pEntity, int index, cell_t ref);
|
||||||
void HandleEntitySpawned(CBaseEntity *pEntity, int index, cell_t ref);
|
|
||||||
void HandleEntityDeleted(CBaseEntity *pEntity);
|
void HandleEntityDeleted(CBaseEntity *pEntity);
|
||||||
void Unhook(CBaseEntity *pEntity);
|
void Unhook(CBaseEntity *pEntity);
|
||||||
void Unhook(IPluginContext *pContext);
|
void Unhook(IPluginContext *pContext);
|
||||||
|
@ -175,13 +175,7 @@ cell_t Native_TakeDamage(IPluginContext *pContext, const cell_t *params)
|
|||||||
vecDamagePosition = vec3_origin;
|
vecDamagePosition = vec3_origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iDamageCustom = 0;
|
CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition);
|
||||||
if (params[0] >= 9)
|
|
||||||
{
|
|
||||||
iDamageCustom = params[9];
|
|
||||||
}
|
|
||||||
|
|
||||||
CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition, iDamageCustom);
|
|
||||||
SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack &)info);
|
SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack &)info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
CTakeDamageInfo::CTakeDamageInfo(){}
|
CTakeDamageInfo::CTakeDamageInfo(){}
|
||||||
|
|
||||||
CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition, int iDamageCustom )
|
CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition )
|
||||||
{
|
{
|
||||||
m_hInflictor = pInflictor;
|
m_hInflictor = pInflictor;
|
||||||
if ( pAttacker )
|
if ( pAttacker )
|
||||||
@ -63,9 +63,9 @@ CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *
|
|||||||
m_iAmmoType = -1;
|
m_iAmmoType = -1;
|
||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
m_iCustomKillType = iDamageCustom;
|
m_iCustomKillType = 0;
|
||||||
#else
|
#else
|
||||||
m_iDamageCustom = iDamageCustom;
|
m_iDamageCustom = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \
|
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
class CTakeDamageInfoHack : public CTakeDamageInfo
|
class CTakeDamageInfoHack : public CTakeDamageInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition, int iDamageCustom=0);
|
CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition );
|
||||||
inline int GetAttacker() const { return m_hAttacker.IsValid() ? m_hAttacker.GetEntryIndex() : -1; }
|
inline int GetAttacker() const { return m_hAttacker.IsValid() ? m_hAttacker.GetEntryIndex() : -1; }
|
||||||
inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; }
|
inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; }
|
||||||
#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_LEFT4DEAD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_LEFT4DEAD
|
||||||
|
@ -484,7 +484,7 @@ bool SDKTools::ProcessCommandTarget(cmd_target_info_t *info)
|
|||||||
IPlayerInfo *plinfo = player->GetPlayerInfo();
|
IPlayerInfo *plinfo = player->GetPlayerInfo();
|
||||||
if (plinfo == NULL)
|
if (plinfo == NULL)
|
||||||
continue;
|
continue;
|
||||||
if ((plinfo->GetTeamIndex() == 0 || plinfo->GetTeamIndex() == 1) &&
|
if (plinfo->GetTeamIndex() == 1 &&
|
||||||
playerhelpers->FilterCommandTarget(pAdmin, player, info->flags) ==
|
playerhelpers->FilterCommandTarget(pAdmin, player, info->flags) ==
|
||||||
COMMAND_TARGET_VALID)
|
COMMAND_TARGET_VALID)
|
||||||
{
|
{
|
||||||
|
@ -53,10 +53,6 @@ static CBaseEntity *FindEntityByNetClass(int start, const char *classname)
|
|||||||
if (network == NULL)
|
if (network == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IHandleEntity *pHandleEnt = network->GetEntityHandle();
|
|
||||||
if (pHandleEnt == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ServerClass *sClass = network->GetServerClass();
|
ServerClass *sClass = network->GetServerClass();
|
||||||
const char *name = sClass->GetName();
|
const char *name = sClass->GetName();
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ void EntityOutputManager::Shutdown()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityOutputs->Destroy();
|
||||||
ClassNames->Destroy();
|
ClassNames->Destroy();
|
||||||
fireOutputDetour->Destroy();
|
fireOutputDetour->Destroy();
|
||||||
}
|
}
|
||||||
@ -65,6 +66,7 @@ void EntityOutputManager::Init()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityOutputs = adtfactory->CreateBasicTrie();
|
||||||
ClassNames = adtfactory->CreateBasicTrie();
|
ClassNames = adtfactory->CreateBasicTrie();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,9 +120,17 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char sOutput[20];
|
||||||
|
ke::SafeSprintf(sOutput, sizeof(sOutput), "%p", pOutput);
|
||||||
|
|
||||||
// attempt to directly lookup a hook using the pOutput pointer
|
// attempt to directly lookup a hook using the pOutput pointer
|
||||||
OutputNameStruct *pOutputName = NULL;
|
OutputNameStruct *pOutputName = NULL;
|
||||||
|
|
||||||
|
bool fastLookup = false;
|
||||||
|
|
||||||
|
// Fast lookup failed - check the slow way for hooks that haven't fired yet
|
||||||
|
if ((fastLookup = EntityOutputs->Retrieve(sOutput, (void **)&pOutputName)) == false)
|
||||||
|
{
|
||||||
const char *classname = gamehelpers->GetEntityClassname(pCaller);
|
const char *classname = gamehelpers->GetEntityClassname(pCaller);
|
||||||
if (!classname)
|
if (!classname)
|
||||||
{
|
{
|
||||||
@ -139,9 +149,16 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!pOutputName->hooks.empty())
|
if (!pOutputName->hooks.empty())
|
||||||
{
|
{
|
||||||
|
if (!fastLookup)
|
||||||
|
{
|
||||||
|
// hook exists on this classname and output - map it into our quick find trie
|
||||||
|
EntityOutputs->Insert(sOutput, pOutputName);
|
||||||
|
}
|
||||||
|
|
||||||
SourceHook::List<omg_hooks *>::iterator _iter;
|
SourceHook::List<omg_hooks *>::iterator _iter;
|
||||||
|
|
||||||
omg_hooks *hook;
|
omg_hooks *hook;
|
||||||
|
@ -121,6 +121,8 @@ private:
|
|||||||
|
|
||||||
const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
|
const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
|
||||||
|
|
||||||
|
//Maps CEntityOutput * to a OutputNameStruct
|
||||||
|
IBasicTrie *EntityOutputs;
|
||||||
// Maps classname to a ClassNameStruct
|
// Maps classname to a ClassNameStruct
|
||||||
IBasicTrie *ClassNames;
|
IBasicTrie *ClassNames;
|
||||||
|
|
||||||
|
@ -998,22 +998,6 @@ static cell_t smn_TRGetHitGroup(IPluginContext *pContext, const cell_t *params)
|
|||||||
return tr->hitgroup;
|
return tr->hitgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t smn_TRGetHitBoxIndex(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
sm_trace_t *tr;
|
|
||||||
HandleError err;
|
|
||||||
HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
|
|
||||||
|
|
||||||
if (params[1] == BAD_HANDLE)
|
|
||||||
{
|
|
||||||
tr = &g_Trace;
|
|
||||||
} else if ((err = handlesys->ReadHandle(params[1], g_TraceHandle, &sec, (void **)&tr)) != HandleError_None) {
|
|
||||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", params[1], err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tr->hitbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t smn_TRGetEntityIndex(IPluginContext *pContext, const cell_t *params)
|
static cell_t smn_TRGetEntityIndex(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
sm_trace_t *tr;
|
sm_trace_t *tr;
|
||||||
@ -1118,7 +1102,6 @@ sp_nativeinfo_t g_TRNatives[] =
|
|||||||
{"TR_StartSolid", smn_TRStartSolid},
|
{"TR_StartSolid", smn_TRStartSolid},
|
||||||
{"TR_DidHit", smn_TRDidHit},
|
{"TR_DidHit", smn_TRDidHit},
|
||||||
{"TR_GetHitGroup", smn_TRGetHitGroup},
|
{"TR_GetHitGroup", smn_TRGetHitGroup},
|
||||||
{"TR_GetHitBoxIndex", smn_TRGetHitBoxIndex},
|
|
||||||
{"TR_ClipRayToEntity", smn_TRClipRayToEntity},
|
{"TR_ClipRayToEntity", smn_TRClipRayToEntity},
|
||||||
{"TR_ClipRayToEntityEx", smn_TRClipRayToEntityEx},
|
{"TR_ClipRayToEntityEx", smn_TRClipRayToEntityEx},
|
||||||
{"TR_ClipRayHullToEntity", smn_TRClipRayHullToEntity},
|
{"TR_ClipRayHullToEntity", smn_TRClipRayHullToEntity},
|
||||||
|
@ -255,12 +255,10 @@ ValveCall *CreateValveVCall(unsigned int vtableIdx,
|
|||||||
|
|
||||||
/* Get return information - encode only */
|
/* Get return information - encode only */
|
||||||
PassInfo retBuf;
|
PassInfo retBuf;
|
||||||
ObjectField retFieldBuf[16];
|
|
||||||
size_t retBufSize = 0;
|
size_t retBufSize = 0;
|
||||||
bool retbuf_needs_extra;
|
bool retbuf_needs_extra;
|
||||||
if (retInfo)
|
if (retInfo)
|
||||||
{
|
{
|
||||||
retBuf.fields = retFieldBuf;
|
|
||||||
if ((size = ValveParamToBinParam(retInfo->vtype, retInfo->type, retInfo->flags, &retBuf, retbuf_needs_extra)) == 0)
|
if ((size = ValveParamToBinParam(retInfo->vtype, retInfo->type, retInfo->flags, &retBuf, retbuf_needs_extra)) == 0)
|
||||||
{
|
{
|
||||||
delete vc;
|
delete vc;
|
||||||
@ -271,14 +269,12 @@ ValveCall *CreateValveVCall(unsigned int vtableIdx,
|
|||||||
|
|
||||||
/* Get parameter info */
|
/* Get parameter info */
|
||||||
PassInfo paramBuf[32];
|
PassInfo paramBuf[32];
|
||||||
ObjectField fieldBuf[32][16];
|
|
||||||
size_t sizes[32];
|
size_t sizes[32];
|
||||||
size_t normSize = 0;
|
size_t normSize = 0;
|
||||||
size_t extraSize = 0;
|
size_t extraSize = 0;
|
||||||
for (unsigned int i=0; i<numParams; i++)
|
for (unsigned int i=0; i<numParams; i++)
|
||||||
{
|
{
|
||||||
bool needs_extra;
|
bool needs_extra;
|
||||||
paramBuf[i].fields = fieldBuf[i];
|
|
||||||
if ((size = ValveParamToBinParam(params[i].vtype,
|
if ((size = ValveParamToBinParam(params[i].vtype,
|
||||||
params[i].type,
|
params[i].type,
|
||||||
params[i].flags,
|
params[i].flags,
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
SOURCEMOD LICENSE INFORMATION
|
SOURCEMOD LICENSE INFORMATION
|
||||||
VERSION: 2019-9-30
|
VERSION: JUNE-13-2008
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
SourceMod is licensed under the GNU General Public License, version 3.
|
SourceMod is licensed under the GNU General Public License, version 3.
|
||||||
|
|
||||||
As a special exception, AlliedModders LLC gives you permission to link the code
|
As a special exception, AlliedModders LLC gives you permission to link the code
|
||||||
of this program (as well as its derivative works) to "Half-Life 2," the "Source
|
of this program (as well as its derivative works) to "Half-Life 2," the "Source
|
||||||
Engine" and any Game MODs that run on software by the Valve Corporation.
|
Engine," the "SourcePawn JIT," and any Game MODs that run on software by the
|
||||||
You must obey the GNU General Public License in all respects for all other code used.
|
Valve Corporation. You must obey the GNU General Public License in all
|
||||||
Additionally, AlliedModders LLC grants this exception to all derivative works.
|
respects for all other code used. Additionally, AlliedModders LLC grants this
|
||||||
|
exception to all derivative works.
|
||||||
|
|
||||||
As an additional special exception to the GNU General Public License 3.0,
|
As an additional special exception to the GNU General Public License 3.0,
|
||||||
AlliedModders LLC permits dual-licensing of DERIVATIVE WORKS ONLY (that is,
|
AlliedModders LLC permits dual-licensing of DERIVATIVE WORKS ONLY (that is,
|
||||||
@ -26,6 +27,7 @@ License version 2 (without an "or any higher version" clause) if and only if
|
|||||||
the work was already GNU General Public License 2.0 exclusive. This clause is
|
the work was already GNU General Public License 2.0 exclusive. This clause is
|
||||||
provided for backwards compatibility only.
|
provided for backwards compatibility only.
|
||||||
|
|
||||||
|
A copy of the JIT License is available in JIT.txt.
|
||||||
A copy of the GNU General Public License 2.0 is available in GPLv2.txt.
|
A copy of the GNU General Public License 2.0 is available in GPLv2.txt.
|
||||||
A copy of the GNU General Public License 3.0 is available in GPLv3.txt.
|
A copy of the GNU General Public License 3.0 is available in GPLv3.txt.
|
||||||
|
|
||||||
@ -33,4 +35,5 @@ SourcePawn is Copyright (C) 2006-2008 AlliedModders LLC. All rights reserved.
|
|||||||
SourceMod is Copyright (C) 2006-2008 AlliedModders LLC. All rights reserved.
|
SourceMod is Copyright (C) 2006-2008 AlliedModders LLC. All rights reserved.
|
||||||
Pawn and SMALL are Copyright (C) 1997-2008 ITB CompuPhase.
|
Pawn and SMALL are Copyright (C) 1997-2008 ITB CompuPhase.
|
||||||
Source is Copyright (C) Valve Corporation.
|
Source is Copyright (C) Valve Corporation.
|
||||||
All trademarks are property of their respective owners in the US and other countries.
|
All trademarks are property of their respective owners in the US and other
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@ files = [
|
|||||||
'basecommands.sp',
|
'basecommands.sp',
|
||||||
'mapchooser.sp',
|
'mapchooser.sp',
|
||||||
'randomcycle.sp',
|
'randomcycle.sp',
|
||||||
'sql-admin-manager.sp',
|
'sql-admin-manager.sp'
|
||||||
'DynamicTargeting.sp'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
spcomp_argv = [
|
spcomp_argv = [
|
||||||
|
@ -1,266 +0,0 @@
|
|||||||
#pragma semicolon 1
|
|
||||||
#define PLUGIN_VERSION "1.0"
|
|
||||||
|
|
||||||
#include <sourcemod>
|
|
||||||
#include <DynamicTargeting>
|
|
||||||
|
|
||||||
#pragma newdecls required
|
|
||||||
|
|
||||||
public Plugin myinfo =
|
|
||||||
{
|
|
||||||
name = "Dynamic Targeting",
|
|
||||||
author = "BotoX",
|
|
||||||
description = "",
|
|
||||||
version = PLUGIN_VERSION,
|
|
||||||
url = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
char g_PlayerNames[MAXPLAYERS + 1][MAX_NAME_LENGTH];
|
|
||||||
Handle g_PlayerData[MAXPLAYERS + 1];
|
|
||||||
|
|
||||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
|
||||||
{
|
|
||||||
CreateNative("AmbiguousMenu", Native_AmbiguousMenu);
|
|
||||||
RegPluginLibrary("DynamicTargeting");
|
|
||||||
|
|
||||||
return APLRes_Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnClientDisconnect(int client)
|
|
||||||
{
|
|
||||||
if(g_PlayerData[client] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
CloseHandle(g_PlayerData[client]);
|
|
||||||
g_PlayerData[client] = INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int CreateAmbiguousMenu(int client, const char[] sCommand, const char[] sArgString, const char[] sPattern, int FilterFlags)
|
|
||||||
{
|
|
||||||
Menu menu = new Menu(MenuHandler_AmbiguousMenu, MenuAction_Select|MenuAction_Cancel|MenuAction_End|MenuAction_DrawItem|MenuAction_DisplayItem);
|
|
||||||
menu.ExitButton = true;
|
|
||||||
|
|
||||||
char sTitle[32 + MAX_TARGET_LENGTH];
|
|
||||||
FormatEx(sTitle, sizeof(sTitle), "Target \"%s\" is ambiguous.", sPattern);
|
|
||||||
menu.SetTitle(sTitle);
|
|
||||||
|
|
||||||
int Players = 0;
|
|
||||||
int[] aClients = new int[MaxClients + 1];
|
|
||||||
|
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
|
||||||
{
|
|
||||||
if(!IsClientConnected(i) || i == client)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(FilterFlags & COMMAND_FILTER_NO_BOTS && IsFakeClient(i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!(FilterFlags & COMMAND_FILTER_CONNECTED) && !IsClientInGame(i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(FilterFlags & COMMAND_FILTER_ALIVE && !IsPlayerAlive(i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(FilterFlags & COMMAND_FILTER_DEAD && IsPlayerAlive(i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// insert player names into g_PlayerNames array
|
|
||||||
GetClientName(i, g_PlayerNames[i], sizeof(g_PlayerNames[]));
|
|
||||||
|
|
||||||
if(StrContains(g_PlayerNames[i], sPattern, false) != -1)
|
|
||||||
aClients[Players++] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
// sort aClients array by player name
|
|
||||||
SortCustom1D(aClients, Players, SortByPlayerName);
|
|
||||||
|
|
||||||
// insert players sorted
|
|
||||||
char sUserId[12];
|
|
||||||
char sDisp[MAX_NAME_LENGTH + 16];
|
|
||||||
for(int i = 0; i < Players; i++)
|
|
||||||
{
|
|
||||||
IntToString(GetClientUserId(aClients[i]), sUserId, sizeof(sUserId));
|
|
||||||
|
|
||||||
FormatEx(sDisp, sizeof(sDisp), "%s (%s)", g_PlayerNames[aClients[i]], sUserId);
|
|
||||||
menu.AddItem(sUserId, sDisp);
|
|
||||||
}
|
|
||||||
|
|
||||||
DataPack pack = new DataPack();
|
|
||||||
pack.WriteString(sCommand);
|
|
||||||
pack.WriteString(sArgString);
|
|
||||||
pack.WriteString(sPattern);
|
|
||||||
pack.WriteCell(FilterFlags);
|
|
||||||
|
|
||||||
if(g_PlayerData[client] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
CloseHandle(g_PlayerData[client]);
|
|
||||||
g_PlayerData[client] = INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
CancelClientMenu(client);
|
|
||||||
|
|
||||||
g_PlayerData[client] = pack;
|
|
||||||
menu.Display(client, MENU_TIME_FOREVER);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int MenuHandler_AmbiguousMenu(Menu menu, MenuAction action, int param1, int param2)
|
|
||||||
{
|
|
||||||
switch(action)
|
|
||||||
{
|
|
||||||
case MenuAction_End:
|
|
||||||
{
|
|
||||||
CloseHandle(menu);
|
|
||||||
}
|
|
||||||
case MenuAction_Cancel:
|
|
||||||
{
|
|
||||||
if(g_PlayerData[param1] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
CloseHandle(g_PlayerData[param1]);
|
|
||||||
g_PlayerData[param1] = INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case MenuAction_Select:
|
|
||||||
{
|
|
||||||
int Style;
|
|
||||||
char sItem[32];
|
|
||||||
char sDisp[MAX_NAME_LENGTH + 16];
|
|
||||||
menu.GetItem(param2, sItem, sizeof(sItem), Style, sDisp, sizeof(sDisp));
|
|
||||||
|
|
||||||
int UserId = StringToInt(sItem);
|
|
||||||
int client = GetClientOfUserId(UserId);
|
|
||||||
if(!client)
|
|
||||||
{
|
|
||||||
PrintToChat(param1, "\x04[DynamicTargeting]\x01 Player no longer available.");
|
|
||||||
menu.DisplayAt(param1, GetMenuSelectionPosition(), MENU_TIME_FOREVER);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataPack pack = view_as<DataPack>(g_PlayerData[param1]);
|
|
||||||
pack.Reset();
|
|
||||||
|
|
||||||
char sCommand[128];
|
|
||||||
pack.ReadString(sCommand, sizeof(sCommand));
|
|
||||||
|
|
||||||
char sArgString[256];
|
|
||||||
pack.ReadString(sArgString, sizeof(sArgString));
|
|
||||||
|
|
||||||
char sPattern[MAX_TARGET_LENGTH];
|
|
||||||
pack.ReadString(sPattern, sizeof(sPattern));
|
|
||||||
|
|
||||||
int Result = ReCallAmbiguous(param1, client, sCommand, sArgString, sPattern);
|
|
||||||
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
case MenuAction_DrawItem:
|
|
||||||
{
|
|
||||||
int Style;
|
|
||||||
char sItem[32];
|
|
||||||
menu.GetItem(param2, sItem, sizeof(sItem), Style);
|
|
||||||
|
|
||||||
int UserId = StringToInt(sItem);
|
|
||||||
int client = GetClientOfUserId(UserId);
|
|
||||||
if(!client) // Player disconnected
|
|
||||||
return ITEMDRAW_DISABLED;
|
|
||||||
|
|
||||||
return Style;
|
|
||||||
}
|
|
||||||
case MenuAction_DisplayItem:
|
|
||||||
{
|
|
||||||
int Style;
|
|
||||||
char sItem[32];
|
|
||||||
char sDisp[MAX_NAME_LENGTH + 16];
|
|
||||||
menu.GetItem(param2, sItem, sizeof(sItem), Style, sDisp, sizeof(sDisp));
|
|
||||||
|
|
||||||
if(!sItem[0])
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
char sBuffer[MAX_NAME_LENGTH + 16];
|
|
||||||
int UserId = StringToInt(sItem);
|
|
||||||
int client = GetClientOfUserId(UserId);
|
|
||||||
if(!client) // Player disconnected
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
GetClientName(client, g_PlayerNames[client], sizeof(g_PlayerNames[]));
|
|
||||||
FormatEx(sBuffer, sizeof(sBuffer), "%s (%d)", g_PlayerNames[client], UserId);
|
|
||||||
|
|
||||||
if(!StrEqual(sDisp, sBuffer))
|
|
||||||
return RedrawMenuItem(sBuffer);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ReCallAmbiguous(int client, int newClient, const char[] sCommand, const char[] sArgString, const char[] sPattern)
|
|
||||||
{
|
|
||||||
char sTarget[16];
|
|
||||||
FormatEx(sTarget, sizeof(sTarget), "#%d", GetClientUserId(newClient));
|
|
||||||
|
|
||||||
char sNewArgString[256];
|
|
||||||
strcopy(sNewArgString, sizeof(sNewArgString), sArgString);
|
|
||||||
|
|
||||||
char sPart[256];
|
|
||||||
int CurrentIndex = 0;
|
|
||||||
int NextIndex = 0;
|
|
||||||
|
|
||||||
while(NextIndex != -1 && CurrentIndex < sizeof(sNewArgString))
|
|
||||||
{
|
|
||||||
NextIndex = BreakString(sNewArgString[CurrentIndex], sPart, sizeof(sPart));
|
|
||||||
|
|
||||||
if(StrEqual(sPart, sPattern))
|
|
||||||
{
|
|
||||||
ReplaceStringEx(sNewArgString[CurrentIndex], sizeof(sNewArgString) - CurrentIndex, sPart, sTarget);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentIndex += NextIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
FakeClientCommandEx(client, "%s %s", sCommand, sNewArgString);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Native_AmbiguousMenu(Handle plugin, int numParams)
|
|
||||||
{
|
|
||||||
int client = GetNativeCell(1);
|
|
||||||
|
|
||||||
if(client > MaxClients || client <= 0)
|
|
||||||
{
|
|
||||||
ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!IsClientInGame(client))
|
|
||||||
{
|
|
||||||
ThrowNativeError(SP_ERROR_NATIVE, "Client is not in-game.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(IsFakeClient(client))
|
|
||||||
{
|
|
||||||
ThrowNativeError(SP_ERROR_NATIVE, "Client is fake-client.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
char sCommand[128];
|
|
||||||
GetNativeString(2, sCommand, sizeof(sCommand));
|
|
||||||
|
|
||||||
char sArgString[256];
|
|
||||||
GetNativeString(3, sArgString, sizeof(sArgString));
|
|
||||||
|
|
||||||
char sPattern[MAX_TARGET_LENGTH];
|
|
||||||
GetNativeString(4, sPattern, sizeof(sPattern));
|
|
||||||
|
|
||||||
int FilterFlags = GetNativeCell(5);
|
|
||||||
|
|
||||||
return CreateAmbiguousMenu(client, sCommand, sArgString, sPattern, FilterFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int SortByPlayerName(int elem1, int elem2, const int[] array, Handle hndl)
|
|
||||||
{
|
|
||||||
return strcmp(g_PlayerNames[elem1], g_PlayerNames[elem2], false);
|
|
||||||
}
|
|
@ -4,26 +4,26 @@
|
|||||||
|
|
||||||
#define ARRAY_STRING_LENGTH 32
|
#define ARRAY_STRING_LENGTH 32
|
||||||
|
|
||||||
enum struct GroupCommands
|
enum GroupCommands
|
||||||
{
|
{
|
||||||
ArrayList groupListName;
|
ArrayList:groupListName,
|
||||||
ArrayList groupListCommand;
|
ArrayList:groupListCommand
|
||||||
}
|
};
|
||||||
|
|
||||||
GroupCommands g_groupList;
|
int g_groupList[GroupCommands];
|
||||||
int g_groupCount;
|
int g_groupCount;
|
||||||
|
|
||||||
SMCParser g_configParser;
|
SMCParser g_configParser;
|
||||||
|
|
||||||
enum struct Places
|
enum Places
|
||||||
{
|
{
|
||||||
int category;
|
Place_Category,
|
||||||
int item;
|
Place_Item,
|
||||||
int replaceNum;
|
Place_ReplaceNum
|
||||||
}
|
};
|
||||||
|
|
||||||
char g_command[MAXPLAYERS+1][CMD_LENGTH];
|
char g_command[MAXPLAYERS+1][CMD_LENGTH];
|
||||||
Places g_currentPlace[MAXPLAYERS+1];
|
int g_currentPlace[MAXPLAYERS+1][Places];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What to put in the 'info' menu field (for PlayerList and Player_Team menus only)
|
* What to put in the 'info' menu field (for PlayerList and Player_Team menus only)
|
||||||
@ -331,11 +331,11 @@ void ParseConfigs()
|
|||||||
g_configParser.OnKeyValue = KeyValue;
|
g_configParser.OnKeyValue = KeyValue;
|
||||||
g_configParser.OnLeaveSection = EndSection;
|
g_configParser.OnLeaveSection = EndSection;
|
||||||
|
|
||||||
delete g_groupList.groupListName;
|
delete g_groupList[groupListName];
|
||||||
delete g_groupList.groupListCommand;
|
delete g_groupList[groupListCommand];
|
||||||
|
|
||||||
g_groupList.groupListName = new ArrayList(ARRAY_STRING_LENGTH);
|
g_groupList[groupListName] = new ArrayList(ARRAY_STRING_LENGTH);
|
||||||
g_groupList.groupListCommand = new ArrayList(ARRAY_STRING_LENGTH);
|
g_groupList[groupListCommand] = new ArrayList(ARRAY_STRING_LENGTH);
|
||||||
|
|
||||||
char configPath[256];
|
char configPath[256];
|
||||||
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/dynamicmenu/adminmenu_grouping.txt");
|
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/dynamicmenu/adminmenu_grouping.txt");
|
||||||
@ -376,13 +376,13 @@ public SMCResult NewSection(SMCParser smc, const char[] name, bool opt_quotes)
|
|||||||
|
|
||||||
public SMCResult KeyValue(SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes)
|
public SMCResult KeyValue(SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes)
|
||||||
{
|
{
|
||||||
g_groupList.groupListName.PushString(key);
|
g_groupList[groupListName].PushString(key);
|
||||||
g_groupList.groupListCommand.PushString(value);
|
g_groupList[groupListCommand].PushString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SMCResult EndSection(SMCParser smc)
|
public SMCResult EndSection(SMCParser smc)
|
||||||
{
|
{
|
||||||
g_groupCount = g_groupList.groupListName.Length;
|
g_groupCount = g_groupList[groupListName].Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DynamicMenuCategoryHandler(TopMenu topmenu,
|
public void DynamicMenuCategoryHandler(TopMenu topmenu,
|
||||||
@ -421,8 +421,8 @@ public void DynamicMenuItemHandler(TopMenu topmenu,
|
|||||||
|
|
||||||
strcopy(g_command[param], sizeof(g_command[]), output.cmd);
|
strcopy(g_command[param], sizeof(g_command[]), output.cmd);
|
||||||
|
|
||||||
g_currentPlace[param].item = location;
|
g_currentPlace[param][Place_Item] = location;
|
||||||
g_currentPlace[param].replaceNum = 1;
|
g_currentPlace[param][Place_ReplaceNum] = 1;
|
||||||
|
|
||||||
ParamCheck(param);
|
ParamCheck(param);
|
||||||
}
|
}
|
||||||
@ -436,19 +436,19 @@ public void ParamCheck(int client)
|
|||||||
Item outputItem;
|
Item outputItem;
|
||||||
Submenu outputSubmenu;
|
Submenu outputSubmenu;
|
||||||
|
|
||||||
g_DataArray.GetArray(g_currentPlace[client].item, outputItem);
|
g_DataArray.GetArray(g_currentPlace[client][Place_Item], outputItem);
|
||||||
|
|
||||||
if (g_currentPlace[client].replaceNum < 1)
|
if (g_currentPlace[client][Place_ReplaceNum] < 1)
|
||||||
{
|
{
|
||||||
g_currentPlace[client].replaceNum = 1;
|
g_currentPlace[client][Place_ReplaceNum] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Format(buffer, 5, "#%i", g_currentPlace[client].replaceNum);
|
Format(buffer, 5, "#%i", g_currentPlace[client][Place_ReplaceNum]);
|
||||||
Format(buffer2, 5, "@%i", g_currentPlace[client].replaceNum);
|
Format(buffer2, 5, "@%i", g_currentPlace[client][Place_ReplaceNum]);
|
||||||
|
|
||||||
if (StrContains(g_command[client], buffer) != -1 || StrContains(g_command[client], buffer2) != -1)
|
if (StrContains(g_command[client], buffer) != -1 || StrContains(g_command[client], buffer2) != -1)
|
||||||
{
|
{
|
||||||
outputItem.submenus.GetArray(g_currentPlace[client].replaceNum - 1, outputSubmenu);
|
outputItem.submenus.GetArray(g_currentPlace[client][Place_ReplaceNum] - 1, outputSubmenu);
|
||||||
|
|
||||||
Menu itemMenu = new Menu(Menu_Selection);
|
Menu itemMenu = new Menu(Menu_Selection);
|
||||||
itemMenu.ExitBackButton = true;
|
itemMenu.ExitBackButton = true;
|
||||||
@ -460,8 +460,8 @@ public void ParamCheck(int client)
|
|||||||
|
|
||||||
for (int i = 0; i<g_groupCount; i++)
|
for (int i = 0; i<g_groupCount; i++)
|
||||||
{
|
{
|
||||||
g_groupList.groupListName.GetString(i, nameBuffer, sizeof(nameBuffer));
|
g_groupList[groupListName].GetString(i, nameBuffer, sizeof(nameBuffer));
|
||||||
g_groupList.groupListCommand.GetString(i, commandBuffer, sizeof(commandBuffer));
|
g_groupList[groupListCommand].GetString(i, commandBuffer, sizeof(commandBuffer));
|
||||||
itemMenu.AddItem(commandBuffer, nameBuffer);
|
itemMenu.AddItem(commandBuffer, nameBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,7 +591,7 @@ public void ParamCheck(int client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_command[client][0] = '\0';
|
g_command[client][0] = '\0';
|
||||||
g_currentPlace[client].replaceNum = 1;
|
g_currentPlace[client][Place_ReplaceNum] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,16 +622,16 @@ public int Menu_Selection(Menu menu, MenuAction action, int param1, int param2)
|
|||||||
char infobuffer[NAME_LENGTH+2];
|
char infobuffer[NAME_LENGTH+2];
|
||||||
Format(infobuffer, sizeof(infobuffer), "\"%s\"", info);
|
Format(infobuffer, sizeof(infobuffer), "\"%s\"", info);
|
||||||
|
|
||||||
Format(buffer, 5, "#%i", g_currentPlace[param1].replaceNum);
|
Format(buffer, 5, "#%i", g_currentPlace[param1][Place_ReplaceNum]);
|
||||||
ReplaceString(g_command[param1], sizeof(g_command[]), buffer, infobuffer);
|
ReplaceString(g_command[param1], sizeof(g_command[]), buffer, infobuffer);
|
||||||
//replace #num with the selected option (quoted)
|
//replace #num with the selected option (quoted)
|
||||||
|
|
||||||
Format(buffer, 5, "@%i", g_currentPlace[param1].replaceNum);
|
Format(buffer, 5, "@%i", g_currentPlace[param1][Place_ReplaceNum]);
|
||||||
ReplaceString(g_command[param1], sizeof(g_command[]), buffer, info);
|
ReplaceString(g_command[param1], sizeof(g_command[]), buffer, info);
|
||||||
//replace @num with the selected option (unquoted)
|
//replace @num with the selected option (unquoted)
|
||||||
|
|
||||||
// Increment the parameter counter.
|
// Increment the parameter counter.
|
||||||
g_currentPlace[param1].replaceNum++;
|
g_currentPlace[param1][Place_ReplaceNum]++;
|
||||||
|
|
||||||
ParamCheck(param1);
|
ParamCheck(param1);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
|
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <basecomm>
|
|
||||||
|
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
@ -81,9 +80,6 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
|
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
|
||||||
{
|
{
|
||||||
if (client <= 0 || BaseComm_IsClientGagged(client))
|
|
||||||
return Plugin_Continue;
|
|
||||||
|
|
||||||
int startidx;
|
int startidx;
|
||||||
if (sArgs[startidx] != CHAT_SYMBOL)
|
if (sArgs[startidx] != CHAT_SYMBOL)
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
@ -92,7 +88,24 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
|
|||||||
|
|
||||||
if (strcmp(command, "say", false) == 0)
|
if (strcmp(command, "say", false) == 0)
|
||||||
{
|
{
|
||||||
if (!CheckCommandAccess(client, "sm_psay_chat", ADMFLAG_CHAT))
|
if (sArgs[startidx] != CHAT_SYMBOL) // sm_say alias
|
||||||
|
{
|
||||||
|
if (!CheckCommandAccess(client, "sm_say", ADMFLAG_CHAT))
|
||||||
|
{
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendChatToAll(client, sArgs[startidx]);
|
||||||
|
LogAction(client, -1, "\"%L\" triggered sm_say (text %s)", client, sArgs[startidx]);
|
||||||
|
|
||||||
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
startidx++;
|
||||||
|
|
||||||
|
if (sArgs[startidx] != CHAT_SYMBOL) // sm_psay alias
|
||||||
|
{
|
||||||
|
if (!CheckCommandAccess(client, "sm_psay", ADMFLAG_CHAT))
|
||||||
{
|
{
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
@ -109,6 +122,20 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
|
|||||||
|
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startidx++;
|
||||||
|
|
||||||
|
// sm_csay alias
|
||||||
|
if (!CheckCommandAccess(client, "sm_csay", ADMFLAG_CHAT))
|
||||||
|
{
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayCenterTextToAll(client, sArgs[startidx]);
|
||||||
|
LogAction(client, -1, "\"%L\" triggered sm_csay (text %s)", client, sArgs[startidx]);
|
||||||
|
|
||||||
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
else if (strcmp(command, "say_team", false) == 0 || strcmp(command, "say_squad", false) == 0)
|
else if (strcmp(command, "say_team", false) == 0 || strcmp(command, "say_squad", false) == 0)
|
||||||
{
|
{
|
||||||
if (!CheckCommandAccess(client, "sm_chat", ADMFLAG_CHAT) && !g_Cvar_Chatmode.BoolValue)
|
if (!CheckCommandAccess(client, "sm_chat", ADMFLAG_CHAT) && !g_Cvar_Chatmode.BoolValue)
|
||||||
|
@ -186,53 +186,52 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa
|
|||||||
{
|
{
|
||||||
case CommType_Mute:
|
case CommType_Mute:
|
||||||
{
|
{
|
||||||
PerformMute(target);
|
PerformMute(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" muted \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
|
||||||
}
|
}
|
||||||
case CommType_UnMute:
|
case CommType_UnMute:
|
||||||
{
|
{
|
||||||
PerformUnMute(target);
|
PerformUnMute(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" unmuted \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
|
||||||
}
|
}
|
||||||
case CommType_Gag:
|
case CommType_Gag:
|
||||||
{
|
{
|
||||||
PerformGag(target);
|
PerformGag(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" gagged \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
|
||||||
}
|
}
|
||||||
case CommType_UnGag:
|
case CommType_UnGag:
|
||||||
{
|
{
|
||||||
PerformUnGag(target);
|
PerformUnGag(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" ungagged \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
|
||||||
}
|
}
|
||||||
case CommType_Silence:
|
case CommType_Silence:
|
||||||
{
|
{
|
||||||
PerformSilence(target);
|
PerformSilence(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" silenced \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
|
||||||
}
|
}
|
||||||
case CommType_UnSilence:
|
case CommType_UnSilence:
|
||||||
{
|
{
|
||||||
PerformUnSilence(target);
|
PerformUnSilence(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" unsilenced \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformMute(int target)
|
void PerformMute(int client, int target, bool silent=false)
|
||||||
{
|
{
|
||||||
playerstate[target].isMuted = true;
|
playerstate[target].isMuted = true;
|
||||||
SetClientListeningFlags(target, VOICE_MUTED);
|
SetClientListeningFlags(target, VOICE_MUTED);
|
||||||
|
|
||||||
FireOnClientMute(target, true);
|
FireOnClientMute(target, true);
|
||||||
|
|
||||||
|
if (!silent)
|
||||||
|
{
|
||||||
|
LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformUnMute(int target)
|
void PerformUnMute(int client, int target, bool silent=false)
|
||||||
{
|
{
|
||||||
playerstate[target].isMuted = false;
|
playerstate[target].isMuted = false;
|
||||||
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
||||||
@ -249,21 +248,36 @@ void PerformUnMute(int target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FireOnClientMute(target, false);
|
FireOnClientMute(target, false);
|
||||||
|
|
||||||
|
if (!silent)
|
||||||
|
{
|
||||||
|
LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformGag(int target)
|
void PerformGag(int client, int target, bool silent=false)
|
||||||
{
|
{
|
||||||
playerstate[target].isGagged = true;
|
playerstate[target].isGagged = true;
|
||||||
FireOnClientGag(target, true);
|
FireOnClientGag(target, true);
|
||||||
|
|
||||||
|
if (!silent)
|
||||||
|
{
|
||||||
|
LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformUnGag(int target)
|
void PerformUnGag(int client, int target, bool silent=false)
|
||||||
{
|
{
|
||||||
playerstate[target].isGagged = false;
|
playerstate[target].isGagged = false;
|
||||||
FireOnClientGag(target, false);
|
FireOnClientGag(target, false);
|
||||||
|
|
||||||
|
if (!silent)
|
||||||
|
{
|
||||||
|
LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformSilence(int target)
|
void PerformSilence(int client, int target)
|
||||||
{
|
{
|
||||||
if (!playerstate[target].isGagged)
|
if (!playerstate[target].isGagged)
|
||||||
{
|
{
|
||||||
@ -277,9 +291,11 @@ void PerformSilence(int target)
|
|||||||
SetClientListeningFlags(target, VOICE_MUTED);
|
SetClientListeningFlags(target, VOICE_MUTED);
|
||||||
FireOnClientMute(target, true);
|
FireOnClientMute(target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformUnSilence(int target)
|
void PerformUnSilence(int client, int target)
|
||||||
{
|
{
|
||||||
if (playerstate[target].isGagged)
|
if (playerstate[target].isGagged)
|
||||||
{
|
{
|
||||||
@ -305,6 +321,8 @@ void PerformUnSilence(int target)
|
|||||||
}
|
}
|
||||||
FireOnClientMute(target, false);
|
FireOnClientMute(target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Command_Mute(int client, int args)
|
public Action Command_Mute(int client, int args)
|
||||||
@ -340,18 +358,16 @@ public Action Command_Mute(int client, int args)
|
|||||||
{
|
{
|
||||||
int target = target_list[i];
|
int target = target_list[i];
|
||||||
|
|
||||||
PerformMute(target);
|
PerformMute(client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Muted target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Muted target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" muted \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Muted target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Muted target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" muted \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -390,18 +406,16 @@ public Action Command_Gag(int client, int args)
|
|||||||
{
|
{
|
||||||
int target = target_list[i];
|
int target = target_list[i];
|
||||||
|
|
||||||
PerformGag(target);
|
PerformGag(client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Gagged target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Gagged target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" gagged \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Gagged target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Gagged target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" gagged \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -440,18 +454,16 @@ public Action Command_Silence(int client, int args)
|
|||||||
{
|
{
|
||||||
int target = target_list[i];
|
int target = target_list[i];
|
||||||
|
|
||||||
PerformSilence(target);
|
PerformSilence(client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Silenced target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Silenced target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" silenced \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Silenced target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Silenced target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" silenced \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -495,11 +507,9 @@ public Action Command_Unmute(int client, int args)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformUnMute(target);
|
PerformUnMute(client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogAction(client, -1, "\"%L\" unmuted \"%s\"", client, target_name);
|
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Unmuted target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Unmuted target", target_name);
|
||||||
@ -545,18 +555,16 @@ public Action Command_Ungag(int client, int args)
|
|||||||
{
|
{
|
||||||
int target = target_list[i];
|
int target = target_list[i];
|
||||||
|
|
||||||
PerformUnGag(target);
|
PerformUnGag(client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" ungagged \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" ungagged \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -595,18 +603,16 @@ public Action Command_Unsilence(int client, int args)
|
|||||||
{
|
{
|
||||||
int target = target_list[i];
|
int target = target_list[i];
|
||||||
|
|
||||||
PerformUnSilence(target);
|
PerformUnSilence(client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" unsilenced \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" unsilenced \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -85,7 +85,7 @@ public int Native_SetClientGag(Handle hPlugin, int numParams)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformGag(client);
|
PerformGag(-1, client, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ public int Native_SetClientGag(Handle hPlugin, int numParams)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformUnGag(client);
|
PerformUnGag(-1, client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -122,7 +122,7 @@ public int Native_SetClientMute(Handle hPlugin, int numParams)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformMute(client);
|
PerformMute(-1, client, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ public int Native_SetClientMute(Handle hPlugin, int numParams)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformUnMute(client);
|
PerformUnMute(-1, client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -31,8 +31,10 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PerformKick(int target, const char[] reason)
|
void PerformKick(int client, int target, const char[] reason)
|
||||||
{
|
{
|
||||||
|
LogAction(client, target, "\"%L\" kicked \"%L\" (reason \"%s\")", client, target, reason);
|
||||||
|
|
||||||
if (reason[0] == '\0')
|
if (reason[0] == '\0')
|
||||||
{
|
{
|
||||||
KickClient(target, "%t", "Kicked by admin");
|
KickClient(target, "%t", "Kicked by admin");
|
||||||
@ -108,8 +110,7 @@ public int MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_s", name);
|
||||||
PerformKick(target, "");
|
PerformKick(param1, target, "");
|
||||||
LogAction(param1, target, "\"%L\" kicked \"%L\"", param1, target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-draw the menu if they're still valid */
|
/* Re-draw the menu if they're still valid */
|
||||||
@ -200,22 +201,13 @@ public Action Command_Kick(int client, int args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PerformKick(target_list[i], reason);
|
PerformKick(client, target_list[i], reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kick_self)
|
if (kick_self)
|
||||||
{
|
{
|
||||||
PerformKick(client, reason);
|
PerformKick(client, client, reason);
|
||||||
}
|
|
||||||
|
|
||||||
if (tn_is_ml)
|
|
||||||
{
|
|
||||||
LogAction(client, -1, "\"%L\" kicked \"%s\" (reason \"%s\")", client, target_name, reason);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogAction(client, target_list[0], "\"%L\" kicked \"%L\" (reason \"%s\")", client, target_list[0], reason);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -46,11 +46,6 @@ public int MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int p
|
|||||||
|
|
||||||
menu.GetItem(param2, map, sizeof(map));
|
menu.GetItem(param2, map, sizeof(map));
|
||||||
|
|
||||||
if (!map[0])
|
|
||||||
{
|
|
||||||
GetCurrentMap(map, sizeof(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
|
ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
|
||||||
|
|
||||||
LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
|
LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
|
||||||
@ -162,14 +157,10 @@ int LoadMapList(Menu menu)
|
|||||||
char map_name[PLATFORM_MAX_PATH];
|
char map_name[PLATFORM_MAX_PATH];
|
||||||
int map_count = GetArraySize(g_map_array);
|
int map_count = GetArraySize(g_map_array);
|
||||||
|
|
||||||
menu.AddItem("", "Restart Current Map");
|
|
||||||
|
|
||||||
for (int i = 0; i < map_count; i++)
|
for (int i = 0; i < map_count; i++)
|
||||||
{
|
{
|
||||||
char displayName[PLATFORM_MAX_PATH];
|
|
||||||
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
|
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
|
||||||
GetMapDisplayName(map_name, displayName, sizeof(displayName));
|
menu.AddItem(map_name, map_name);
|
||||||
menu.AddItem(map_name, displayName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return map_count;
|
return map_count;
|
||||||
|
@ -59,12 +59,18 @@ void KillAllBeacons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformBeacon(int target)
|
void PerformBeacon(int client, int target)
|
||||||
{
|
{
|
||||||
if (g_BeaconSerial[target] == 0)
|
if (g_BeaconSerial[target] == 0)
|
||||||
|
{
|
||||||
CreateBeacon(target);
|
CreateBeacon(target);
|
||||||
|
LogAction(client, target, "\"%L\" set a beacon on \"%L\"", client, target);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
KillBeacon(target);
|
KillBeacon(target);
|
||||||
|
LogAction(client, target, "\"%L\" removed a beacon on \"%L\"", client, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Timer_Beacon(Handle timer, any value)
|
public Action Timer_Beacon(Handle timer, any value)
|
||||||
@ -181,9 +187,8 @@ public int MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int para
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformBeacon(target);
|
PerformBeacon(param1, target);
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Toggled beacon on target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Toggled beacon on target", "_s", name);
|
||||||
LogAction(param1, target, "\"%L\" toggled beacon on \"%L\"", param1, target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-draw the menu if they're still valid */
|
/* Re-draw the menu if they're still valid */
|
||||||
@ -225,18 +230,16 @@ public Action Command_Beacon(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
PerformBeacon(target_list[i]);
|
PerformBeacon(client, target_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" toggled beacon on \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" toggled beacon on \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
int g_BlindTarget[MAXPLAYERS+1];
|
int g_BlindTarget[MAXPLAYERS+1];
|
||||||
|
|
||||||
void PerformBlind(int target, int amount)
|
void PerformBlind(int client, int target, int amount)
|
||||||
{
|
{
|
||||||
int targets[2];
|
int targets[2];
|
||||||
targets[0] = target;
|
targets[0] = target;
|
||||||
@ -75,6 +75,8 @@ void PerformBlind(int target, int amount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EndMessage();
|
EndMessage();
|
||||||
|
|
||||||
|
LogAction(client, target, "\"%L\" set blind on \"%L\" (amount \"%d\")", client, target, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdminMenu_Blind(TopMenu topmenu,
|
public void AdminMenu_Blind(TopMenu topmenu,
|
||||||
@ -209,8 +211,7 @@ public int MenuHandler_Amount(Menu menu, MenuAction action, int param1, int para
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformBlind(target, amount);
|
PerformBlind(param1, target, amount);
|
||||||
LogAction(param1, target, "\"%L\" set blind on \"%L\", amount %d.", param1, target, amount);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Set blind on target", "_s", name, amount);
|
ShowActivity2(param1, "[SM] ", "%t", "Set blind on target", "_s", name, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,18 +276,16 @@ public Action Command_Blind(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
PerformBlind(target_list[i], amount);
|
PerformBlind(client, target_list[i], amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Set blind on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Set blind on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" set blind on \"%s\", amount %d.", client, target_name, amount);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Set blind on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Set blind on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" set blind on \"%L\", amount %d.", client, target_list[0], amount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -106,7 +106,7 @@ void KillAllDrugs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformDrug(int target, int toggle)
|
void PerformDrug(int client, int target, int toggle)
|
||||||
{
|
{
|
||||||
switch (toggle)
|
switch (toggle)
|
||||||
{
|
{
|
||||||
@ -115,10 +115,12 @@ void PerformDrug(int target, int toggle)
|
|||||||
if (g_DrugTimers[target] == null)
|
if (g_DrugTimers[target] == null)
|
||||||
{
|
{
|
||||||
CreateDrug(target);
|
CreateDrug(target);
|
||||||
|
LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KillDrug(target);
|
KillDrug(target);
|
||||||
|
LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +129,7 @@ void PerformDrug(int target, int toggle)
|
|||||||
if (g_DrugTimers[target] == null)
|
if (g_DrugTimers[target] == null)
|
||||||
{
|
{
|
||||||
CreateDrug(target);
|
CreateDrug(target);
|
||||||
|
LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +138,7 @@ void PerformDrug(int target, int toggle)
|
|||||||
if (g_DrugTimers[target] != null)
|
if (g_DrugTimers[target] != null)
|
||||||
{
|
{
|
||||||
KillDrug(target);
|
KillDrug(target);
|
||||||
|
LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,8 +268,7 @@ public int MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformDrug(target, 2);
|
PerformDrug(param1, target, 2);
|
||||||
LogAction(param1, target, "\"%L\" toggled drugs on \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Toggled drug on target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Toggled drug on target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,18 +326,16 @@ public Action Command_Drug(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
PerformDrug(target_list[i], toggle);
|
PerformDrug(client, target_list[i], toggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" toggled drugs on \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" toggled drugs on \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -64,16 +64,24 @@ void KillAllFireBombs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerformBurn(int client, int target, float seconds)
|
||||||
|
{
|
||||||
|
IgniteEntity(target, seconds);
|
||||||
|
LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
|
||||||
|
}
|
||||||
|
|
||||||
void PerformFireBomb(int client, int target)
|
void PerformFireBomb(int client, int target)
|
||||||
{
|
{
|
||||||
if (g_FireBombSerial[client] == 0)
|
if (g_FireBombSerial[client] == 0)
|
||||||
{
|
{
|
||||||
CreateFireBomb(target);
|
CreateFireBomb(target);
|
||||||
|
LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KillFireBomb(target);
|
KillFireBomb(target);
|
||||||
SetEntityRenderColor(client, 255, 255, 255, 255);
|
SetEntityRenderColor(client, 255, 255, 255, 255);
|
||||||
|
LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,8 +306,7 @@ public int MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2
|
|||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
IgniteEntity(target, 20.0);
|
PerformBurn(param1, target, 20.0);
|
||||||
LogAction(param1, target, "\"%L\" ignited \"%L\" (seconds \"20\")", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +353,6 @@ public int MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int pa
|
|||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformFireBomb(param1, target);
|
PerformFireBomb(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" toggled FireBomb on \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Toggled FireBomb on target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Toggled FireBomb on target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,18 +408,16 @@ public Action Command_Burn(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
IgniteEntity(target_list[i], seconds);
|
PerformBurn(client, target_list[i], seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
|
||||||
LogAction(client, -1, "\"%L\" ignited \"%s\" (seconds \"%f\")", client, target_name, seconds);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target_list[0], seconds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -456,12 +460,10 @@ public Action Command_FireBomb(int client, int args)
|
|||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" toggled FireBomb on \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" toggled FireBomb on \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,12 @@
|
|||||||
|
|
||||||
int g_GravityTarget[MAXPLAYERS+1];
|
int g_GravityTarget[MAXPLAYERS+1];
|
||||||
|
|
||||||
|
void PerformGravity(int client, int target, float amount)
|
||||||
|
{
|
||||||
|
SetEntityGravity(target, amount);
|
||||||
|
LogAction(client, target, "\"%L\" set gravity on \"%L\" (amount \"%f\")", client, target, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public void AdminMenu_Gravity(TopMenu topmenu,
|
public void AdminMenu_Gravity(TopMenu topmenu,
|
||||||
TopMenuAction action,
|
TopMenuAction action,
|
||||||
TopMenuObject object_id,
|
TopMenuObject object_id,
|
||||||
@ -163,8 +169,7 @@ public int MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, i
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
SetEntityGravity(target, amount);
|
PerformGravity(param1, target, amount);
|
||||||
LogAction(param1, target, "\"%L\" set gravity on \"%L\" to %f.", param1, target, amount);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Set gravity on target", "_s", name, amount);
|
ShowActivity2(param1, "[SM] ", "%t", "Set gravity on target", "_s", name, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,18 +229,16 @@ public Action Command_Gravity(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
SetEntityGravity(target_list[i], amount);
|
PerformGravity(client, target_list[i], amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" set gravity on \"%s\" to %f.", client, target_name, amount);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" set gravity on \"%L\" to %f.", client, target_list[0], amount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -125,12 +125,24 @@ void KillAllFreezes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformFreezeBomb(int target)
|
void PerformFreeze(int client, int target, int time)
|
||||||
|
{
|
||||||
|
FreezeClient(target, time);
|
||||||
|
LogAction(client, target, "\"%L\" froze \"%L\"", client, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformFreezeBomb(int client, int target)
|
||||||
{
|
{
|
||||||
if (g_FreezeBombSerial[target] != 0)
|
if (g_FreezeBombSerial[target] != 0)
|
||||||
|
{
|
||||||
KillFreezeBomb(target);
|
KillFreezeBomb(target);
|
||||||
|
LogAction(client, target, "\"%L\" removed a FreezeBomb on \"%L\"", client, target);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
CreateFreezeBomb(target);
|
CreateFreezeBomb(target);
|
||||||
|
LogAction(client, target, "\"%L\" set a FreezeBomb on \"%L\"", client, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Timer_Freeze(Handle timer, any value)
|
public Action Timer_Freeze(Handle timer, any value)
|
||||||
@ -409,8 +421,7 @@ public int MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int para
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
FreezeClient(target, g_Cvar_FreezeDuration.IntValue);
|
PerformFreeze(param1, target, g_Cvar_FreezeDuration.IntValue);
|
||||||
LogAction(param1, target, "\"%L\" froze \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Froze target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Froze target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,8 +467,7 @@ public int MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformFreezeBomb(target);
|
PerformFreezeBomb(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" toggled FreezeBomb on \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,18 +523,16 @@ public Action Command_Freeze(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
FreezeClient(target_list[i], seconds);
|
PerformFreeze(client, target_list[i], seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Froze target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Froze target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" froze \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Froze target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Froze target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" froze \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -561,18 +569,16 @@ public Action Command_FreezeBomb(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
PerformFreezeBomb(target_list[i]);
|
PerformFreezeBomb(client, target_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" toggled FreezeBomb on \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" toggled FreezeBomb on \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PerformNoClip(int target)
|
void PerformNoClip(int client, int target)
|
||||||
{
|
{
|
||||||
MoveType movetype = GetEntityMoveType(target);
|
MoveType movetype = GetEntityMoveType(target);
|
||||||
|
|
||||||
@ -43,6 +43,8 @@ void PerformNoClip(int target)
|
|||||||
{
|
{
|
||||||
SetEntityMoveType(target, MOVETYPE_WALK);
|
SetEntityMoveType(target, MOVETYPE_WALK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdminMenu_NoClip(TopMenu topmenu,
|
public void AdminMenu_NoClip(TopMenu topmenu,
|
||||||
@ -110,8 +112,7 @@ public int MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int para
|
|||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformNoClip(target);
|
PerformNoClip(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" toggled noclip on \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Toggled noclip on target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Toggled noclip on target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,18 +155,16 @@ public Action Command_NoClip(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
PerformNoClip(target_list[i]);
|
PerformNoClip(client, target_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" toggled noclip on \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" toggled noclip on \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -68,11 +68,13 @@ void PerformTimeBomb(int client, int target)
|
|||||||
if (g_TimeBombSerial[target] == 0)
|
if (g_TimeBombSerial[target] == 0)
|
||||||
{
|
{
|
||||||
CreateTimeBomb(target);
|
CreateTimeBomb(target);
|
||||||
|
LogAction(client, target, "\"%L\" set a TimeBomb on \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KillTimeBomb(target);
|
KillTimeBomb(target);
|
||||||
SetEntityRenderColor(client, 255, 255, 255, 255);
|
SetEntityRenderColor(client, 255, 255, 255, 255);
|
||||||
|
LogAction(client, target, "\"%L\" removed a TimeBomb on \"%L\"", client, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +279,6 @@ public int MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int pa
|
|||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
|
|
||||||
PerformTimeBomb(param1, target);
|
PerformTimeBomb(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" toggled TimeBomb on \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,12 +327,10 @@ public Action Command_TimeBomb(int client, int args)
|
|||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" toggled TimeBomb on \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" toggled TimeBomb on \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
#if defined _DynamicTargeting_Included
|
|
||||||
#endinput
|
|
||||||
#endif
|
|
||||||
#define _DynamicTargeting_Included
|
|
||||||
|
|
||||||
native int AmbiguousMenu(int client, char[] sCommand, char[] sArgString, char[] sPattern, int FilterFlags);
|
|
||||||
|
|
||||||
public SharedPlugin __pl_DynamicTargeting =
|
|
||||||
{
|
|
||||||
name = "DynamicTargeting",
|
|
||||||
file = "DynamicTargeting.smx",
|
|
||||||
#if defined REQUIRE_PLUGIN
|
|
||||||
required = 1,
|
|
||||||
#else
|
|
||||||
required = 0,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#if !defined REQUIRE_PLUGIN
|
|
||||||
public __pl_DynamicTargeting_SetNTVOptional()
|
|
||||||
{
|
|
||||||
MarkNativeAsOptional("AmbiguousMenu");
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -741,15 +741,6 @@ native float GetClientAvgData(int client, NetFlow flow);
|
|||||||
*/
|
*/
|
||||||
native float GetClientAvgPackets(int client, NetFlow flow);
|
native float GetClientAvgPackets(int client, NetFlow flow);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the client's baseserver IClient pointer.
|
|
||||||
*
|
|
||||||
* @param client Player's index.
|
|
||||||
* @return IClient address.
|
|
||||||
* @error Invalid client index, client not connected, or fake client.
|
|
||||||
*/
|
|
||||||
native Address GetClientIClient(int client);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates an userid index to the real player index.
|
* Translates an userid index to the real player index.
|
||||||
*
|
*
|
||||||
|
@ -84,25 +84,6 @@ native int ProcessTargetString(const char[] pattern,
|
|||||||
int tn_maxlength,
|
int tn_maxlength,
|
||||||
bool &tn_is_ml);
|
bool &tn_is_ml);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves arguments that were passed to the last ProcessTargetString call.
|
|
||||||
*
|
|
||||||
* @param pattern Buffer to store the pattern.
|
|
||||||
* @param p_maxlen Maximum length of the pattern buffer.
|
|
||||||
* @param admin OUTPUT: Admin performing the action, or 0 if the server.
|
|
||||||
* @param filter_flags OUTPUT: Filter flags.
|
|
||||||
* @noreturn
|
|
||||||
*/
|
|
||||||
native void GetLastProcessTargetString(char[] pattern,
|
|
||||||
int p_maxlen,
|
|
||||||
int &admin,
|
|
||||||
int &filter_flags);
|
|
||||||
|
|
||||||
#undef REQUIRE_PLUGIN
|
|
||||||
#include <DynamicTargeting>
|
|
||||||
#define REQUIRE_PLUGIN
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replies to a client with a given message describing a targetting
|
* Replies to a client with a given message describing a targetting
|
||||||
* failure reason.
|
* failure reason.
|
||||||
@ -112,7 +93,7 @@ native void GetLastProcessTargetString(char[] pattern,
|
|||||||
* @param client Client index, or 0 for server.
|
* @param client Client index, or 0 for server.
|
||||||
* @param reason COMMAND_TARGET reason.
|
* @param reason COMMAND_TARGET reason.
|
||||||
*/
|
*/
|
||||||
stock void ReplyToTargetError(int client, int reason, bool dynamic=true)
|
stock void ReplyToTargetError(int client, int reason)
|
||||||
{
|
{
|
||||||
switch (reason)
|
switch (reason)
|
||||||
{
|
{
|
||||||
@ -147,55 +128,20 @@ stock void ReplyToTargetError(int client, int reason, bool dynamic=true)
|
|||||||
case COMMAND_TARGET_AMBIGUOUS:
|
case COMMAND_TARGET_AMBIGUOUS:
|
||||||
{
|
{
|
||||||
ReplyToCommand(client, "[SM] %t", "More than one client matched");
|
ReplyToCommand(client, "[SM] %t", "More than one client matched");
|
||||||
|
|
||||||
if(dynamic &&
|
|
||||||
GetFeatureStatus(FeatureType_Native, "GetLastProcessTargetString") == FeatureStatus_Available &&
|
|
||||||
LibraryExists("DynamicTargeting"))
|
|
||||||
{
|
|
||||||
if(GetFeatureStatus(FeatureType_Native, "IsCommandCallback") == FeatureStatus_Available &&
|
|
||||||
!IsCommandCallback())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char sCommand[128];
|
|
||||||
GetCmdArg(0, sCommand, sizeof(sCommand));
|
|
||||||
|
|
||||||
char sArgString[256];
|
|
||||||
GetCmdArgString(sArgString, sizeof(sArgString));
|
|
||||||
|
|
||||||
char pattern[MAX_TARGET_LENGTH];
|
|
||||||
int admin;
|
|
||||||
int filter_flags;
|
|
||||||
|
|
||||||
GetLastProcessTargetString(pattern, sizeof(pattern), admin, filter_flags);
|
|
||||||
|
|
||||||
if(!admin || !IsClientInGame(admin) || IsFakeClient(admin))
|
|
||||||
return;
|
|
||||||
|
|
||||||
AmbiguousMenu(admin, sCommand, sArgString, pattern, filter_flags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#define FEATURECAP_MULTITARGETFILTER_CLIENTPARAM "SourceMod MultiTargetFilter ClientParam"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds clients to a multi-target filter.
|
* Adds clients to a multi-target filter.
|
||||||
*
|
*
|
||||||
* @param pattern Pattern name.
|
* @param pattern Pattern name.
|
||||||
* @param clients Array to fill with unique, valid client indexes.
|
* @param clients Array to fill with unique, valid client indexes.
|
||||||
* @param client Client that triggered this filter.
|
|
||||||
* @return True if pattern was recognized, false otherwise.
|
* @return True if pattern was recognized, false otherwise.
|
||||||
*
|
|
||||||
* @note To see if the client param is available, use FeatureType_Capability and FEATURECAP_MULTITARGETFILTER_CLIENTPARAM.
|
|
||||||
*/
|
*/
|
||||||
typeset MultiTargetFilter {
|
typeset MultiTargetFilter {
|
||||||
function bool (const char[] pattern, Handle clients);
|
function bool (const char[] pattern, Handle clients);
|
||||||
function bool (const char[] pattern, ArrayList clients);
|
function bool (const char[] pattern, ArrayList clients);
|
||||||
function bool (const char[] pattern, Handle clients, int client);
|
|
||||||
function bool (const char[] pattern, ArrayList clients, int client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -403,13 +403,6 @@ native void RegAdminCmd(const char[] cmd,
|
|||||||
const char[] group="",
|
const char[] group="",
|
||||||
int flags=0);
|
int flags=0);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether there is a command callback available.
|
|
||||||
*
|
|
||||||
* @return True if called from inside a command callback.
|
|
||||||
*/
|
|
||||||
native bool IsCommandCallback();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of arguments from the current console or server command.
|
* Returns the number of arguments from the current console or server command.
|
||||||
* @note Unlike the HL2 engine call, this does not include the command itself.
|
* @note Unlike the HL2 engine call, this does not include the command itself.
|
||||||
|
@ -311,9 +311,6 @@ public void __ext_core_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("Protobuf.ReadRepeatedMessage");
|
MarkNativeAsOptional("Protobuf.ReadRepeatedMessage");
|
||||||
MarkNativeAsOptional("Protobuf.AddMessage");
|
MarkNativeAsOptional("Protobuf.AddMessage");
|
||||||
|
|
||||||
MarkNativeAsOptional("IsCommandCallback");
|
|
||||||
MarkNativeAsOptional("GetLastProcessTargetString");
|
|
||||||
|
|
||||||
VerifyCoreVersion();
|
VerifyCoreVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,17 +293,6 @@ native void Call_StartForward(Handle fwd);
|
|||||||
*/
|
*/
|
||||||
native void Call_StartFunction(Handle plugin, Function func);
|
native void Call_StartFunction(Handle plugin, Function func);
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts a call to a native.
|
|
||||||
*
|
|
||||||
* @note Cannot be used during an incomplete call.
|
|
||||||
*
|
|
||||||
* @param name Name of the native.
|
|
||||||
* @return True on success, false otherwise.
|
|
||||||
* @error Invalid function, or called before another call has completed.
|
|
||||||
*/
|
|
||||||
native bool Call_StartNative(const char[] name);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes a cell onto the current call.
|
* Pushes a cell onto the current call.
|
||||||
*
|
*
|
||||||
@ -427,20 +416,6 @@ native void Call_PushNullString();
|
|||||||
*/
|
*/
|
||||||
native int Call_Finish(any &result=0);
|
native int Call_Finish(any &result=0);
|
||||||
|
|
||||||
/**
|
|
||||||
* Completes a call to a function or forward's call list.
|
|
||||||
* Catches exceptions thrown by the native.
|
|
||||||
*
|
|
||||||
* @note Cannot be used before a call has been started.
|
|
||||||
*
|
|
||||||
* @param result Return value of function or forward's call list.
|
|
||||||
* @param exception Buffer to store the exception in.
|
|
||||||
* @param maxlength Maximum length of the buffer.
|
|
||||||
* @return SP_ERROR_NONE on success, any other integer on failure.
|
|
||||||
* @error Called before a call has been started.
|
|
||||||
*/
|
|
||||||
native int Call_FinishEx(any &result=0, char[] exception, int maxlength);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels a call to a function or forward's call list.
|
* Cancels a call to a function or forward's call list.
|
||||||
*
|
*
|
||||||
|
@ -333,14 +333,6 @@ typeset SDKHookCB
|
|||||||
*/
|
*/
|
||||||
forward void OnEntityCreated(int entity, const char[] classname);
|
forward void OnEntityCreated(int entity, const char[] classname);
|
||||||
|
|
||||||
/**
|
|
||||||
* When an entity is spawned
|
|
||||||
*
|
|
||||||
* @param entity Entity index
|
|
||||||
* @param classname Class name
|
|
||||||
*/
|
|
||||||
forward void OnEntitySpawned(int entity, const char[] classname);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When an entity is destroyed
|
* When an entity is destroyed
|
||||||
*
|
*
|
||||||
@ -408,11 +400,10 @@ native void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback);
|
|||||||
* @param weapon Weapon index (orangebox and later) or -1 for unspecified
|
* @param weapon Weapon index (orangebox and later) or -1 for unspecified
|
||||||
* @param damageForce Velocity of damage force
|
* @param damageForce Velocity of damage force
|
||||||
* @param damagePosition Origin of damage
|
* @param damagePosition Origin of damage
|
||||||
* @param damageCustom User custom
|
|
||||||
*/
|
*/
|
||||||
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
|
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
|
||||||
float damage, int damageType=DMG_GENERIC, int weapon=-1,
|
float damage, int damageType=DMG_GENERIC, int weapon=-1,
|
||||||
const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR, int damageCustom=0);
|
const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces a client to drop the specified weapon
|
* Forces a client to drop the specified weapon
|
||||||
|
@ -633,18 +633,6 @@ native bool TR_DidHit(Handle hndl=INVALID_HANDLE);
|
|||||||
*/
|
*/
|
||||||
native int TR_GetHitGroup(Handle hndl=INVALID_HANDLE);
|
native int TR_GetHitGroup(Handle hndl=INVALID_HANDLE);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns in which hitbox the trace collided if any.
|
|
||||||
*
|
|
||||||
* Note: if the entity that collided with the trace is the world entity,
|
|
||||||
* then this function doesn't return an hitbox index but a static prop index.
|
|
||||||
*
|
|
||||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
|
||||||
* @return Hitbox index (Or static prop index).
|
|
||||||
* @error Invalid Handle.
|
|
||||||
*/
|
|
||||||
native int TR_GetHitBoxIndex(Handle hndl=INVALID_HANDLE);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the normal vector to the collision plane of a trace.
|
* Find the normal vector to the collision plane of a trace.
|
||||||
*
|
*
|
||||||
|
@ -47,92 +47,6 @@ struct Plugin
|
|||||||
public const char[] url; /**< Plugin URL */
|
public const char[] url; /**< Plugin URL */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether a library exists. This function should be considered
|
|
||||||
* expensive; it should only be called on plugin to determine availability
|
|
||||||
* of resources. Use OnLibraryAdded()/OnLibraryRemoved() to detect changes
|
|
||||||
* in optional resources.
|
|
||||||
*
|
|
||||||
* @param name Library name of a plugin or extension.
|
|
||||||
* @return True if exists, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool LibraryExists(const char[] name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Feature types.
|
|
||||||
*/
|
|
||||||
enum FeatureType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A native function call.
|
|
||||||
*/
|
|
||||||
FeatureType_Native,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A named capability. This is distinctly different from checking for a
|
|
||||||
* native, because the underlying functionality could be enabled on-demand
|
|
||||||
* to improve loading time. Thus a native may appear to exist, but it might
|
|
||||||
* be part of a set of features that are not compatible with the current game
|
|
||||||
* or version of SourceMod.
|
|
||||||
*/
|
|
||||||
FeatureType_Capability
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Feature statuses.
|
|
||||||
*/
|
|
||||||
enum FeatureStatus
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Feature is available for use.
|
|
||||||
*/
|
|
||||||
FeatureStatus_Available,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Feature is not available.
|
|
||||||
*/
|
|
||||||
FeatureStatus_Unavailable,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Feature is not known at all.
|
|
||||||
*/
|
|
||||||
FeatureStatus_Unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether "GetFeatureStatus" will work. Using this native
|
|
||||||
* or this function will not cause SourceMod to fail loading on older versions,
|
|
||||||
* however, GetFeatureStatus will only work if this function returns true.
|
|
||||||
*
|
|
||||||
* @return True if GetFeatureStatus will work, false otherwise.
|
|
||||||
*/
|
|
||||||
stock bool CanTestFeatures()
|
|
||||||
{
|
|
||||||
return LibraryExists("__CanTestFeatures__");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether a feature exists, and if so, whether it is usable.
|
|
||||||
*
|
|
||||||
* @param type Feature type.
|
|
||||||
* @param name Feature name.
|
|
||||||
* @return Feature status.
|
|
||||||
*/
|
|
||||||
native FeatureStatus GetFeatureStatus(FeatureType type, const char[] name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Requires that a given feature is available. If it is not, SetFailState()
|
|
||||||
* is called with the given message.
|
|
||||||
*
|
|
||||||
* @param type Feature type.
|
|
||||||
* @param name Feature name.
|
|
||||||
* @param fmt Message format string, or empty to use default.
|
|
||||||
* @param ... Message format parameters, if any.
|
|
||||||
*/
|
|
||||||
native void RequireFeature(FeatureType type, const char[] name,
|
|
||||||
const char[] fmt="", any ...);
|
|
||||||
|
|
||||||
|
|
||||||
#include <core>
|
#include <core>
|
||||||
#include <float>
|
#include <float>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -534,6 +448,17 @@ native void AutoExecConfig(bool autoCreate=true, const char[] name="", const cha
|
|||||||
*/
|
*/
|
||||||
native void RegPluginLibrary(const char[] name);
|
native void RegPluginLibrary(const char[] name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a library exists. This function should be considered
|
||||||
|
* expensive; it should only be called on plugin to determine availability
|
||||||
|
* of resources. Use OnLibraryAdded()/OnLibraryRemoved() to detect changes
|
||||||
|
* in optional resources.
|
||||||
|
*
|
||||||
|
* @param name Library name of a plugin or extension.
|
||||||
|
* @return True if exists, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool LibraryExists(const char[] name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the status of an extension, by filename.
|
* Returns the status of an extension, by filename.
|
||||||
*
|
*
|
||||||
@ -657,6 +582,80 @@ forward bool OnClientFloodCheck(int client);
|
|||||||
*/
|
*/
|
||||||
forward void OnClientFloodResult(int client, bool blocked);
|
forward void OnClientFloodResult(int client, bool blocked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Feature types.
|
||||||
|
*/
|
||||||
|
enum FeatureType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A native function call.
|
||||||
|
*/
|
||||||
|
FeatureType_Native,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A named capability. This is distinctly different from checking for a
|
||||||
|
* native, because the underlying functionality could be enabled on-demand
|
||||||
|
* to improve loading time. Thus a native may appear to exist, but it might
|
||||||
|
* be part of a set of features that are not compatible with the current game
|
||||||
|
* or version of SourceMod.
|
||||||
|
*/
|
||||||
|
FeatureType_Capability
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Feature statuses.
|
||||||
|
*/
|
||||||
|
enum FeatureStatus
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Feature is available for use.
|
||||||
|
*/
|
||||||
|
FeatureStatus_Available,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Feature is not available.
|
||||||
|
*/
|
||||||
|
FeatureStatus_Unavailable,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Feature is not known at all.
|
||||||
|
*/
|
||||||
|
FeatureStatus_Unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether "GetFeatureStatus" will work. Using this native
|
||||||
|
* or this function will not cause SourceMod to fail loading on older versions,
|
||||||
|
* however, GetFeatureStatus will only work if this function returns true.
|
||||||
|
*
|
||||||
|
* @return True if GetFeatureStatus will work, false otherwise.
|
||||||
|
*/
|
||||||
|
stock bool CanTestFeatures()
|
||||||
|
{
|
||||||
|
return LibraryExists("__CanTestFeatures__");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a feature exists, and if so, whether it is usable.
|
||||||
|
*
|
||||||
|
* @param type Feature type.
|
||||||
|
* @param name Feature name.
|
||||||
|
* @return Feature status.
|
||||||
|
*/
|
||||||
|
native FeatureStatus GetFeatureStatus(FeatureType type, const char[] name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires that a given feature is available. If it is not, SetFailState()
|
||||||
|
* is called with the given message.
|
||||||
|
*
|
||||||
|
* @param type Feature type.
|
||||||
|
* @param name Feature name.
|
||||||
|
* @param fmt Message format string, or empty to use default.
|
||||||
|
* @param ... Message format parameters, if any.
|
||||||
|
*/
|
||||||
|
native void RequireFeature(FeatureType type, const char[] name,
|
||||||
|
const char[] fmt="", any ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents how many bytes we can read from an address with one load
|
* Represents how many bytes we can read from an address with one load
|
||||||
*/
|
*/
|
||||||
|
@ -33,8 +33,10 @@
|
|||||||
|
|
||||||
char g_NewName[MAXPLAYERS+1][MAX_NAME_LENGTH];
|
char g_NewName[MAXPLAYERS+1][MAX_NAME_LENGTH];
|
||||||
|
|
||||||
void PerformRename(int target)
|
void PerformRename(int client, int target)
|
||||||
{
|
{
|
||||||
|
LogAction(client, target, "\"%L\" renamed \"%L\" (to \"%s\")", client, target, g_NewName[target]);
|
||||||
|
|
||||||
SetClientName(target, g_NewName[target]);
|
SetClientName(target, g_NewName[target]);
|
||||||
|
|
||||||
g_NewName[target][0] = '\0';
|
g_NewName[target][0] = '\0';
|
||||||
@ -107,8 +109,7 @@ public int MenuHandler_Rename(Menu menu, MenuAction action, int param1, int para
|
|||||||
|
|
||||||
RandomizeName(target);
|
RandomizeName(target);
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Renamed target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Renamed target", "_s", name);
|
||||||
LogAction(param1, target, "\"%L\" renamed \"%L\" to \"%s\")", param1, target, g_NewName[target]);
|
PerformRename(param1, target);
|
||||||
PerformRename(target);
|
|
||||||
}
|
}
|
||||||
DisplayRenameTargetMenu(param1);
|
DisplayRenameTargetMenu(param1);
|
||||||
}
|
}
|
||||||
@ -167,12 +168,10 @@ public Action Command_Rename(int client, int args)
|
|||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Renamed target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Renamed target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" renamed \"%s\" to \"%s\")", client, target_name, arg2);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Renamed target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Renamed target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" renamed \"%L\" to \"%s\")", client, target_list[0], arg2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
@ -192,7 +191,7 @@ public Action Command_Rename(int client, int args)
|
|||||||
Format(g_NewName[target_list[i]], MAX_NAME_LENGTH, "%s", arg2);
|
Format(g_NewName[target_list[i]], MAX_NAME_LENGTH, "%s", arg2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PerformRename(target_list[i]);
|
PerformRename(client, target_list[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -33,6 +33,12 @@
|
|||||||
|
|
||||||
int g_SlapDamage[MAXPLAYERS+1];
|
int g_SlapDamage[MAXPLAYERS+1];
|
||||||
|
|
||||||
|
void PerformSlap(int client, int target, int damage)
|
||||||
|
{
|
||||||
|
LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
|
||||||
|
SlapPlayer(target, damage, true);
|
||||||
|
}
|
||||||
|
|
||||||
void DisplaySlapDamageMenu(int client)
|
void DisplaySlapDamageMenu(int client)
|
||||||
{
|
{
|
||||||
Menu menu = new Menu(MenuHandler_SlapDamage);
|
Menu menu = new Menu(MenuHandler_SlapDamage);
|
||||||
@ -145,8 +151,7 @@ public int MenuHandler_Slap(Menu menu, MenuAction action, int param1, int param2
|
|||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
SlapPlayer(target, g_SlapDamage[param1]);
|
PerformSlap(param1, target, g_SlapDamage[param1]);
|
||||||
LogAction(param1, target, "\"%L\" slapped \"%L\" (damage \"%d\")", param1, target, g_SlapDamage[param1]);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Slapped target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Slapped target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,18 +202,16 @@ public Action Command_Slap(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
SlapPlayer(target_list[i], damage);
|
PerformSlap(client, target_list[i], damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Slapped target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Slapped target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" slapped \"%s\" (damage \"%d\")", client, target_name, damage);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Slapped target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Slapped target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" slapped \"%L\" (damage \"%d\")", client, target_list[0], damage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -31,6 +31,12 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void PerformSlay(int client, int target)
|
||||||
|
{
|
||||||
|
LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
|
||||||
|
ForcePlayerSuicide(target);
|
||||||
|
}
|
||||||
|
|
||||||
void DisplaySlayMenu(int client)
|
void DisplaySlayMenu(int client)
|
||||||
{
|
{
|
||||||
Menu menu = new Menu(MenuHandler_Slay);
|
Menu menu = new Menu(MenuHandler_Slay);
|
||||||
@ -99,8 +105,7 @@ public int MenuHandler_Slay(Menu menu, MenuAction action, int param1, int param2
|
|||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
ForcePlayerSuicide(target);
|
PerformSlay(param1, target);
|
||||||
LogAction(param1, target, "\"%L\" slayed \"%L\"", param1, target);
|
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,18 +144,16 @@ public Action Command_Slay(int client, int args)
|
|||||||
|
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
ForcePlayerSuicide(target_list[i]);
|
PerformSlay(client, target_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" slayed \"%s\"", client, target_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" slayed \"%L\"", client, target_list[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -107,17 +107,16 @@ public Action Command_Play(int client, int args)
|
|||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
|
ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
|
||||||
|
LogAction(client, target_list[i], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[i], Arguments[len]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tn_is_ml)
|
if (tn_is_ml)
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
|
||||||
LogAction(client, -1, "\"%L\" played sound on \"%s\" (file \"%s\")", client, target_name, Arguments[len]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
|
||||||
LogAction(client, target_list[0], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[0], Arguments[len]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -1 +1 @@
|
|||||||
1.11.0
|
1.10.0
|
||||||
|
@ -48,11 +48,6 @@
|
|||||||
#define DETOUR_MEMBER_CALL(name) (this->*name##_Actual)
|
#define DETOUR_MEMBER_CALL(name) (this->*name##_Actual)
|
||||||
#define DETOUR_STATIC_CALL(name) (name##_Actual)
|
#define DETOUR_STATIC_CALL(name) (name##_Actual)
|
||||||
|
|
||||||
#define DETOUR_MEMBER_MCALL_CALLBACK(name, classptr) \
|
|
||||||
((name##Class *)classptr->*(&name##Class::name))
|
|
||||||
#define DETOUR_MEMBER_MCALL_ORIGINAL(name, classptr) \
|
|
||||||
((name##Class *)classptr->*(name##Class::name##_Actual))
|
|
||||||
|
|
||||||
#define DETOUR_DECL_STATIC0(name, ret) \
|
#define DETOUR_DECL_STATIC0(name, ret) \
|
||||||
ret (*name##_Actual)(void) = NULL; \
|
ret (*name##_Actual)(void) = NULL; \
|
||||||
ret name(void)
|
ret name(void)
|
||||||
@ -89,14 +84,6 @@ ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5na
|
|||||||
ret (*name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type) = NULL; \
|
ret (*name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type) = NULL; \
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name)
|
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name)
|
||||||
|
|
||||||
#define DETOUR_DECL_STATIC9(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name) \
|
|
||||||
ret (*name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type) = NULL; \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_STATIC10(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name, p10type, p10name) \
|
|
||||||
ret (*name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type) = NULL; \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER0(name, ret) \
|
#define DETOUR_DECL_MEMBER0(name, ret) \
|
||||||
class name##Class \
|
class name##Class \
|
||||||
{ \
|
{ \
|
||||||
@ -187,65 +174,6 @@ public: \
|
|||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type) = NULL; \
|
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type) = NULL; \
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name)
|
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name)
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER9(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name) \
|
|
||||||
class name##Class \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name); \
|
|
||||||
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type); \
|
|
||||||
}; \
|
|
||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type) = NULL; \
|
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER10(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name, p10type, p10name) \
|
|
||||||
class name##Class \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name); \
|
|
||||||
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type); \
|
|
||||||
}; \
|
|
||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type) = NULL; \
|
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER11(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name, p10type, p10name, p11type, p11name) \
|
|
||||||
class name##Class \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name); \
|
|
||||||
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type); \
|
|
||||||
}; \
|
|
||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type) = NULL; \
|
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER12(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name, p10type, p10name, p11type, p11name, p12type, p12name) \
|
|
||||||
class name##Class \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name, p12type p12name); \
|
|
||||||
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type, p12type); \
|
|
||||||
}; \
|
|
||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type, p12type) = NULL; \
|
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name, p12type p12name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER13(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name, p10type, p10name, p11type, p11name, p12type, p12name, p13type, p13name) \
|
|
||||||
class name##Class \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name, p12type p12name, p13type p13name); \
|
|
||||||
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type, p12type, p13type); \
|
|
||||||
}; \
|
|
||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type, p12type, p13type) = NULL; \
|
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name, p12type p12name, p13type p13name)
|
|
||||||
|
|
||||||
#define DETOUR_DECL_MEMBER14(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name, p10type, p10name, p11type, p11name, p12type, p12name, p13type, p13name, p14type, p14name) \
|
|
||||||
class name##Class \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name, p12type p12name, p13type p13name, p14type p14name); \
|
|
||||||
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type, p12type, p13type, p14type); \
|
|
||||||
}; \
|
|
||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type, p10type, p11type, p12type, p13type, p14type) = NULL; \
|
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name, p10type p10name, p11type p11name, p12type p12name, p13type p13name, p14type p14name)
|
|
||||||
|
|
||||||
#define GET_MEMBER_CALLBACK(name) (void *)GetCodeAddress(&name##Class::name)
|
#define GET_MEMBER_CALLBACK(name) (void *)GetCodeAddress(&name##Class::name)
|
||||||
#define GET_MEMBER_TRAMPOLINE(name) (void **)(&name##Class::name##_Actual)
|
#define GET_MEMBER_TRAMPOLINE(name) (void **)(&name##Class::name##_Actual)
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include <IAdminSystem.h>
|
#include <IAdminSystem.h>
|
||||||
|
|
||||||
#define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
|
#define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
|
||||||
#define SMINTERFACE_PLAYERMANAGER_VERSION 22
|
#define SMINTERFACE_PLAYERMANAGER_VERSION 21
|
||||||
|
|
||||||
struct edict_t;
|
struct edict_t;
|
||||||
class IPlayerInfo;
|
class IPlayerInfo;
|
||||||
@ -543,16 +543,9 @@ namespace SourceMod
|
|||||||
/**
|
/**
|
||||||
* @brief Returns the number of players currently connected.
|
* @brief Returns the number of players currently connected.
|
||||||
*
|
*
|
||||||
* @return Current number of connected players.
|
|
||||||
*/
|
|
||||||
virtual int GetNumPlayers() =0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the number of clients currently connected.
|
|
||||||
*
|
|
||||||
* @return Current number of connected clients.
|
* @return Current number of connected clients.
|
||||||
*/
|
*/
|
||||||
virtual int GetNumClients() =0;
|
virtual int GetNumPlayers() =0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the client index by its userid.
|
* @brief Returns the client index by its userid.
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e00a845c6bc415995ddc4b7ec538d1704fdd0122
|
Subproject commit 2be66bdbdf965ebf19dacc2e0874f81f22fd6fa8
|
@ -36,7 +36,7 @@
|
|||||||
#include <IShareSys.h>
|
#include <IShareSys.h>
|
||||||
|
|
||||||
#define SMINTERFACE_SDKHOOKS_NAME "ISDKHooks"
|
#define SMINTERFACE_SDKHOOKS_NAME "ISDKHooks"
|
||||||
#define SMINTERFACE_SDKHOOKS_VERSION 2
|
#define SMINTERFACE_SDKHOOKS_VERSION 1
|
||||||
|
|
||||||
class CBaseEntity;
|
class CBaseEntity;
|
||||||
|
|
||||||
@ -71,16 +71,6 @@ namespace SourceMod
|
|||||||
virtual void OnEntityDestroyed(CBaseEntity *pEntity)
|
virtual void OnEntityDestroyed(CBaseEntity *pEntity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief When an entity is spawned
|
|
||||||
*
|
|
||||||
* @param pEntity CBaseEntity entity.
|
|
||||||
* @param classname Entity classname.
|
|
||||||
*/
|
|
||||||
virtual void OnEntitySpawned(CBaseEntity *pEntity, const char *classname)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 04eafd88631e7a3ba1de6bc7228af0e3d5443f0b
|
Subproject commit a98c996b166166350e7f022d2f8db60b1ee2b53e
|
@ -324,7 +324,6 @@ CopyFiles('plugins', 'addons/sourcemod/scripting',
|
|||||||
'rockthevote.sp',
|
'rockthevote.sp',
|
||||||
'sounds.sp',
|
'sounds.sp',
|
||||||
'sql-admin-manager.sp',
|
'sql-admin-manager.sp',
|
||||||
'DynamicTargeting.sp',
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
CopyFiles('plugins/include', 'addons/sourcemod/scripting/include',
|
CopyFiles('plugins/include', 'addons/sourcemod/scripting/include',
|
||||||
@ -395,7 +394,6 @@ CopyFiles('plugins/include', 'addons/sourcemod/scripting/include',
|
|||||||
'usermessages.inc',
|
'usermessages.inc',
|
||||||
'vector.inc',
|
'vector.inc',
|
||||||
'version.inc',
|
'version.inc',
|
||||||
'DynamicTargeting.inc',
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
CopyFiles('translations', 'addons/sourcemod/translations',
|
CopyFiles('translations', 'addons/sourcemod/translations',
|
||||||
|
Loading…
Reference in New Issue
Block a user