Recoded sayhooks, now uses SM's silent/public chat triggers.

Began making set functions for the commands that will use them later.
Removed all sayhook cvars.
This commit is contained in:
Greyscale 2009-06-17 14:32:46 -07:00
parent 95c217aad6
commit 681ad45365
18 changed files with 376 additions and 231 deletions

View File

@ -7,13 +7,12 @@
"General round objective" "General round objective"
{ {
"en" "The game is @greenHumans vs. Zombies@default, the goal for zombies is to infect all humans by knifing them." "en" "The game is @greenHumans vs. Zombies@default, the goal for zombies is to infect all humans by knifing them."
"ru" "Битва @greenЛюдей против Зомби@default, цель для зомби - инфицировать всех людей."
} }
"General zmenu reminder" "General zmenu reminder"
{ {
"en" "For help on Zombie:Reloaded commands, type !zmenu in chat." "#format" "{1:s},{2:s}"
"ru" "Напишите !zmenu в чате для просмотра всех команд." "en" "For help on Zombie:Reloaded commands, type \"{1}{2}\" in chat."
} }
// =========================== // ===========================
@ -303,44 +302,44 @@
"Menu main title" "Menu main title"
{ {
"en" "ZR Commands:" "#format" "{1:s},{2:s}"
"ru" "ZR Команды:" "en" "ZR Commands:\nPrefix command with \"{1}\" or \"{2}\" (quiet) when typing in chat."
} }
"Menu main zadmin" "Menu main zadmin"
{ {
"#format" "{1:s}" "#format" "{1:s}"
"en" "ZAdmin ({1}) - Open admin menu." "en" "ZAdmin - Open admin menu. (Command: {1})"
} }
"Menu main zclass" "Menu main zclass"
{ {
"#format" "{1:s}" "#format" "{1:s}"
"en" "ZClass ({1}) - Configure your class settings." "en" "ZClass - Configure your class settings.(Command: {1})"
} }
"Menu main zspawn" "Menu main zspawn"
{ {
"#format" "{1:s}" "#format" "{1:s}"
"en" "ZSpawn ({1}) - Join late? Use this to spawn." "en" "ZSpawn - Join late? Use this to spawn.(Command: {1})"
} }
"Menu main ztele" "Menu main ztele"
{ {
"#format" "{1:s}" "#format" "{1:s}"
"en" "ZTele ({1}) - Teleport back to your spawn location." "en" "ZTele - Teleport back to your spawn location.(Command: {1})"
} }
"Menu main zhp" "Menu main zhp"
{ {
"#format" "{1:s}" "#format" "{1:s}"
"en" "ZHP ({1}) - Toggle real HP display when infected." "en" "ZHP - Toggle real HP display when infected.(Command: {1})"
} }
"Menu main zmarket" "Menu main zmarket"
{ {
"#format" "{1:s}" "#format" "{1:s}"
"en" "ZMarket ({1}) - Need a weapon? Buy them here." "en" "ZMarket - Need a weapon? Buy them here.(Command: {1})"
} }
// =========================== // ===========================

View File

@ -302,31 +302,6 @@ zr_damage_suicide_human "1"
// Default: "kill, spectate, jointeam" // Default: "kill, spectate, jointeam"
zr_damage_suicide_cmds "kill, spectate, jointeam" zr_damage_suicide_cmds "kill, spectate, jointeam"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Say Hooks (core)
// ----------------------------------------------------------------------------
// Stop certain in-game commands from appearing in chat. [See zr_sayhooks_quiet_filter&zr_sayhooks_quiet_flags]
// Default: "1"
zr_sayhooks_quiet "1"
// Stops any failed in-game command from showing in chat. Ex: Typing !zspawn while alive. [Dependency: zr_sayhooks_quiet]
// Default: "1"
zr_sayhooks_quiet_filter "1"
// Flag separate in-game commands to always hide from chat. [Dependency: zr_sayhooks_quiet]
// In-Game Command Flags:
// * Add numbers of desired flags together to produce final flag value.
// --------------------------------------------------------------------
// 1: !zmenu []
// 2: !zadmin [X]
// 4: !zclass []
// 8: !zspawn [X]
// 16: !ztele [X]
// 32: !zhp [X]
// 64: !zmarket []
//
// Default: "58" (Have [X] at the end)
zr_sayhooks_quiet_flags "58"
// ----------------------------------------------------------------------------
// Overlays (core) // Overlays (core)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// How often to update overlays on players. [0.0 = Disabled] // How often to update overlays on players. [0.0 = Disabled]

