From eaf3da9987972df7a0339a4802586f9cb172495a Mon Sep 17 00:00:00 2001 From: Greyscale Date: Sun, 29 Mar 2009 21:52:37 +0200 Subject: [PATCH 1/8] Renamed zradmin.inc to zadmin.inc --- src/zr/{zradmin.inc => zadmin.inc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/zr/{zradmin.inc => zadmin.inc} (100%) diff --git a/src/zr/zradmin.inc b/src/zr/zadmin.inc similarity index 100% rename from src/zr/zradmin.inc rename to src/zr/zadmin.inc From a0276e5c14ef1eab415d797020aa240f136cf0a1 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Sun, 29 Mar 2009 22:04:47 +0200 Subject: [PATCH 2/8] Renamed zradmin to zadmin, menu is translatable and accessible from ZMenu --- src/zr/commands.inc | 2 +- src/zr/cvars.inc | 2 +- src/zr/menu.inc | 32 +++- src/zr/zadmin.inc | 364 ++++++++++++++++++++++++-------------------- 4 files changed, 232 insertions(+), 168 deletions(-) diff --git a/src/zr/commands.inc b/src/zr/commands.inc index bdc0ca3..bed26fd 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -289,7 +289,7 @@ public Action:Command_TeleMenu(client, argc) { if (IsClientPlayer(client)) { - ZRTeleMenu(client); + ZRZTeleMenu(client); } else { diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 68aa41b..87e4804 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -111,7 +111,7 @@ CreateCvars() gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)"); gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)"); gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "1", "How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values (1: Default)"); - gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override/Nvgs on, 0: No nvgs, 1: Nvgs on)"); + gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override, uses class setting, 0: No nvgs, 1: Nvgs on)"); gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)"); gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health"); gCvars[CVAR_ZOMBIE_REGEN_HEALTH] = CreateConVar("zr_zombie_regen_health", "1", "How much health is regenerated when zr_zombie_regen is 1"); diff --git a/src/zr/menu.inc b/src/zr/menu.inc index 26047fc..7b70689 100644 --- a/src/zr/menu.inc +++ b/src/zr/menu.inc @@ -15,6 +15,7 @@ MainMenu(client) SetMenuTitle(menu_main, "%t\n ", "!zmenu title"); decl String:zmenu[128]; + decl String:zadmin[128]; decl String:zclass[128]; decl String:zmarket[128]; decl String:zspawn[128]; @@ -23,6 +24,7 @@ MainMenu(client) decl String:zhp[128]; Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu"); + Format(zadmin, sizeof(zadmin), "%t", "!zmenu admin"); Format(zclass, sizeof(zclass), "%t", "!zmenu class"); Format(zmarket, sizeof(zmarket), "%t", "!zmenu market"); Format(zspawn, sizeof(zspawn), "%t", "!zmenu spawn"); @@ -31,6 +33,16 @@ MainMenu(client) Format(zhp, sizeof(zhp), "%t (%d HP)", "!zmenu hp", GetClientHealth(client)); AddMenuItem(menu_main, "zmenu", zmenu, ITEMDRAW_DISABLED); + + if (GetAdminFlag(GetUserAdmin(client), Admin_Generic)) + { + AddMenuItem(menu_main, "zadmin", zadmin); + } + else + { + AddMenuItem(menu_main, "zadmin", zadmin, ITEMDRAW_DISABLED); + } + AddMenuItem(menu_main, "zclass", zclass); if (market) @@ -58,32 +70,42 @@ public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot) { case 1: { - if (!ZClass(client)) + if (!ZRAdminMenu(client)) { MainMenu(client); } } case 2: { - if (!ZMarket(client)) + if (!ZClass(client)) { MainMenu(client); } } case 3: { - ZSpawn(client); + if (!ZMarket(client)) + { + MainMenu(client); + } } case 4: { - if (!ZTeleClientCheck(client)) MainMenu(client); + ZSpawn(client); } case 5: + { + if (!ZTele(client)) + { + MainMenu(client); + } + } + case 6: { ZStuck(client); MainMenu(client); } - case 6: + case 7: { ZHP(client); MainMenu(client); diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index 0291a36..dce330f 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -7,38 +7,61 @@ */ #include "include/adminmenu.inc" -new SelectedClassIndex[MAXPLAYERS]; +new curMenuClass[MAXPLAYERS+1]; -ZRAdminMenu(client) +bool:ZRAdminMenu(client) { - new Handle:zr_admin_menu = CreateMenu(ZRAdminMenuHandle); + if (!GetAdminFlag(GetUserAdmin(client), Admin_Generic)) + { + ZR_PrintToChat(client, "Must be admin"); + + return false; + } - SetMenuTitle(zr_admin_menu, "ZR admin menu"); + new Handle:menu_admin = CreateMenu(ZRAdminMenuHandle); - decl String:zknockbackm[] = "Change knockback multiplier"; - decl String:zknockback[] = "Change class knockback"; - decl String:znvgs[] = "Change night vision settings"; - decl String:zinfect[] = "Infect a player"; - decl String:zspawn[] = "Spawn all players"; - decl String:ztele[] = "Teleporter commands"; - decl String:zrestrict[] = "Restrict a weapon"; - decl String:zunrestrict[] = "Unrestrict a weapon"; - decl String:zlogflags[] = "Logging flags"; + SetGlobalTransTarget(client); - AddMenuItem(zr_admin_menu, "zknockbackm", zknockbackm); - AddMenuItem(zr_admin_menu, "zknockback", zknockback); - AddMenuItem(zr_admin_menu, "znvgs", znvgs); - AddMenuItem(zr_admin_menu, "zinfect", zinfect); - AddMenuItem(zr_admin_menu, "zspawn", zspawn); - AddMenuItem(zr_admin_menu, "ztele", ztele); - AddMenuItem(zr_admin_menu, "zrestrict", zrestrict, ITEMDRAW_DISABLED); - AddMenuItem(zr_admin_menu, "zunrestrict", zunrestrict, ITEMDRAW_DISABLED); - AddMenuItem(zr_admin_menu, "zlogflags", zlogflags); + SetMenuTitle(menu_admin, "%t\n ", "!zadmin main title"); - DisplayMenu(zr_admin_menu, client, MENU_TIME_FOREVER); + decl String:knockbackm[64]; + decl String:knockback[64]; + decl String:nvgs[64]; + decl String:infect[64]; + decl String:zspawn[64]; + decl String:ztele[64]; + decl String:restrict[64]; + decl String:unrestrict[64]; + decl String:logflags[64]; + + Format(knockbackm, sizeof(knockbackm), "%t", "!zadmin main knockbackm"); + Format(knockback, sizeof(knockback), "%t", "!zadmin main knockback"); + Format(nvgs, sizeof(nvgs), "%t", "!zadmin main nvgs"); + Format(infect, sizeof(infect), "%t", "!zadmin main infect"); + Format(zspawn, sizeof(zspawn), "%t", "!zadmin main spawn"); + Format(ztele, sizeof(ztele), "%t", "!zadmin main tele"); + Format(restrict, sizeof(restrict), "%t", "!zadmin main restrict"); + Format(unrestrict, sizeof(unrestrict), "%t", "!zadmin main unrestrict"); + Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags"); + + AddMenuItem(menu_admin, "knockbackm", knockbackm); + AddMenuItem(menu_admin, "knockback", knockback); + AddMenuItem(menu_admin, "nvgs", nvgs); + AddMenuItem(menu_admin, "infect", infect); + AddMenuItem(menu_admin, "zspawn", zspawn); + AddMenuItem(menu_admin, "ztele", ztele); + AddMenuItem(menu_admin, "restrict", restrict, ITEMDRAW_DISABLED); + AddMenuItem(menu_admin, "unrestrict", unrestrict, ITEMDRAW_DISABLED); + AddMenuItem(menu_admin, "logflags", logflags); + + SetMenuExitBackButton(menu_admin, true); + + DisplayMenu(menu_admin, client, MENU_TIME_FOREVER); + + return true; } -public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot) +public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot) { if (action == MenuAction_Select) { @@ -66,7 +89,7 @@ public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot) } case 5: { - ZRTeleMenu(client); + ZRZTeleMenu(client); } case 6: { @@ -82,35 +105,44 @@ public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot) } } } - if (action == MenuAction_End) + + if (action == MenuAction_Cancel) { - CloseHandle(zr_admin_menu); + if (slot == MenuCancel_ExitBack) + { + MainMenu(client); + } + } + else if (action == MenuAction_End) + { + CloseHandle(menu_admin); } } ZRKnockbackMMenu(client) { - new Handle:zr_knockbackm_menu = CreateMenu(ZRKnockbackMHandle); - new Float:current_knockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]); - - SetMenuTitle(zr_knockbackm_menu, "Change knockback multiplier\nCurrent value: %f\n\n", current_knockback); + new Handle:menu_knockbackm = CreateMenu(ZRKnockbackMHandle); + new Float:curknockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]); - decl String:zincreasehalf[] = "Increase by 0.5"; - decl String:zincreasedeca[] = "Increase by 0.1"; - decl String:zdecreasedeci[] = "Decrease by 0.1"; - decl String:zdecreasehalf[] = "Decrease by 0.5"; + SetGlobalTransTarget(client); - AddMenuItem(zr_knockbackm_menu, "zincreasehalf", zincreasehalf); - AddMenuItem(zr_knockbackm_menu, "zincreasedeca", zincreasedeca); - AddMenuItem(zr_knockbackm_menu, "zdecreasedeci", zdecreasedeci); - AddMenuItem(zr_knockbackm_menu, "zdecreasehalf", zdecreasehalf); + SetMenuTitle(menu_knockbackm, "%t\n ", "!zadmin knockbackm title", curknockback); - SetMenuExitBackButton(zr_knockbackm_menu, true); + decl String:knockbackmincrease[64]; + decl String:knockbackmdecrease[64]; - DisplayMenu(zr_knockbackm_menu, client, MENU_TIME_FOREVER); + Format(knockbackmincrease, sizeof(knockbackmincrease), "%t", "!zadmin knockbackm increase"); + Format(knockbackmdecrease, sizeof(knockbackmdecrease), "%t", "!zadmin knockbackm decrease"); + + AddMenuItem(menu_knockbackm, "knockbackmincrease", knockbackmincrease); + AddMenuItem(menu_knockbackm, "knockbackmdecrease", knockbackmdecrease); + + SetMenuExitBackButton(menu_knockbackm, true); + + DisplayMenu(menu_knockbackm, client, MENU_TIME_FOREVER); } -public ZRKnockbackMHandle(Handle:zr_knockbackm_menu, MenuAction:action, client, slot) +public ZRKnockbackMHandle(Handle:menu_knockbackm, MenuAction:action, client, slot) { if (action == MenuAction_Select) { @@ -118,24 +150,14 @@ public ZRKnockbackMHandle(Handle:zr_knockbackm_menu, MenuAction:action, client, { case 0: { - AddToKnockbackMultiplier(0.5); + AddToKnockbackMultiplier(0.1); ZRKnockbackMMenu(client); } case 1: - { - AddToKnockbackMultiplier(0.1); - ZRKnockbackMMenu(client); - } - case 2: { AddToKnockbackMultiplier(-0.1); ZRKnockbackMMenu(client); } - case 3: - { - AddToKnockbackMultiplier(-0.5); - ZRKnockbackMMenu(client); - } } } if (action == MenuAction_Cancel) @@ -147,31 +169,33 @@ public ZRKnockbackMHandle(Handle:zr_knockbackm_menu, MenuAction:action, client, } if (action == MenuAction_End) { - CloseHandle(zr_knockbackm_menu); + CloseHandle(menu_knockbackm); } } ZRClassSelectMenu(client) { - new Handle:zr_class_select_menu = CreateMenu(ZRClassSelectHandle); - new classindex; + new Handle:menu_class = CreateMenu(ZRClassSelectHandle); - SetMenuTitle(zr_class_select_menu, "Select class to change:\n"); + SetGlobalTransTarget(client); - for (classindex = 0; classindex < classCount; classindex++) + SetMenuTitle(menu_class, "%t\n ", "!zadmin class title"); + + // x = index of class + for (new x = 0; x < classCount; x++) { - AddMenuItem(zr_class_select_menu, arrayClasses[classindex][data_name], arrayClasses[classindex][data_name]); + AddMenuItem(menu_class, arrayClasses[x][data_name], arrayClasses[x][data_name]); } - SetMenuExitBackButton(zr_class_select_menu, true); - DisplayMenu(zr_class_select_menu, client, MENU_TIME_FOREVER); + SetMenuExitBackButton(menu_class, true); + DisplayMenu(menu_class, client, MENU_TIME_FOREVER); } -public ZRClassSelectHandle(Handle:zr_class_select_menu, MenuAction:action, client, slot) +public ZRClassSelectHandle(Handle:menu_class, MenuAction:action, client, slot) { if (action == MenuAction_Select) { - SelectedClassIndex[client] = slot; + curMenuClass[client] = slot; ZRClassKnockbackMenu(client, slot); } if (action == MenuAction_Cancel) @@ -183,35 +207,38 @@ public ZRClassSelectHandle(Handle:zr_class_select_menu, MenuAction:action, clien } if (action == MenuAction_End) { - CloseHandle(zr_class_select_menu); + CloseHandle(menu_class); } } ZRClassKnockbackMenu(client, classindex) { - new Handle:zr_knockback_menu = CreateMenu(ZRClassKnockbackHandle); - new Float:current_knockback = arrayClasses[classindex][data_knockback]; + new Handle:menu_knockback = CreateMenu(ZRClassKnockbackHandle); + + new Float:curknockback = arrayClasses[classindex][data_knockback]; + new String:classname[64]; GetClassName(classindex, classname, sizeof(classname)); - - SetMenuTitle(zr_knockback_menu, "Change %s knockback\nCurrent value: %f\n\n", classname, current_knockback); - decl String:zincreasehalf[] = "Increase by 0.5"; - decl String:zincreasedeca[] = "Increase by 0.1"; - decl String:zdecreasedeci[] = "Decrease by 0.1"; - decl String:zdecreasehalf[] = "Decrease by 0.5"; + SetGlobalTransTarget(client); - AddMenuItem(zr_knockback_menu, "zincreasehalf", zincreasehalf); - AddMenuItem(zr_knockback_menu, "zincreasedeca", zincreasedeca); - AddMenuItem(zr_knockback_menu, "zdecreasedeci", zdecreasedeci); - AddMenuItem(zr_knockback_menu, "zdecreasehalf", zdecreasehalf); + SetMenuTitle(menu_knockback, "%t\n ", "!zadmin knockback title", classname, curknockback); - SetMenuExitBackButton(zr_knockback_menu, true); + decl String:knockbackincrease[64]; + decl String:knockbackdecrease[64]; - DisplayMenu(zr_knockback_menu, client, MENU_TIME_FOREVER); + Format(knockbackincrease, sizeof(knockbackincrease), "%t", "!zadmin knockback increase"); + Format(knockbackdecrease, sizeof(knockbackdecrease), "%t", "!zadmin knockback decrease"); + + AddMenuItem(menu_knockback, "knockbackincrease", knockbackincrease); + AddMenuItem(menu_knockback, "knockbackdecrease", knockbackdecrease); + + SetMenuExitBackButton(menu_knockback, true); + + DisplayMenu(menu_knockback, client, MENU_TIME_FOREVER); } -public ZRClassKnockbackHandle(Handle:zr_knockback_menu, MenuAction:action, client, slot) +public ZRClassKnockbackHandle(Handle:menu_knockback, MenuAction:action, client, slot) { if (action == MenuAction_Select) { @@ -219,25 +246,15 @@ public ZRClassKnockbackHandle(Handle:zr_knockback_menu, MenuAction:action, clien { case 0: { - AddToClassKnockback(SelectedClassIndex[client], 0.5); - ZRClassKnockbackMenu(client, SelectedClassIndex[client]); + AddToClassKnockback(curMenuClass[client], 0.1); } case 1: { - AddToClassKnockback(SelectedClassIndex[client], 0.1); - ZRClassKnockbackMenu(client, SelectedClassIndex[client]); - } - case 2: - { - AddToClassKnockback(SelectedClassIndex[client], -0.1); - ZRClassKnockbackMenu(client, SelectedClassIndex[client]); - } - case 3: - { - AddToClassKnockback(SelectedClassIndex[client], -0.5); - ZRClassKnockbackMenu(client, SelectedClassIndex[client]); + AddToClassKnockback(curMenuClass[client], -0.1); } } + + ZRClassKnockbackMenu(client, curMenuClass[client]); } if (action == MenuAction_Cancel) { @@ -248,31 +265,37 @@ public ZRClassKnockbackHandle(Handle:zr_knockback_menu, MenuAction:action, clien } if (action == MenuAction_End) { - CloseHandle(zr_knockback_menu); + CloseHandle(menu_knockback); } } ZRNVGSMenu(client) { - new Handle:zr_nvgs_menu = CreateMenu(ZRNVGSHandle); - new current_nvgs = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]); + new Handle:menu_nvgs = CreateMenu(ZRNVGSHandle); + new curnvgs = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]); - SetMenuTitle(zr_nvgs_menu, "Change night vision settings\nCurrent value: %i\n", current_nvgs); + SetGlobalTransTarget(client); - decl String:znooverride[] = "-1: No override/Default"; - decl String:zoff[] = "0: Never give nvgs"; - decl String:zon[] = "1: Always give nvgs"; + SetMenuTitle(menu_nvgs, "%t\n ", "!zadmin nvgs title", curnvgs); - AddMenuItem(zr_nvgs_menu, "znooverride", znooverride); - AddMenuItem(zr_nvgs_menu, "zoff", zoff); - AddMenuItem(zr_nvgs_menu, "zon", zon); + decl String:nooverride[64]; + decl String:disable[64]; + decl String:enable[64]; - SetMenuExitBackButton(zr_nvgs_menu, true); + Format(nooverride, sizeof(nooverride), "%t", "!zadmin nvgs no override"); + Format(disable, sizeof(disable), "%t", "!zadmin nvgs disable"); + Format(enable, sizeof(enable), "%t", "!zadmin nvgs enable"); - DisplayMenu(zr_nvgs_menu, client, MENU_TIME_FOREVER); + AddMenuItem(menu_nvgs, "nooverride", nooverride); + AddMenuItem(menu_nvgs, "disable", disable); + AddMenuItem(menu_nvgs, "enable", enable); + + SetMenuExitBackButton(menu_nvgs, true); + + DisplayMenu(menu_nvgs, client, MENU_TIME_FOREVER); } -public ZRNVGSHandle(Handle:zr_nvgs_menu, MenuAction:action, client, slot) +public ZRNVGSHandle(Handle:menu_nvgs, MenuAction:action, client, slot) { if (action == MenuAction_Select) { @@ -304,28 +327,33 @@ public ZRNVGSHandle(Handle:zr_nvgs_menu, MenuAction:action, client, slot) } if (action == MenuAction_End) { - CloseHandle(zr_nvgs_menu); + CloseHandle(menu_nvgs); } } ZRInfectMenu(client) { - new Handle:zr_infect_menu = CreateMenu(ZRInfectHandle); - - SetMenuTitle(zr_infect_menu, "Infect a player:"); - AddTargetsToMenu(zr_infect_menu, client, true, true); - SetMenuExitBackButton(zr_infect_menu, true); - DisplayMenu(zr_infect_menu, client, MENU_TIME_FOREVER); + new Handle:menu_infect = CreateMenu(ZRInfectHandle); + + SetGlobalTransTarget(client); + + SetMenuTitle(menu_infect, "%t\n ", "!zadmin infect title"); + + AddTargetsToMenu(menu_infect, client, true, true); + + SetMenuExitBackButton(menu_infect, true); + + DisplayMenu(menu_infect, client, MENU_TIME_FOREVER); } -public ZRInfectHandle(Handle:zr_infect_menu, MenuAction:action, client, slot) +public ZRInfectHandle(Handle:menu_infect, MenuAction:action, client, slot) { if (action == MenuAction_Select) { decl String:info[32]; new userid, target; - GetMenuItem(zr_infect_menu, slot, info, sizeof(info)); + GetMenuItem(menu_infect, slot, info, sizeof(info)); userid = StringToInt(info); if ((target = GetClientOfUserId(userid)) == 0) @@ -358,42 +386,50 @@ public ZRInfectHandle(Handle:zr_infect_menu, MenuAction:action, client, slot) } if (action == MenuAction_End) { - CloseHandle(zr_infect_menu); + CloseHandle(menu_infect); } } ZRSpawnAll(client) { - for (new c = 1; c < maxclients; c++) + for (new x = 1; x < maxclients; x++) { - if (IsClientConnected(c) && IsClientInGame(c)) + if (IsClientInGame(x)) { - ZSpawn(c); + ZSpawn(x); } } ZRAdminMenu(client); } -ZRTeleMenu(client) +ZRZTeleMenu(client) { - new Handle:zr_tele_menu = CreateMenu(ZRTeleHandle); + new Handle:menu_ztele = CreateMenu(ZRTeleHandle); - decl String:ztele_player[] = "Teleport players"; - decl String:ztele_abort[] = "Abort teleport on players"; - decl String:ztele_save[] = "Save player location"; - decl String:ztele_teleloc[] = "Teleport player to saved location"; + SetGlobalTransTarget(client); - SetMenuTitle(zr_tele_menu, "Teleport menu"); - AddMenuItem(zr_tele_menu, "ztele_player", ztele_player); - AddMenuItem(zr_tele_menu, "ztele_abort", ztele_abort); - AddMenuItem(zr_tele_menu, "ztele_save", ztele_save); - AddMenuItem(zr_tele_menu, "ztele_teleloc", ztele_teleloc); + SetMenuTitle(menu_ztele, "%t\n ", "!zadmin ztele title"); - SetMenuExitBackButton(zr_tele_menu, true); - DisplayMenu(zr_tele_menu, client, MENU_TIME_FOREVER); + decl String:ztele_spawntele[64]; + decl String:ztele_abort[64]; + decl String:ztele_save[64]; + decl String:ztele_tele[64]; + + Format(ztele_spawntele, sizeof(ztele_spawntele), "%t", "!zadmin ztele spawn tele"); + Format(ztele_abort, sizeof(ztele_abort), "%t", "!zadmin ztele abort"); + Format(ztele_save, sizeof(ztele_save), "%t", "!zadmin ztele save"); + Format(ztele_tele, sizeof(ztele_tele), "%t", "!zadmin ztele tele"); + + AddMenuItem(menu_ztele, "ztele_spawntele", ztele_spawntele); + AddMenuItem(menu_ztele, "ztele_abort", ztele_abort); + AddMenuItem(menu_ztele, "ztele_save", ztele_save); + AddMenuItem(menu_ztele, "ztele_tele", ztele_tele); + + SetMenuExitBackButton(menu_ztele, true); + DisplayMenu(menu_ztele, client, MENU_TIME_FOREVER); } -public ZRTeleHandle(Handle:zr_tele_menu , MenuAction:action, client, slot) +public ZRTeleHandle(Handle:menu_ztele , MenuAction:action, client, slot) { if (action == MenuAction_Select) { @@ -426,13 +462,18 @@ public ZRTeleHandle(Handle:zr_tele_menu , MenuAction:action, client, slot) } if (action == MenuAction_End) { - CloseHandle(zr_tele_menu); + CloseHandle(menu_ztele); } } ZRLogFlagsMenu(client) { - new Handle:zr_log_flags_menu = CreateMenu(ZRLogFlagsMenuHandle); + new Handle:menu_log_flags = CreateMenu(ZRLogFlagsMenuHandle); + + SetGlobalTransTarget(client); + + SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title"); + new client_flags = GetUserFlagBits(client); new item_disabled = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED; @@ -480,34 +521,33 @@ ZRLogFlagsMenu(client) Format(z_log_module_damagecontrol, sizeof(z_log_module_damagecontrol), "Damage control (suicides) (%d)", LogHasFlag(LOG_MODULE_DAMAGECONTROL)); Format(z_log_module_offsets, sizeof(z_log_module_offsets), "Offsets (properties) (%d)", LogHasFlag(LOG_MODULE_OFFSETS)); - SetMenuTitle(zr_log_flags_menu, "Toggle logging flags"); - AddMenuItem(zr_log_flags_menu, z_log_core, z_log_core, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_game, z_log_game, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_player, z_log_player, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_debug, z_log_debug, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_debug_detail, z_log_debug_detail, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_debug_max, z_log_debug_max, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_admins, z_log_admins); - AddMenuItem(zr_log_flags_menu, z_log_client, z_log_client); - AddMenuItem(zr_log_flags_menu, z_log_ignore_console, z_log_ignore_console, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_modules_enabled, z_log_modules_enabled, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_zombie, z_log_module_zombie, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_ambience, z_log_module_ambience, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_overlays, z_log_module_overlays, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_saytriggers, z_log_module_saytriggers, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_teleport, z_log_module_teleport, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_classes, z_log_module_classes, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_weaponrestrict, z_log_module_weaponrestrict, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_commands, z_log_module_commands, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_anticamp, z_log_module_anticamp, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_damagecontrol, z_log_module_damagecontrol, item_disabled); - AddMenuItem(zr_log_flags_menu, z_log_module_offsets, z_log_module_offsets, item_disabled); + AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_disabled); + AddMenuItem(menu_log_flags, z_log_game, z_log_game, item_disabled); + AddMenuItem(menu_log_flags, z_log_player, z_log_player, item_disabled); + AddMenuItem(menu_log_flags, z_log_debug, z_log_debug, item_disabled); + AddMenuItem(menu_log_flags, z_log_debug_detail, z_log_debug_detail, item_disabled); + AddMenuItem(menu_log_flags, z_log_debug_max, z_log_debug_max, item_disabled); + AddMenuItem(menu_log_flags, z_log_admins, z_log_admins); + AddMenuItem(menu_log_flags, z_log_client, z_log_client); + AddMenuItem(menu_log_flags, z_log_ignore_console, z_log_ignore_console, item_disabled); + AddMenuItem(menu_log_flags, z_log_modules_enabled, z_log_modules_enabled, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_zombie, z_log_module_zombie, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_ambience, z_log_module_ambience, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_overlays, z_log_module_overlays, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_saytriggers, z_log_module_saytriggers, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_teleport, z_log_module_teleport, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_classes, z_log_module_classes, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_weaponrestrict, z_log_module_weaponrestrict, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_commands, z_log_module_commands, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_anticamp, z_log_module_anticamp, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_damagecontrol, z_log_module_damagecontrol, item_disabled); + AddMenuItem(menu_log_flags, z_log_module_offsets, z_log_module_offsets, item_disabled); - SetMenuExitBackButton(zr_log_flags_menu, true); - DisplayMenu(zr_log_flags_menu, client, MENU_TIME_FOREVER); + SetMenuExitBackButton(menu_log_flags, true); + DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER); } -public ZRLogFlagsMenuHandle(Handle:zr_log_flags_menu , MenuAction:action, client, slot) +public ZRLogFlagsMenuHandle(Handle:menu_log_flags , MenuAction:action, client, slot) { if (action == MenuAction_Select) { @@ -629,7 +669,7 @@ public ZRLogFlagsMenuHandle(Handle:zr_log_flags_menu , MenuAction:action, client } if (action == MenuAction_End) { - CloseHandle(zr_log_flags_menu ); + CloseHandle(menu_log_flags ); } } @@ -648,6 +688,7 @@ ToggleLogFlag(flag) { new log_flags; log_flags = GetConVarInt(gCvars[CVAR_LOG]); + if (log_flags & flag) { log_flags = log_flags - flag; @@ -656,5 +697,6 @@ ToggleLogFlag(flag) { log_flags = log_flags + flag; } + SetConVarInt(gCvars[CVAR_LOG], log_flags); } \ No newline at end of file From 6555cdd77848905847d52c9a451871e518a6eda6 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Sun, 29 Mar 2009 22:08:56 +0200 Subject: [PATCH 3/8] ZR_PrintToAdminChat now checks for Admin_Generic flag --- src/zr/translation.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zr/translation.inc b/src/zr/translation.inc index 6dd5326..3e24c14 100644 --- a/src/zr/translation.inc +++ b/src/zr/translation.inc @@ -175,7 +175,7 @@ stock ZR_PrintToAdminChat(String:message[]) Format(buffer, sizeof(buffer), "[ZR] %s", message); for (new client = 1; client < maxclients; client++) { - if (IsClientConnected(client) && IsClientInGame(client) && GetUserAdmin(client) != INVALID_ADMIN_ID) + if (IsClientConnected(client) && IsClientInGame(client) && GetAdminFlag(GetUserAdmin(client), Admin_Generic)) { PrintToChat(client, buffer); } From 21b29e8bb3a3804daf063307b96630aadb1733da Mon Sep 17 00:00:00 2001 From: Greyscale Date: Sun, 29 Mar 2009 23:42:19 +0200 Subject: [PATCH 4/8] Fixed spawn protection being buggy when admin infects them, added better countdown, changed variable names (consistency), fixed typo in world kill respawn cvar, gKilledByWorld initialized on connect --- src/zombiereloaded.sp | 3 ++- src/zr/cvars.inc | 2 +- src/zr/event.inc | 12 +++++----- src/zr/zombie.inc | 48 +++++++++++++-------------------------- src/zr/zombiereloaded.inc | 18 +++++++-------- 5 files changed, 34 insertions(+), 49 deletions(-) diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 4bece7b..1278dc3 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -31,7 +31,7 @@ #include "zr/zombie" #include "zr/menu" #include "zr/sayhooks" -#include "zr/zradmin" +#include "zr/zadmin" #include "zr/weaponrestrict" #include "zr/damagecontrol" #include "zr/commands" @@ -155,6 +155,7 @@ public OnClientPutInServer(client) { pClass[client] = GetDefaultClassIndex(); gBlockMotherInfect[client] = false; + gKilledByWorld[client] = false; bZVision[client] = !IsFakeClient(client); diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 87e4804..2a2a363 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -137,7 +137,7 @@ CreateCvars() gCvars[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "How long to wait after death to respawn, in seconds"); gCvars[CVAR_SUICIDE] = CreateConVar("zr_suicide", "1", "Stops players from suiciding"); gCvars[CVAR_SUICIDE_ECHO] = CreateConVar("zr_suicide_echo", "0", "Log suicide attempts to admin chat."); - gCvars[CVAR_SUICIDE_WORLD_DAMAGE] = CreateConVar("zr_suicide_world_damage", "1", "Respawn zombies as zombies if they was killed by the world, like elevators, doors and lasers."); + gCvars[CVAR_SUICIDE_WORLD_DAMAGE] = CreateConVar("zr_suicide_world_damage", "1", "Respawn zombies as zombies if they were killed by the world, like elevators, doors and lasers. (0: Disable)"); gCvars[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "Minimum time a player is picked to be zombie after the round starts, in seconds"); gCvars[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "Maximum time a player is picked to be zombie after the round starts, in seconds"); gCvars[CVAR_PROTECT] = CreateConVar("zr_protect", "10", "Players that join late will be protected for this long, in seconds (0: Disable)"); diff --git a/src/zr/event.inc b/src/zr/event.inc index 38d8626..88fa80a 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -212,8 +212,8 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { decl String:respawnteam[32]; GetConVarString(gCvars[CVAR_RESPAWN_TEAM], respawnteam, sizeof(respawnteam)); - - if (!StrEqual(respawnteam, "zombie", false)) + + if (!StrEqual(respawnteam, "zombie", false) && !(GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[index])) { SetPlayerAlpha(index, 0); SetPlayerSpeed(index, 600.0); @@ -227,11 +227,11 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) CloseHandle(tHandles[index][TPROTECT]); } - protCount[index] = protect; - PrintHintText(index, "%d", protCount[index]); - protCount[index]--; + pTimeLeft[index] = protect; + + PrintHintText(index, "%d", pTimeLeft[index]); - tHandles[index][TPROTECT] = CreateTimer(1.0, EndProtect, index, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); + tHandles[index][TPROTECT] = CreateTimer(1.0, ProtectTimer, index, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); } } } diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index d6bc056..9be63f9 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -207,7 +207,9 @@ Zombify_Mother(client) if (tHandles[client][TPROTECT] != INVALID_HANDLE) { - TriggerTimer(tHandles[client][TPROTECT]); + pProtect[client] = false; + + CloseHandle(tHandles[client][TPROTECT]); tHandles[client][TPROTECT] = INVALID_HANDLE; } @@ -286,7 +288,9 @@ Zombify(client, attacker) if (tHandles[client][TPROTECT] != INVALID_HANDLE) { - TriggerTimer(tHandles[client][TPROTECT]); + pProtect[client] = false; + + CloseHandle(tHandles[client][TPROTECT]); tHandles[client][TPROTECT] = INVALID_HANDLE; } @@ -842,7 +846,7 @@ public Action:ZHPTimer(Handle:timer, any:index) return Plugin_Continue; } -public Action:EndProtect(Handle:timer, any:index) +public Action:ProtectTimer(Handle:timer, any:index) { if (!IsClientInGame(index)) { @@ -850,45 +854,26 @@ public Action:EndProtect(Handle:timer, any:index) return Plugin_Stop; } - if (protCount[index] > 0) { - PrintHintText(index, "%d", protCount[index]); - protCount[index]--; - - return Plugin_Continue; - } else { + pTimeLeft[index]--; + ZR_HudHint(index, "Spawn Protect", pTimeLeft[index]); + + if (pTimeLeft[index] <= 0) + { pProtect[index] = false; if (IsPlayerHuman(index)) { - ZR_PrintCenterText(index, "Spawn protection end"); + ZR_HudHint(index, "Spawn protection end"); + SetPlayerAlpha(index, 255); + SetPlayerSpeed(index, 300.0); } - - SetPlayerAlpha(index, 255); - SetPlayerSpeed(index, 300.0); tHandles[index][TPROTECT] = INVALID_HANDLE; return Plugin_Stop; } -} - -ProtectionAbort(client) -{ - if (tHandles[client][TPROTECT] != INVALID_HANDLE) - { - KillTimer(tHandles[client][TPROTECT]); - tHandles[client][TPROTECT] = INVALID_HANDLE; - } - if (!IsClientInGame(client)) - { - return; - } - - pProtect[client] = false; - - SetPlayerAlpha(client, 255); - SetPlayerSpeed(client, 300.0); + return Plugin_Continue; } RespawnPlayer(client) @@ -916,7 +901,6 @@ RespawnPlayer(client) if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client]) { - ProtectionAbort(client); Zombify(client, 0); gKilledByWorld[client] = false; } diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 289bd37..c67de14 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -72,18 +72,18 @@ new bool:gKilledByWorld[MAXPLAYERS+1] = {false, ...}; new pClass[MAXPLAYERS+1]; new pNextClass[MAXPLAYERS+1]; -new protCount[MAXPLAYERS+1]; +new pTimeLeft[MAXPLAYERS+1]; -new Float:spawnLoc[MAXPLAYERS + 1][3]; -new Float:bufferLoc[MAXPLAYERS + 1][3]; -new bool:ztele_spawned[MAXPLAYERS + 1] = {false, ...}; -new bool:bufferLocSaved[MAXPLAYERS + 1] = {false, ...}; -new ztele_countdown[MAXPLAYERS + 1] = {-1, ...}; -new ztele_count[MAXPLAYERS + 1]; +new Float:spawnLoc[MAXPLAYERS+1][3]; +new Float:bufferLoc[MAXPLAYERS+1][3]; +new bool:ztele_spawned[MAXPLAYERS+1] = {false, ...}; +new bool:bufferLocSaved[MAXPLAYERS+1] = {false, ...}; +new ztele_countdown[MAXPLAYERS+1] = {-1, ...}; +new ztele_count[MAXPLAYERS+1]; new bool:ztele_online = false; new Handle:ztele_startup_timer = INVALID_HANDLE; -new Handle:ztele_countdown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; -new Handle:ztele_cooldown_timer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; +new Handle:ztele_countdown_timer[MAXPLAYERS+1] = {INVALID_HANDLE, ...}; +new Handle:ztele_cooldown_timer[MAXPLAYERS+1] = {INVALID_HANDLE, ...}; new maxclients; From a8a4f4fbb0ffe56f71df71b67c1f6fc80fd760b5 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 30 Mar 2009 00:35:51 +0200 Subject: [PATCH 5/8] Changed all CloseHandle's on timers to KillTimer() --- src/zr/event.inc | 16 ++++++++-------- src/zr/zombie.inc | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/zr/event.inc b/src/zr/event.inc index 88fa80a..bcc9cad 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -38,13 +38,13 @@ public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast) if (tRound != INVALID_HANDLE) { - CloseHandle(tRound); + KillTimer(tRound); tRound = INVALID_HANDLE; } if (tInfect != INVALID_HANDLE) { - CloseHandle(tInfect); + KillTimer(tInfect); tInfect = INVALID_HANDLE; } @@ -57,7 +57,7 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca if (tRound != INVALID_HANDLE) { - CloseHandle(tRound); + KillTimer(tRound); } new Float:roundlen = GetConVarFloat(FindConVar("mp_roundtime")) * 60.0; @@ -65,7 +65,7 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca if (tInfect != INVALID_HANDLE) { - CloseHandle(tInfect); + KillTimer(tInfect); } new Float:min = GetConVarFloat(gCvars[CVAR_SPAWN_MIN]); @@ -81,13 +81,13 @@ public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast) { if (tRound != INVALID_HANDLE) { - CloseHandle(tRound); + KillTimer(tRound); tRound = INVALID_HANDLE; } if (tInfect != INVALID_HANDLE) { - CloseHandle(tInfect); + KillTimer(tInfect); tInfect = INVALID_HANDLE; } @@ -156,7 +156,7 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) if (tHandles[index][x] != INVALID_HANDLE) { - CloseHandle(tHandles[index][x]); + KillTimer(tHandles[index][x]); tHandles[index][x] = INVALID_HANDLE; } } @@ -224,7 +224,7 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) if (tHandles[index][TPROTECT] != INVALID_HANDLE) { - CloseHandle(tHandles[index][TPROTECT]); + KillTimer(tHandles[index][TPROTECT]); } pTimeLeft[index] = protect; diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index 9be63f9..cf09259 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -200,7 +200,7 @@ Zombify_Mother(client) { if (tHandles[client][TMOAN] != INVALID_HANDLE) { - CloseHandle(tHandles[client][TMOAN]); + KillTimer(tHandles[client][TMOAN]); } tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT); } @@ -209,13 +209,13 @@ Zombify_Mother(client) { pProtect[client] = false; - CloseHandle(tHandles[client][TPROTECT]); + KillTimer(tHandles[client][TPROTECT]); tHandles[client][TPROTECT] = INVALID_HANDLE; } if (tHandles[client][TZHP] != INVALID_HANDLE) { - CloseHandle(tHandles[client][TZHP]); + KillTimer(tHandles[client][TZHP]); tHandles[client][TZHP] = INVALID_HANDLE; } @@ -281,7 +281,7 @@ Zombify(client, attacker) { if (tHandles[client][TMOAN] != INVALID_HANDLE) { - CloseHandle(tHandles[client][TMOAN]); + KillTimer(tHandles[client][TMOAN]); } tHandles[client][TMOAN] = CreateTimer(interval, ZombieMoanTimer, client, TIMER_REPEAT); } @@ -290,13 +290,13 @@ Zombify(client, attacker) { pProtect[client] = false; - CloseHandle(tHandles[client][TPROTECT]); + KillTimer(tHandles[client][TPROTECT]); tHandles[client][TPROTECT] = INVALID_HANDLE; } if (tHandles[client][TZHP] != INVALID_HANDLE) { - CloseHandle(tHandles[client][TZHP]); + KillTimer(tHandles[client][TZHP]); tHandles[client][TZHP] = INVALID_HANDLE; } From 965de0e697c6e261efe7a5176f6680207d489d8d Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 30 Mar 2009 00:36:58 +0200 Subject: [PATCH 6/8] New translations to go with last few commits --- .../translations/zombiereloaded.phrases.txt | 180 +++++++++++++++++- 1 file changed, 174 insertions(+), 6 deletions(-) diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index 4a27ea9..3bd8206 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -1,4 +1,4 @@ -"Phrases" +"Phrases" { // =========================== // Chat Messages @@ -41,6 +41,12 @@ "ru" "Данная функция отключена." } + "Must be admin" + { + "en" "Can only be used by admins." + "ru" "Может быть использовано только, когда жив." + } + "Must be alive" { "en" "Can only be used when alive." @@ -81,7 +87,7 @@ "Spawn protection end" { - "en" "You are now susceptible the zombie infection." + "en" "You are now susceptible to zombie infection." "ru" "Теперь вы восприимчивы к зомби инфекции." } @@ -227,13 +233,13 @@ "Unfair camping" { - "en" "This area is marked as unfair. Move, go through or die..." + "en" "An admin has marked this area as unfair, please move along, or die." } "Unfair camper slayed" { - "#format" "{1:s},{2:d}" - "en" "Killed %s due to camping in a unfair area (id: %d)." + "#format" "{1:s},{2:d}" + "en" "Player {1} has been slayed for camping in a restricted area. (ID: {2})" } "DX90 not supported" @@ -259,6 +265,11 @@ "ru" "ZMenu (!zmenu) - Показывает все ZR команды" } + "!zmenu admin" + { + "en" "ZAdmin (!zadmin) - View Admin Menu" + } + "!zmenu class" { "en" "ZClass (!zclass) - Select a zombie class" @@ -312,7 +323,158 @@ "en" "Rebuy" "ru" "Купить снова" } - + + // =========================== + // ZAdmin Menu + // =========================== + + "!zadmin main title" + { + "en" "ZAdmin Menu:" + } + + "!zadmin main knockbackm" + { + "en" "Modify Knockback Multiplier" + } + + "!zadmin main knockback" + { + "en" "Modify Class Knockback" + } + + "!zadmin main nvgs" + { + "en" "Modify Nightvision Options" + } + + "!zadmin main infect" + { + "en" "Infect a Player" + } + + "!zadmin main spawn" + { + "en" "Spawn All Players" + } + + "!zadmin main tele" + { + "en" "ZTele Commands" + } + + "!zadmin main restrict" + { + "en" "Restrict Weapon" + } + + "!zadmin main unrestrict" + { + "en" "Unrestrict Weapon" + } + + "!zadmin main logflags" + { + "en" "Logging Flags" + } + + "!zadmin class title" + { + "en" "Select Class to Modify:" + } + + "!zadmin knockbackm title" + { + "#format" "{1:f}" + "en" "Modify Knockback Multiplier\nCurrent Knockback: {1}" + } + + "!zadmin knockbackm increase" + { + "en" "Increase Knockback Multiplier" + } + + "!zadmin knockbackm decrease" + { + "en" "Decrease Knockback Multiplier" + } + + "!zadmin knockback title" + { + "#format" "{1:s},{2:f}" + "en" "Modify Knockback\nClass: {1}\nCurrent Knockback: {2}" + } + + "!zadmin knockback increase" + { + "en" "Increase Knockback" + } + + "!zadmin knockback decrease" + { + "en" "Decrease Knockback" + } + + "!zadmin nvgs title" + { + "#format" "{1:d}" + "en" "Override NVG Cvar\nCurrent Setting: {1}" + } + + "!zadmin nvgs decrease" + { + "en" "Decrease Knockback" + } + + "!zadmin nvgs no override" + { + "en" "No Override/Class Specific" + } + + "!zadmin nvgs disable" + { + "en" "Disable NVGs" + } + + "!zadmin nvgs enable" + { + "en" "Enable NVGs" + } + + "!zadmin infect title" + { + "en" "Choose a Player to Infect:" + } + + "!zadmin ztele title" + { + "en" "ZTele Admin Menu:" + } + + "!zadmin ztele spawn tele" + { + "en" "Teleport a Player to Spawn" + } + + "!zadmin ztele abort" + { + "en" "Abort Teleport on a Player" + } + + "!zadmin ztele save" + { + "en" "Save Teleport Location" + } + + "!zadmin ztele tele" + { + "en" "Teleport Player to Saved Location" + } + + "!zadmin log flags title" + { + "en" "Toggle Logging Flags:" + } // =========================== // HudHints @@ -325,6 +487,12 @@ "ru" "Здоровье: {1}" } + "Spawn Protect" + { + "#format" "{1:d}" + "en" "Zombie protection ends in: {1} seconds." + } + // =========================== // Server Messages // =========================== From 1dc1f5cefeea270bfad5de78bd457ca9be04dd47 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 30 Mar 2009 21:40:56 +0200 Subject: [PATCH 7/8] Improved knockback, renamed ZTele function, changed ZStuck to reset velocity, modified velocity changing function, removed unneeded offset (basevelocity) --- src/zr/cvars.inc | 2 ++ src/zr/event.inc | 25 +++++++++++++++++++------ src/zr/offsets.inc | 45 ++++++++++++++++++++++++++++++++++++--------- src/zr/sayhooks.inc | 9 +++++++-- src/zr/teleport.inc | 2 +- src/zr/zombie.inc | 12 +++++++----- 6 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 2a2a363..96fe4d7 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -26,6 +26,7 @@ enum ZRSettings Handle:CVAR_ZOMBIE_JUMP_DISTANCE, Handle:CVAR_ZOMBIE_JUMP_HEIGHT, Handle:CVAR_ZOMBIE_KNOCKBACK, + Handle:CVAR_ZOMBIE_KNOCKBACK_GRENADE, Handle:CVAR_ZOMBIE_NVGS, Handle:CVAR_ZOMBIE_FOV, Handle:CVAR_ZOMBIE_REGEN, @@ -111,6 +112,7 @@ CreateCvars() gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)"); gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)"); gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "1", "How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values (1: Default)"); + gCvars[CVAR_ZOMBIE_KNOCKBACK_GRENADE] = CreateConVar("zr_zombie_knockback_grenade", "4.0", "Knockback multiplier when a grenade inflicts damage on a zombie. (4.0: Default)"); gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override, uses class setting, 0: No nvgs, 1: Nvgs on)"); gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)"); gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health"); diff --git a/src/zr/event.inc b/src/zr/event.inc index bcc9cad..a307a02 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -304,18 +304,21 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) if (!StrEqual(weapon, "hegrenade")) { - GetClientAbsOrigin(attacker, attackerloc); + GetPlayerEyePosition(attacker, attackerloc); - new bool:shotgun = (StrEqual(weapon, "m3") || StrEqual(weapon, "xm1014")); + new Float:attackerang[3]; + GetPlayerEyeAngles(attacker, attackerang); - KnockBack(index, clientloc, attackerloc, knockback, dmg, shotgun); + TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, TraceRayFilter); + TR_GetEndPosition(clientloc); + + KnockBack(index, clientloc, attackerloc, knockback, dmg, false); } else { - new Float:heLoc[3]; - FindExplodingGrenade(heLoc); + FindExplodingGrenade(attackerloc); - KnockBack(index, clientloc, heLoc, knockback, dmg, true); + KnockBack(index, clientloc, attackerloc, knockback, dmg, true); } } } @@ -360,6 +363,16 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) UpdateAlphaDamaged(index); } +public bool:TraceRayFilter(entity, contentsMask) +{ + if (entity > 0 && entity < MAXPLAYERS) + { + return false; + } + + return true; +} + FindExplodingGrenade(Float:heLoc[3]) { decl String:classname[64]; diff --git a/src/zr/offsets.inc b/src/zr/offsets.inc index 73aa1dd..42e7675 100644 --- a/src/zr/offsets.inc +++ b/src/zr/offsets.inc @@ -6,7 +6,6 @@ * ==================== */ -new offsBaseVelocity; new offsGetVelocity0; new offsGetVelocity1; new offsGetVelocity2; @@ -23,15 +22,11 @@ new offsRender; new Handle:g_hGameConf = INVALID_HANDLE; new Handle:g_hRemoveAllItems = INVALID_HANDLE; new Handle:g_hTerminateRound = INVALID_HANDLE; +new Handle:g_hEyePosition = INVALID_HANDLE; +new Handle:g_hEyeAngles = INVALID_HANDLE; FindOffsets() { - offsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity"); - if (offsBaseVelocity == -1) - { - SetFailState("Couldn't find \"m_vecBaseVelocity\"!"); - } - offsGetVelocity0 = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]"); if (offsGetVelocity0 == -1) { @@ -111,6 +106,16 @@ SetupGameData() PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "RemoveAllItems"); g_hRemoveAllItems = EndPrepSDKCall(); + StartPrepSDKCall(SDKCall_Player); + PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyePosition"); + PrepSDKCall_SetReturnInfo(SDKType_QAngle, SDKPass_ByValue); + g_hEyePosition = EndPrepSDKCall(); + + StartPrepSDKCall(SDKCall_Player); + PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyeAngles"); + PrepSDKCall_SetReturnInfo(SDKType_QAngle, SDKPass_ByValue); + g_hEyeAngles = EndPrepSDKCall(); + StartPrepSDKCall(SDKCall_GameRules); PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Signature, "TerminateRound"); PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain); @@ -118,9 +123,21 @@ SetupGameData() g_hTerminateRound = EndPrepSDKCall(); } -SetPlayerVelocity(client, const Float:vec[3]) +SetPlayerVelocity(client, const Float:vec[3], bool:reset) { - SetEntDataVector(client, offsBaseVelocity, vec, true); + if (reset) + { + TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vec); + } + else + { + new Float:fVelocity[3]; + GetPlayerVelocity(client, fVelocity); + + AddVectors(vec, fVelocity, fVelocity); + + TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity); + } } GetPlayerVelocity(client, Float:vel[3]) @@ -190,6 +207,16 @@ RemoveAllPlayersWeapons(client) SDKCall(g_hRemoveAllItems, client); } +GetPlayerEyePosition(client, Float:vec[3]) +{ + SDKCall(g_hEyePosition, client, vec); +} + +GetPlayerEyeAngles(client, Float:ang[3]) +{ + SDKCall(g_hEyeAngles, client, ang); +} + TerminateRound(Float:delay, reason) { if (g_hTerminateRound == INVALID_HANDLE) return; diff --git a/src/zr/sayhooks.inc b/src/zr/sayhooks.inc index 0774a06..3f867f8 100644 --- a/src/zr/sayhooks.inc +++ b/src/zr/sayhooks.inc @@ -30,6 +30,11 @@ public Action:SayCommand(client, argc) MainMenu(client); } + if (StrEqual(args, "!zadmin", false)) + { + ZRAdminMenu(client); + } + else if (StrEqual(args, "!zclass", false)) { ZClass(client); @@ -50,7 +55,7 @@ public Action:SayCommand(client, argc) StrEqual(args, "!tele", false) || StrEqual(args, "!teleport", false)) { - ZTeleClientCheck(client); + ZTele(client); } else if (StrEqual(args, "!teleabort", false)) @@ -268,7 +273,7 @@ ZStuck(client) nudge[0] = x; nudge[1] = y; - SetPlayerVelocity(client, nudge); + SetPlayerVelocity(client, nudge, true); } public Action:CollisionOn(Handle:timer, any:index) diff --git a/src/zr/teleport.inc b/src/zr/teleport.inc index e62ee2c..8561ccf 100644 --- a/src/zr/teleport.inc +++ b/src/zr/teleport.inc @@ -333,7 +333,7 @@ public Action:Command_TeleportAbort(client, argc) return Plugin_Handled; } -bool:ZTeleClientCheck(client) +bool:ZTele(client) { // Check if the teleporter is disabled. new bool:tele = GetConVarBool(gCvars[CVAR_ZTELE]); diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index cf09259..c1c5808 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -428,7 +428,7 @@ ApplyZombieAlpha(client) SetPlayerAlpha(client, alpha); } -KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:power, dmg, bool:boost) +KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:power, dmg, bool:grenade) { if (!IsPlayerZombie(client)) { @@ -438,18 +438,20 @@ KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:po new Float:vector[3]; MakeVectorFromPoints(attackerloc, clientloc, vector); + NormalizeVector(vector, vector); vector[0] *= power * (float(dmg) * 1.5); vector[1] *= power * (float(dmg) * 1.5); vector[2] *= power * (float(dmg) * 1.5); - if (boost) + if (grenade) { - ScaleVector(vector, 4.0); + new Float:knockback_grenade = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK_GRENADE]); + ScaleVector(vector, knockback_grenade); } - SetPlayerVelocity(client, vector); + SetPlayerVelocity(client, vector, false); } JumpBoost(client, Float:distance, Float:height) @@ -462,7 +464,7 @@ JumpBoost(client, Float:distance, Float:height) vel[1] *= distance; vel[2] = height; - SetPlayerVelocity(client, vel); + SetPlayerVelocity(client, vel, false); } PlayerLeft(client) From 53f1909966e8433d506538bf38faed6054bc919a Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 30 Mar 2009 22:40:12 +0200 Subject: [PATCH 8/8] Added more increase/decrease options in knockback(mult) admin menu --- .../translations/zombiereloaded.phrases.txt | 12 +++-- src/zr/zadmin.inc | 54 ++++++++++++++----- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index 3bd8206..4674b0a 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -391,12 +391,14 @@ "!zadmin knockbackm increase" { - "en" "Increase Knockback Multiplier" + "#format" "{1:s}" + "en" "Increase Knockback Multiplier (+{1})" } "!zadmin knockbackm decrease" { - "en" "Decrease Knockback Multiplier" + "#format" "{1:s}" + "en" "Decrease Knockback Multiplier (-{1})" } "!zadmin knockback title" @@ -407,12 +409,14 @@ "!zadmin knockback increase" { - "en" "Increase Knockback" + "#format" "{1:s}" + "en" "Increase Knockback (+{1})" } "!zadmin knockback decrease" { - "en" "Decrease Knockback" + "#format" "{1:s}" + "en" "Decrease Knockback (-{1})" } "!zadmin nvgs title" diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index dce330f..cb5f8f7 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -128,14 +128,20 @@ ZRKnockbackMMenu(client) SetMenuTitle(menu_knockbackm, "%t\n ", "!zadmin knockbackm title", curknockback); - decl String:knockbackmincrease[64]; - decl String:knockbackmdecrease[64]; + decl String:knockbackmincrease1[64]; + decl String:knockbackmdecrease1[64]; + decl String:knockbackmincrease2[64]; + decl String:knockbackmdecrease2[64]; - Format(knockbackmincrease, sizeof(knockbackmincrease), "%t", "!zadmin knockbackm increase"); - Format(knockbackmdecrease, sizeof(knockbackmdecrease), "%t", "!zadmin knockbackm decrease"); + Format(knockbackmincrease1, sizeof(knockbackmincrease1), "%t", "!zadmin knockbackm increase", "0.1"); + Format(knockbackmdecrease1, sizeof(knockbackmdecrease1), "%t", "!zadmin knockbackm decrease", "0.1"); + Format(knockbackmincrease2, sizeof(knockbackmincrease2), "%t", "!zadmin knockbackm increase", "0.5"); + Format(knockbackmdecrease2, sizeof(knockbackmdecrease2), "%t", "!zadmin knockbackm decrease", "0.5"); - AddMenuItem(menu_knockbackm, "knockbackmincrease", knockbackmincrease); - AddMenuItem(menu_knockbackm, "knockbackmdecrease", knockbackmdecrease); + AddMenuItem(menu_knockbackm, "knockbackmincrease1", knockbackmincrease1); + AddMenuItem(menu_knockbackm, "knockbackmdecrease1", knockbackmdecrease1); + AddMenuItem(menu_knockbackm, "knockbackmincrease2", knockbackmincrease2); + AddMenuItem(menu_knockbackm, "knockbackmdecrease2", knockbackmdecrease2); SetMenuExitBackButton(menu_knockbackm, true); @@ -158,6 +164,16 @@ public ZRKnockbackMHandle(Handle:menu_knockbackm, MenuAction:action, client, slo AddToKnockbackMultiplier(-0.1); ZRKnockbackMMenu(client); } + case 2: + { + AddToKnockbackMultiplier(0.5); + ZRKnockbackMMenu(client); + } + case 3: + { + AddToKnockbackMultiplier(-0.5); + ZRKnockbackMMenu(client); + } } } if (action == MenuAction_Cancel) @@ -224,14 +240,20 @@ ZRClassKnockbackMenu(client, classindex) SetMenuTitle(menu_knockback, "%t\n ", "!zadmin knockback title", classname, curknockback); - decl String:knockbackincrease[64]; - decl String:knockbackdecrease[64]; + decl String:knockbackincrease1[64]; + decl String:knockbackdecrease1[64]; + decl String:knockbackincrease2[64]; + decl String:knockbackdecrease2[64]; - Format(knockbackincrease, sizeof(knockbackincrease), "%t", "!zadmin knockback increase"); - Format(knockbackdecrease, sizeof(knockbackdecrease), "%t", "!zadmin knockback decrease"); + Format(knockbackincrease1, sizeof(knockbackincrease1), "%t", "!zadmin knockback increase", "0.1"); + Format(knockbackdecrease1, sizeof(knockbackdecrease1), "%t", "!zadmin knockback decrease", "0.1"); + Format(knockbackincrease2, sizeof(knockbackincrease2), "%t", "!zadmin knockback increase", "0.5"); + Format(knockbackdecrease2, sizeof(knockbackdecrease2), "%t", "!zadmin knockback decrease", "0.5"); - AddMenuItem(menu_knockback, "knockbackincrease", knockbackincrease); - AddMenuItem(menu_knockback, "knockbackdecrease", knockbackdecrease); + AddMenuItem(menu_knockback, "knockbackincrease1", knockbackincrease1); + AddMenuItem(menu_knockback, "knockbackdecrease1", knockbackdecrease1); + AddMenuItem(menu_knockback, "knockbackincrease2", knockbackincrease2); + AddMenuItem(menu_knockback, "knockbackdecrease2", knockbackdecrease2); SetMenuExitBackButton(menu_knockback, true); @@ -252,6 +274,14 @@ public ZRClassKnockbackHandle(Handle:menu_knockback, MenuAction:action, client, { AddToClassKnockback(curMenuClass[client], -0.1); } + case 2: + { + AddToClassKnockback(curMenuClass[client], 0.5); + } + case 3: + { + AddToClassKnockback(curMenuClass[client], -0.5); + } } ZRClassKnockbackMenu(client, curMenuClass[client]);