Added a way to quiet any sayhook if it wasn't successfully executed, fixed double-ztele'ing. (Note: Linux can't compile the plugin anymore.)

This commit is contained in:
Greyscale
2009-05-06 05:31:48 +02:00
parent cec31406d0
commit a89f98cc38
5 changed files with 35 additions and 8 deletions

View File

@ -78,6 +78,9 @@ public Action:SayHooksCmdSay(client, argc)
return Plugin_Continue;
}
// Define success as true until otherwise changed.
new bool:success = true;
switch(chatflag)
{
// Client triggered ZMenu flag.
@ -89,7 +92,7 @@ public Action:SayHooksCmdSay(client, argc)
// Client triggered ZAdmin flag.
case SAYHOOKS_KEYWORD_FLAG_ZADMIN:
{
ZRAdminMenu(client);
success = ZRAdminMenu(client);
}
// Client triggered ZClass flag.
case SAYHOOKS_KEYWORD_FLAG_ZCLASS:
@ -101,24 +104,24 @@ public Action:SayHooksCmdSay(client, argc)
case SAYHOOKS_KEYWORD_FLAG_ZSPAWN:
{
// Spawns a late-joining client into the game.
ZSpawnClient(client);
success = ZSpawnClient(client);
}
// Client triggered ZTele flag.
case SAYHOOKS_KEYWORD_FLAG_ZTELE:
{
ZTeleClient(client);
success = ZTeleClient(client);
}
// Client triggered ZHP flag.
case SAYHOOKS_KEYWORD_FLAG_ZHP:
{
// Toggle ZHP.
ZHPToggle(client);
success = ZHPToggle(client);
}
// Client triggered ZMarket flag.
case SAYHOOKS_KEYWORD_FLAG_ZMARKET:
{
// Send market menu.
ZMarketMenu(client);
success = ZMarketMenu(client);
}
}
@ -129,6 +132,13 @@ public Action:SayHooksCmdSay(client, argc)
return Plugin_Continue;
}
// If filter is enabled, and the command failed to be executed, then stop.
new bool:filter = GetConVarBool(g_hCvarsList[CVAR_SAYHOOKS_QUIET_FILTER]);
if (filter && !success)
{
return Plugin_Handled;
}
// If word is flagged to be quieted, then stop.
new quietflags = GetConVarInt(g_hCvarsList[CVAR_SAYHOOKS_QUIET_FLAGS]);
if (quietflags & chatflag)