View File

@ -118,9 +118,7 @@ public OnPluginStart()
ToolsInit(); ToolsInit();
CommandsInit(); CommandsInit();
WeaponsInit(); WeaponsInit();
SayHooksInit();
EventInit(); EventInit();
ZMarketInit();
} }
/** /**

View File

@ -36,6 +36,11 @@ CommandsInit()
ClassOnCommandsCreate(); ClassOnCommandsCreate();
WeaponsOnCommandsCreate(); WeaponsOnCommandsCreate();
InfectOnCommandsCreate(); InfectOnCommandsCreate();
MenuOnCommandsCreate();
ZAdminOnCommandsCreate();
ZSpawnOnCommandsCreate();
ZTeleOnCommandsCreate();
ZHPOnCommandsCreate();
VolOnCommandsCreate(); VolOnCommandsCreate();
// Forward event to modules. (hook commands) // Forward event to modules. (hook commands)

View File

@ -175,10 +175,10 @@ new g_ConfigData[ConfigFile][ConfigData];
*/ */
enum ConfigKvAction enum ConfigKvAction
{ {
KvAction_Create, /** Create a key. */ KvAction_Create, /** Create a key. */
KvAction_KVDelete, /** Delete a key. */ KvAction_KVDelete, /** Delete a key. */
KvAction_KVSet, /** Modify setting of a key. */ KvAction_KVSet, /** Modify setting of a key. */
KvAction_KVGet, /** Get setting of a key. */ KvAction_KVGet, /** Get setting of a key. */
} }
/** /**

View File

@ -305,16 +305,6 @@ CvarsCreate()
g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN] = CreateConVar("zr_damage_suicide_human", "1", "Intercept suicide commands attempted by humans."); g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN] = CreateConVar("zr_damage_suicide_human", "1", "Intercept suicide commands attempted by humans.");
g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]"); g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]");
// ===========================
// Say Hooks (core)
// ===========================
g_hCvarsList[CVAR_SAYHOOKS_QUIET] = CreateConVar("zr_sayhooks_quiet", "1", "Stop certain in-game commands from appearing in chat. [See zr_sayhooks_quiet_filter&zr_sayhooks_quiet_flags]");
g_hCvarsList[CVAR_SAYHOOKS_QUIET_FILTER] = CreateConVar("zr_sayhooks_quiet_filter", "1", "Stops any failed in-game command from showing in chat. Ex: Typing !zspawn while alive. [Dependency: zr_sayhooks_quiet]");
g_hCvarsList[CVAR_SAYHOOKS_QUIET_FLAGS] = CreateConVar("zr_sayhooks_quiet_flags", "58", "Flag separate in-game commands to always hide from chat. [Dependency: zr_sayhooks_quiet]\n In-Game Command Flags:\n * Add numbers of desired flags together to produce final flag value.\n --------------------------------------------------------------------\n 1: !zmenu\n 2: !zadmin\n 4: !zclass\n 8: !zspawn\n 16: !ztele\n 32: !zhp\n 64: !zmarket");
// Flags (default: 2 + 8 + 16 + 32)
// =========================== // ===========================
// Overlays (core) // Overlays (core)
// =========================== // ===========================

View File

@ -81,9 +81,6 @@ EventHook(bool:unhook = false)
*/ */
public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast) public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{ {
// Print round objective to all clients.
TranslationPrintToChatAll(true, false, "General round objective");
// Forward event to sub-modules. // Forward event to sub-modules.
OverlaysOnRoundStart(); OverlaysOnRoundStart();
RoundStartOnRoundStart(); RoundStartOnRoundStart();
@ -196,7 +193,15 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
ZHPOnClientSpawn(index); ZHPOnClientSpawn(index);
VolOnPlayerSpawn(index); VolOnPlayerSpawn(index);
TranslationPrintToChat(index, "General zmenu reminder"); // Get public chat trigger prefix.
decl String:publictrigger[4];
SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger));
// If public chat trigger is disabled, then don't print message.
if (!StrEqual(publictrigger, "N/A", false))
{
TranslationPrintToChat(index, "General zmenu reminder", publictrigger, SAYHOOKS_KEYWORD_ZMENU);
}
// Fire post player_spawn event. // Fire post player_spawn event.
CreateTimer(0.0, EventPlayerSpawnPost, index); CreateTimer(0.0, EventPlayerSpawnPost, index);

