mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Add new register_event flags to filter humans and bots (bug 5768, r=me)
Former-commit-id: 15b0fba122
This commit is contained in:
parent
15572e2d61
commit
1026edec6c
@ -46,7 +46,7 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
|
||||
m_FlagDead = true;
|
||||
|
||||
m_FlagWorld = (flags & 1) ? true : false; // flag a
|
||||
m_FlagPlayer = (flags & 2) ? true : false; // flag b
|
||||
m_FlagClient = (flags & 2) ? true : false; // flag b
|
||||
m_FlagOnce = (flags & 4) ? true : false; // flag c
|
||||
|
||||
if (flags & 24)
|
||||
@ -55,6 +55,18 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
|
||||
m_FlagDead = (flags & 8) ? true : false; // flag d
|
||||
}
|
||||
|
||||
if( m_FlagClient )
|
||||
{
|
||||
m_FlagPlayer = true;
|
||||
m_FlagBot = true;
|
||||
|
||||
if( flags & 96 )
|
||||
{
|
||||
m_FlagPlayer = (flags & 32) ? true : false; // flag f
|
||||
m_FlagBot = (flags & 64) ? true : false; // flag g
|
||||
}
|
||||
}
|
||||
|
||||
m_Stamp = 0.0f;
|
||||
m_Done = false;
|
||||
|
||||
@ -237,7 +249,7 @@ void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int in
|
||||
|
||||
if (pPlayer)
|
||||
{
|
||||
if (!(*iter).m_FlagPlayer || (pPlayer->IsAlive() ? !(*iter).m_FlagAlive : !(*iter).m_FlagDead))
|
||||
if (!(*iter).m_FlagClient || (pPlayer->IsBot() ? !(*iter).m_FlagBot : !(*iter).m_FlagPlayer) || (pPlayer->IsAlive() ? !(*iter).m_FlagAlive : !(*iter).m_FlagDead))
|
||||
{
|
||||
(*iter).m_Done = true;
|
||||
continue;
|
||||
|
@ -74,11 +74,13 @@ public:
|
||||
CPluginMngr::CPlugin *m_Plugin; // the plugin this ClEvent class is assigned to
|
||||
|
||||
// flags
|
||||
bool m_FlagPlayer;
|
||||
bool m_FlagClient;
|
||||
bool m_FlagWorld;
|
||||
bool m_FlagOnce;
|
||||
bool m_FlagDead;
|
||||
bool m_FlagAlive;
|
||||
bool m_FlagPlayer;
|
||||
bool m_FlagBot;
|
||||
|
||||
float m_Stamp; // for 'once' flag
|
||||
|
||||
|
@ -114,10 +114,12 @@ native console_cmd(id,const cmd[],any:...);
|
||||
/* Registers event on which a given function will be called
|
||||
* Flags:
|
||||
* "a" - global event.
|
||||
* "b" - specified.
|
||||
* "b" - specified to client (human player and bot).
|
||||
* "c" - send only once when repeated to other players.
|
||||
* "d" - call if is send to dead player.
|
||||
* "e" - to alive.
|
||||
* "f" - to human player only ("b" flag must be set).
|
||||
* "g" - to bot only ("b" flag must be set).
|
||||
* NOTE: Due to a long-standing bug that would break compatibility with old plugins,
|
||||
* the client id should be checked for alive/dead state if you use d or e.
|
||||
* Examples for conditions:
|
||||
|
Loading…
Reference in New Issue
Block a user