View File

@ -212,7 +212,7 @@ stock HitgroupToIndex(hitgroup)
} }
/** /**
* Gets the name of a hitgroup at a given index. * Gets the name of a hitgroup at a given index. (static)
* @param index The hitgroup index. * @param index The hitgroup index.
* @param hitgroup The string to return name in. * @param hitgroup The string to return name in.
* @param maxlen The max length of the string. * @param maxlen The max length of the string.
@ -227,7 +227,7 @@ stock HitgroupsGetName(index, String:hitgroup[], maxlen)
} }
/** /**
* Retrieve hitgroup index. * Retrieve hitgroup index. (static)
* *
* @param index The array index. * @param index The array index.
* @return The hitgroup index. * @return The hitgroup index.
@ -242,7 +242,22 @@ stock HitgroupsGetIndex(index)
} }
/** /**
* Retrieve hitgroup damage value. * Set hitgroup damage value. (dynamic)
*
* @param index The array index.
* @param candamage True to allow damage to hitgroup, false to block damage.
*/
stock HitgroupsSetDamage(index, bool:candamage)
{
// Get array handle of hitgroup at given index.
new Handle:arrayHitgroup = GetArrayCell(arrayHitgroups, index);
// Return true if hitgroup can be damaged, false if not.
SetArrayCell(arrayHitgroup, _:HITGROUPS_DATA_DAMAGE, candamage);
}
/**
* Retrieve hitgroup damage value. (dynamic)
* *
* @param index The array index. * @param index The array index.
* @return True if hitgroup can be damaged, false if not. * @return True if hitgroup can be damaged, false if not.
@ -257,7 +272,22 @@ stock bool:HitgroupsCanDamage(index)
} }
/** /**
* Retrieve hitgroup knockback value. * Set hitgroup knockback value. (dynamic)
*
* @param index The array index.
* @param knockback The knockback multiplier for the hitgroup.
*/
stock HitgroupsSetKnockback(index, Float:knockback)
{
// Get array handle of hitgroup at given index.
new Handle:arrayHitgroup = GetArrayCell(arrayHitgroups, index);
// Return the knockback multiplier for the hitgroup.
SetArrayCell(arrayHitgroup, _:HITGROUPS_DATA_KNOCKBACK, knockback);
}
/**
* Retrieve hitgroup knockback value. (dynamic)
* *
* @param index The array index. * @param index The array index.
* @return The knockback multiplier of the hitgroup. * @return The knockback multiplier of the hitgroup.

View File

@ -25,6 +25,38 @@
* ============================================================================ * ============================================================================
*/ */
/**
* Create commands specific to ZMenu.
*/
MenuOnCommandsCreate()
{
// Register ZMenu command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZMENU, ZMenuCommand, "Opens ZR's main menu.");
}
/**
* Command callback (zmenu)
* Opens ZR's main menu.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZMenuCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Send main menu.
MenuMain(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/** /**
* Show main menu to client. * Show main menu to client.
* *
@ -38,16 +70,23 @@ MenuMain(client)
// Make client global translations target. // Make client global translations target.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
decl String:publictrigger[4];
decl String:silenttrigger[4];
// Get public/silent chat triggers.
SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger));
SayHooksGetSilentChatTrigger(silenttrigger, sizeof(silenttrigger));
// Set menu title. // Set menu title.
SetMenuTitle(menu_main, "%t\n ", "Menu main title"); SetMenuTitle(menu_main, "%t\n ", "Menu main title", publictrigger, silenttrigger);
// Initialize menu lines. // Initialize menu lines.
decl String:zadmin[64]; decl String:zadmin[256];
decl String:zclass[64]; decl String:zclass[256];
decl String:zspawn[64]; decl String:zspawn[256];
decl String:ztele[64]; decl String:ztele[256];
decl String:zhp[64]; decl String:zhp[256];
decl String:zmarket[64]; decl String:zmarket[256];
// Translate each line into client's language. // Translate each line into client's language.
Format(zadmin, sizeof(zadmin), "%t", "Menu main zadmin", SAYHOOKS_KEYWORD_ZMENU); Format(zadmin, sizeof(zadmin), "%t", "Menu main zadmin", SAYHOOKS_KEYWORD_ZMENU);

View File

@ -27,6 +27,9 @@
ClassOnCommandsCreate() ClassOnCommandsCreate()
{ {
// Register ZClass command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZCLASS, ZClassCommand, "Opens class selection menu.");
// Create base class commands. // Create base class commands.
RegConsoleCmd("zr_class_dump", ClassDumpCommand, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump <cachetype> <index|targetname>"); RegConsoleCmd("zr_class_dump", ClassDumpCommand, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump <cachetype> <index|targetname>");
RegAdminCmd("zr_class_modify", ClassModifyCommand, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify <classname|\"zombies\"|\"humans\"|\"admins\"> <attribute> <value> [is_multiplier]"); RegAdminCmd("zr_class_modify", ClassModifyCommand, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify <classname|\"zombies\"|\"humans\"|\"admins\"> <attribute> <value> [is_multiplier]");
@ -41,6 +44,29 @@ ClassOnCommandsHook()
ClassOverlayOnCommandsHook(); ClassOverlayOnCommandsHook();
} }
/**
* Command callback (zclass)
* Opens class selection menu.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZClassCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Send class menu.
ClassMenuMain(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/** /**
* Command callback. (zr_class_dump) * Command callback. (zr_class_dump)
* Dumps class data at a specified index in the specified cache. * Dumps class data at a specified index in the specified cache.

View File

@ -35,6 +35,9 @@
*/ */
RoundStartOnRoundStart() RoundStartOnRoundStart()
{ {
// Print round objective to all clients.
TranslationPrintToChatAll(true, false, "General round objective");
// Kill all objective entities. // Kill all objective entities.
RoundStartKillObjectives(); RoundStartKillObjectives();
} }

View File

@ -25,6 +25,17 @@
* ============================================================================ * ============================================================================
*/ */
/**
* @section SM core config info.
*/
#define SAYHOOKS_CORE_KVNAME "Core"
#define SAYHOOKS_CORE_KVPATH "configs/core.cfg"
#define SAYHOOKS_CHAT_PUBLIC_DEFAULT "!"
#define SAYHOOKS_CHAT_SILENT_DEFAULT "/"
/**
* @endsection
*/
/** /**
* Max number of characters in a chat text string. * Max number of characters in a chat text string.
*/ */
@ -33,176 +44,85 @@
/** /**
* @section Say command key words. * @section Say command key words.
*/ */
#define SAYHOOKS_KEYWORD_ZMENU "!zmenu" #define SAYHOOKS_KEYWORD_ZMENU "zmenu"
#define SAYHOOKS_KEYWORD_ZADMIN "!zadmin" #define SAYHOOKS_KEYWORD_ZADMIN "zadmin"
#define SAYHOOKS_KEYWORD_ZCLASS "!zclass" #define SAYHOOKS_KEYWORD_ZCLASS "zclass"
#define SAYHOOKS_KEYWORD_ZSPAWN "!zspawn" #define SAYHOOKS_KEYWORD_ZSPAWN "zspawn"
#define SAYHOOKS_KEYWORD_ZTELE "!ztele" #define SAYHOOKS_KEYWORD_ZTELE "ztele"
#define SAYHOOKS_KEYWORD_ZHP "!zhp" #define SAYHOOKS_KEYWORD_ZHP "zhp"
#define SAYHOOKS_KEYWORD_ZMARKET "!zmarket" #define SAYHOOKS_KEYWORD_ZMARKET "zmarket"
/** /**
* @endsection * @endsection
*/ */
/** /**
* @section Say hook quiet flags. * Hack function to get the public chat trigger value.
*/
#define SAYHOOKS_KEYWORD_FLAG_ZMENU 1
#define SAYHOOKS_KEYWORD_FLAG_ZADMIN 2
#define SAYHOOKS_KEYWORD_FLAG_ZCLASS 4
#define SAYHOOKS_KEYWORD_FLAG_ZSPAWN 8
#define SAYHOOKS_KEYWORD_FLAG_ZTELE 16
#define SAYHOOKS_KEYWORD_FLAG_ZHP 32
#define SAYHOOKS_KEYWORD_FLAG_ZMARKET 64
/**
* @endsection
*/
/**
* Say hooks module init function.
*/
SayHooksInit()
{
// Hook client's say commands.
RegConsoleCmd("say", SayHooksCmdSay);
RegConsoleCmd("say_team", SayHooksCmdSay);
}
/**
* Command callback. (say, say_team)
* Catches all client's say text and takes action on key words.
* *
* @param client The client index. * @param trigger The string to store value in.
* @param argc The number of arguments in command string. * @param maxlen The maximum length of the string.
*/ */
public Action:SayHooksCmdSay(client, argc) SayHooksGetPublicChatTrigger(String:trigger[], maxlen)
{ {
decl String:args[SAYHOOKS_MAX_CHAT_LENGTH]; // Create kv handle.
new Handle:kvCore = CreateKeyValues(SAYHOOKS_CORE_KVNAME);
// Get client's command string (typically 'say "text"') // Build path to file.
GetCmdArgString(args, sizeof(args)); decl String:filepath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, filepath, PLATFORM_MAX_PATH, SAYHOOKS_CORE_KVPATH);
// Strip away certain characters. // Load kv into memory.
ReplaceString(args, sizeof(args), "\"", ""); // Strip quotes new bool:success = FileToKeyValues(kvCore, filepath);
ReplaceString(args, sizeof(args), " ", ""); // Strip all whitespace.
new chatflag = SayHooksChatToFlag(args); // If the file couldn't be loaded, then return the default value.
if (!success)
// If chatflag is invalid, then continue.
if (!chatflag)
{ {
return Plugin_Continue; strcopy(trigger, maxlen, SAYHOOKS_CHAT_PUBLIC_DEFAULT);
return;
} }
// Define success as true until otherwise changed. // Rewind and find value.
new bool:success = true; KvRewind(kvCore);
KvGetString(kvCore, "PublicChatTrigger", trigger, maxlen, SAYHOOKS_CHAT_PUBLIC_DEFAULT);
switch(chatflag) // If trigger is disabled, then display as "N/A".
if (!trigger[0])
{ {
// Client triggered ZMenu flag. strcopy(trigger, maxlen, "N/A");
case SAYHOOKS_KEYWORD_FLAG_ZMENU:
{
// Send main menu.
MenuMain(client);
}
// Client triggered ZAdmin flag.
case SAYHOOKS_KEYWORD_FLAG_ZADMIN:
{
success = ZRAdminMenu(client);
}
// Client triggered ZClass flag.
case SAYHOOKS_KEYWORD_FLAG_ZCLASS:
{
// Send class menu.
ClassMenuMain(client);
}
// Client triggered ZSpawn flag.
case SAYHOOKS_KEYWORD_FLAG_ZSPAWN:
{
// Spawns a late-joining client into the game.
success = ZSpawnClient(client);
}
// Client triggered ZTele flag.
case SAYHOOKS_KEYWORD_FLAG_ZTELE:
{
success = ZTeleClient(client);
}
// Client triggered ZHP flag.
case SAYHOOKS_KEYWORD_FLAG_ZHP:
{
// Toggle ZHP.
success = ZHPToggle(client);
}
// Client triggered ZMarket flag.
case SAYHOOKS_KEYWORD_FLAG_ZMARKET:
{
success = ZMarketMenuTypes(client);
}
} }
// If quiet cvar is disabled, then continue.
new bool:quiet = GetConVarBool(g_hCvarsList[CVAR_SAYHOOKS_QUIET]);
if (!quiet)
{
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)
{
return Plugin_Handled;
}
return Plugin_Continue;
} }
/** /**
* Convert chat text into a defined flag. * Hack function to get the silent chat trigger value.
* *
* @param chat The chat text to convert. * @param trigger The string to store value in.
* @return Returns flag for word given, returns 0 if matches none. * @param maxlen The maximum length of the string.
*/ */
SayHooksChatToFlag(const String:chat[]) SayHooksGetSilentChatTrigger(String:trigger[], maxlen)
{ {
// Return flag for chatstring. // Create kv handle.
new Handle:kvCore = CreateKeyValues(SAYHOOKS_CORE_KVNAME);
if (StrEqual(chat, SAYHOOKS_KEYWORD_ZMENU, false)) // Build path to file.
decl String:filepath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, filepath, PLATFORM_MAX_PATH, SAYHOOKS_CORE_KVPATH);
// Load kv into memory.
new bool:success = FileToKeyValues(kvCore, filepath);
// If the file couldn't be loaded, then return the default value.
if (!success)
{ {
return SAYHOOKS_KEYWORD_FLAG_ZMENU; strcopy(trigger, maxlen, SAYHOOKS_CHAT_SILENT_DEFAULT);
} return;
else if (StrEqual(chat, SAYHOOKS_KEYWORD_ZADMIN, false))
{
return SAYHOOKS_KEYWORD_FLAG_ZADMIN;
}
else if (StrEqual(chat, SAYHOOKS_KEYWORD_ZCLASS, false))
{
return SAYHOOKS_KEYWORD_FLAG_ZCLASS;
}
else if (StrEqual(chat, SAYHOOKS_KEYWORD_ZSPAWN, false))
{
return SAYHOOKS_KEYWORD_FLAG_ZSPAWN;
}
else if (StrEqual(chat, SAYHOOKS_KEYWORD_ZTELE, false))
{
return SAYHOOKS_KEYWORD_FLAG_ZTELE;
}
else if (StrEqual(chat, SAYHOOKS_KEYWORD_ZHP, false))
{
return SAYHOOKS_KEYWORD_FLAG_ZHP;
}
else if (StrEqual(chat, SAYHOOKS_KEYWORD_ZMARKET, false))
{
return SAYHOOKS_KEYWORD_FLAG_ZMARKET;
} }
// Return 0. // Rewind and find value.
return 0; KvRewind(kvCore);
} KvGetString(kvCore, "SilentChatTrigger", trigger, maxlen, SAYHOOKS_CHAT_SILENT_DEFAULT);
// If trigger is disabled, then display as "N/A".
if (!trigger[0])
{
strcopy(trigger, maxlen, "N/A");
}
}

View File

@ -118,6 +118,7 @@ WeaponsOnCommandsCreate()
{ {
// Forward event to sub-modules. // Forward event to sub-modules.
RestrictOnCommandsCreate(); RestrictOnCommandsCreate();
ZMarketOnCommandsCreate();
} }
/** /**

View File

@ -25,22 +25,6 @@
* ============================================================================ * ============================================================================
*/ */
/* * Copyright (C) 2009 Greyscale, Richard Helgeby
*
* This program 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
/** /**
* Variable to store buyzone offset value. * Variable to store buyzone offset value.
*/ */
@ -67,10 +51,12 @@ new String:g_strZMarketLastWeapon[MAXPLAYERS + 1][WeaponsSlot][WEAPONS_MAX_LENGT
new bool:g_bZMarketAutoRebuy[MAXPLAYERS + 1]; new bool:g_bZMarketAutoRebuy[MAXPLAYERS + 1];
/** /**
* Initialize market data. * Create commands specific to ZMarket.
*/ */
ZMarketInit() ZMarketOnCommandsCreate()
{ {
// Register ZMarket command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZMARKET, ZMarketCommand, "Opens custom buymenu.");
} }
/** /**
@ -684,6 +670,29 @@ ZMarketRebuy(client, bool:rebuy = false)
} }
} }
/**
* Command callback (zmarket)
* Opens custom buymenu.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZMarketCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Send ZMarket menu.
ZMarketMenuTypes(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/** /**
* Checks if a client is in a buyzone. * Checks if a client is in a buyzone.
* *

View File

@ -25,16 +25,56 @@
* ============================================================================ * ============================================================================
*/ */
/**
* Create commands specific to ZAdmin.
*/
ZAdminOnCommandsCreate()
{
// Register ZAdmin command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZADMIN, ZAdminCommand, "Opens ZR admin menu.");
}
/**
* Command callback (zadmin)
* Opens ZR admin menu.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZAdminCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Send admin menu.
ZRAdminMenu(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/**
* Main admin menu.
*
* @param client The client index.
*/
bool:ZRAdminMenu(client) bool:ZRAdminMenu(client)
{ {
// If client isn't an admin, then stop.
if (!ZRIsClientAdmin(client)) if (!ZRIsClientAdmin(client))
{ {
TranslationPrintToChat(client, "Must be admin"); TranslationPrintToChat(client, "Must be admin");
return false; return false;
} }
// Create menu handle.
new Handle:menu_zadmin = CreateMenu(ZRAdminMenuHandle); new Handle:menu_zadmin = CreateMenu(ZRAdminMenuHandle);
// Set translation target as the client.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu_zadmin, "%t\n ", "!zadmin main title"); SetMenuTitle(menu_zadmin, "%t\n ", "!zadmin main title");
@ -72,6 +112,15 @@ bool:ZRAdminMenu(client)
return true; return true;
} }
/**
* Menu callback (zadmin)
* Handles options selected in the admin menu.
*
* @param menu The menu handle.
* @param action Action client is doing in menu.
* @param client The client index.
* @param slot The menu slot selected. (starting from 0)
*/
public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot) public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot)
{ {
if (action == MenuAction_Select) if (action == MenuAction_Select)

View File

@ -35,6 +35,15 @@ new Handle:tZHP[MAXPLAYERS + 1];
*/ */
new bool:pZHP[MAXPLAYERS + 1]; new bool:pZHP[MAXPLAYERS + 1];
/**
* Create commands specific to ZHP.
*/
ZHPOnCommandsCreate()
{
// Register ZHP command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZHP, ZHPCommand, "Shows real HP as zombie.");
}
/** /**
* Client is joining the server. * Client is joining the server.
* *
@ -204,6 +213,29 @@ ZHPUpdateHUD(client)
TranslationPrintHUDText(client, "Display HP", health); TranslationPrintHUDText(client, "Display HP", health);
} }
/**
* Command callback (zhp)
* Shows real HP as zombie.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZHPCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Toggle ZHP setting.
ZHPToggle(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/** /**
* Timer callback. Repetitively calls ZHPUpdateHUD() until stopped. * Timer callback. Repetitively calls ZHPUpdateHUD() until stopped.
* *

View File

@ -30,6 +30,15 @@
*/ */
new Handle:tZSpawn = INVALID_HANDLE; new Handle:tZSpawn = INVALID_HANDLE;
/**
* Create commands specific to ZSpawn.
*/
ZSpawnOnCommandsCreate()
{
// Register ZSpawn command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZSPAWN, ZSpawnCommand, "Spawn into the game after joining late.");
}
/** /**
* Map is starting. * Map is starting.
*/ */
@ -215,6 +224,29 @@ bool:ZSpawnClient(client)
return true; return true;
} }
/**
* Command callback (zspawn)
* Spawn into the game after joining late.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZSpawnCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Spawn client.
ZSpawnClient(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/** /**
* Timer callback, resets handle. * Timer callback, resets handle.
* *

View File

@ -50,6 +50,15 @@ new Handle:tZTele[MAXPLAYERS + 1];
*/ */
new g_iZTeleTimeLeft[MAXPLAYERS + 1]; new g_iZTeleTimeLeft[MAXPLAYERS + 1];
/**
* Create commands specific to ZTele.
*/
ZTeleOnCommandsCreate()
{
// Register ZMenu command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZTELE, ZTeleCommand, "Teleport back to spawn if you are stuck.");
}
/** /**
* Client is joining the server. * Client is joining the server.
* *
@ -217,6 +226,29 @@ ZTeleTeleportClient(client)
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR); TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR);
} }
/**
* Command callback (zmenu)
* Teleport back to spawn if you are stuck.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZTeleCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Start teleportation process.
ZTeleClient(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/** /**
* Timer callback, counts down teleport to the client. * Timer callback, counts down teleport to the client.
* *