diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index 6769017..4d5dbf3 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -285,6 +285,17 @@ "en" "Modify Restrictions:\n Current Weapon Group: {1}\n * = restricted" } + "Weapons menu market title" + { + "en" "Toggle Market Settings:" + } + + "Weapons menu market toggle buyzone" + { + "#format" "{1:s}" + "en" "Buyzone Only (Current: {1})" + } + "Weapons menu weapon group restrict all" { "en" "Restrict All Group Weapons" diff --git a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg index 77203e5..05bb6a2 100644 --- a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg +++ b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg @@ -1,442 +1,436 @@ -// ============================================================================ -// -// Zombie:Reloaded -// Main configuration -// -// Check section 3.0 in the manual for detailed info. -// -// ============================================================================ - -// ------------------------------------ -// -// Standard Counter-Strike Settings -// -// ------------------------------------ - -// The length of the round, in minutes. If there are any humans left after this -// time is up, humans win. -// - -// Default: "5" -mp_roundtime "5" - -// Allows players to move items with their "use" key. Disabled by default -// because players sometimes get stuck. -// - -// Default: "0" -sv_turbophysics "0" - -// Multiplier for how easy props are moved. -// - -// Default: "3" -phys_pushscale 3 - -// Ammo settings -ammo_50AE_max 500 // deagle -ammo_762mm_max 300 // scout, ak47, g3sg1, aug -ammo_556mm_box_max 300 // m249 -ammo_556mm_max 300 // galil, sg552, famas, m4a1, sg550 -ammo_338mag_max 100 // awp -ammo_9mm_max 500 // mp5navy, tmp, glock, elite -ammo_buckshot_max 128 // m3, xm1014 -ammo_45acp_max 500 // ump45, mac10, usp -ammo_357sig_max 500 // P228 -ammo_57mm_max 500 // p90, fiveseven - - -// ------------------------------------ -// -// Weapon Restrictions -// -// ------------------------------------ - -zr_restrict "flashbang" -zr_restrict "smokegrenade" -zr_restrict "m249" -zr_restrict "snipers" -zr_restrict "nvgs" - - -// ------------------------------------ -// -// General -// -// ------------------------------------ - -// Enable zombie gameplay -// - -// Default: "1" -zr_enable "1" - -// Logging flags. See manual for details. -// - +// ============================================================================ +// +// Zombie:Reloaded +// Main configuration +// +// Check section 3.0 in the manual for detailed info. +// +// ============================================================================ + +// ------------------------------------ +// +// Standard Counter-Strike Settings +// +// ------------------------------------ + +// The length of the round, in minutes. If there are any humans left after this +// time is up, humans win. +// - +// Default: "5" +mp_roundtime "5" + +// Allows players to move items with their "use" key. Disabled by default +// because players sometimes get stuck. +// - +// Default: "0" +sv_turbophysics "0" + +// Multiplier for how easy props are moved. +// - +// Default: "3" +phys_pushscale 3 + +// Ammo settings +ammo_50AE_max 500 // deagle +ammo_762mm_max 300 // scout, ak47, g3sg1, aug +ammo_556mm_box_max 300 // m249 +ammo_556mm_max 300 // galil, sg552, famas, m4a1, sg550 +ammo_338mag_max 100 // awp +ammo_9mm_max 500 // mp5navy, tmp, glock, elite +ammo_buckshot_max 128 // m3, xm1014 +ammo_45acp_max 500 // ump45, mac10, usp +ammo_357sig_max 500 // P228 +ammo_57mm_max 500 // p90, fiveseven + + +// ------------------------------------ +// +// Weapon Restrictions (Deprecated) +// +// ------------------------------------ + + +// ------------------------------------ +// +// General +// +// ------------------------------------ + +// Enable zombie gameplay +// - +// Default: "1" +zr_enable "1" + +// Logging flags. See manual for details. +// - // Default: "323" -zr_log "323" - -// This will allow the player_team event to be fired on first team join. Enable -// if using mani admin model menu. -// - -// Default: "0" -zr_allow_player_team "0" - -// Give players cash on spawn. -// - -// Default: "1" -zr_cashfill "1" - -// How much money players will have when they spawn, if cash fill is turned on. -// - -// Default: "16000" -zr_cashamount "16000" - +zr_log "323" + +// This will allow the player_team event to be fired on first team join. Enable +// if using mani admin model menu. +// - +// Default: "0" +zr_allow_player_team "0" + +// Give players cash on spawn. +// - +// Default: "1" +zr_cashfill "1" + +// How much money players will have when they spawn, if cash fill is turned on. +// - +// Default: "16000" +zr_cashamount "16000" + // Block suicide attempts on humans. // - // Default: "1" zr_suicide_human "1" - + // Block suicide attempts on zombies. // - // Default: "1" zr_suicide_zombie "1" - + // Log suicide attempts to admin chat. (Deprecated. Use the log system.) // - // Default: "0" zr_suicide_echo "0" -// Respawn zombies as zombies if they were killed by world damage, like doors, +// Respawn zombies as zombies if they were killed by world damage, like doors, // elevators and lasers. // - // Default: "1" zr_suicide_world_damage "1" - -// Spawn protection time on players that join late. -// - -// Default: "15" -zr_protect "15" - - -// ------------------------------------ -// -// Zombie Gameplay -// -// ------------------------------------ - -// Maximum time, in seconds, a player is picked to be zombie after the round -// starts. -// - -// Default: "50" -zr_spawn_max "50" - -// Minimum time, in seconds, a player is picked to be zombie after the round -// starts. -// - -// Default: "30" -zr_spawn_min "30" - -// Mother zombie ratio. For every "n" number of humans, there will be one -// zombie. (0: Always only 1 mother zombie) -// - -// Default: "8" -zr_mother_zombie_ratio "8" - -// The first zombie(s) will be teleported back to spawn on first infection. -// - -// Default: "0" -zr_mother_zombie_respawn "0" - -// Allow player to be randomly chosen twice in a row to be a mother zombie. -// - -// Default: "0" -zr_consecutive_infect "0" - - -// ------------------------------------ -// -// Zombie Info (deprecated) -// -// ------------------------------------ - -// The default health of a zombie -zr_zombie_health "5000" - -// How fast zombies travel (300: Default speed, 600: Double speed) -zr_zombie_speed "350" - -// How far the zombie jumps, (0: Regular jump distance) -zr_zombie_jump_distance "0.1" - -// How high a zombie jumps (0: Regular jump height) -zr_zombie_jump_height "10.0" - -// How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values. (1: Default) -zr_zombie_knockback "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) -zr_zombie_nvgs "-1" - -// The field of vision of zombies (90: Default vision) -zr_zombie_fov "110" - -// Zombies will regenerate health -zr_zombie_regen "0" - -// How much health is regenerated when zr_zombie_regen is 1 -zr_zombie_regen_health "1" - -// How often, in seconds, a zombie regenerates health when zr_zombie_regen is 1 -zr_zombie_regen_interval "5" - -// Turns grenades into napalm grenades that light zombies on fire (0: Disable) -zr_zombie_napalm "1" - -// How long the zombie burns when zr_napalm is 1 -zr_zombie_napalm_time "20" - -// Zombies wont be hurt from falling (0: Disable) -zr_zombie_nofalldamage "0" - -// How many additional kills are rewarded to the killer of the zombie -zr_zombie_kill_bonus "2" - -// How much health a zombie gains when infecting a human (0: Disable) -zr_zombie_infect_health "100" - -// Overlay to be shown on all zombies' screen on infection (Leave empty to disable) -zr_zombie_zvision "overlays/zr/zvision" - - -// ------------------------------------ -// -// Infection Effects -// -// ------------------------------------ - -// An energy splash is emitted when player is infected. -// - -// Default: "1" -zr_infect_esplash "1" - -// A fireball is created when a player is infected. -// - -// Default: "1" -zr_infect_fireball "1" - -// Sound played from from player on infection. Leave blank to disable. -// - -// Default: "npc/fast_zombie/fz_scream1.wav" -zr_infect_sound "npc/fast_zombie/fz_scream1.wav" - -// A puff of smoke is created when a player is infected. -// - -// Default: "1" -zr_infect_smoke "1" - -// Sparks are emitted when a player is infected. -// - -// Default: "1" -zr_infect_sparks "1" - -//Player's screen is shaken on infection. -// - -// Default: "1" -zr_infect_shake "1" - -// Amplitude of the shake, when shake is enabled. -// - -// Default: "15.0" -zr_infect_shake_amp "15.0" - -// Frequency of the shake, when shake is enabled. -// - -// Default: "1.0" -zr_infect_shake_frequency "1.0" - -// Duration of the shake, when shake is enabled. -// - -// Default: "5.0" -zr_infect_shake_duration "5.0" - - -// ------------------------------------ -// -// Classes -// -// ------------------------------------ - -// Enable zombie classes. (Deprecated) -zr_classes "1" - -// A random class is assigned to each player every round (0: Disable) -// - -// Default: "0" -zr_classes_random "0" - -// Classmenu is re-displayed every spawn (0: Disable) -// - -// Default: "0" -zr_classes_spawn "0" - -// The default class for zombies. (Deprecated) -zr_classes_default "classic" - - -// ------------------------------------ -// -// Ambience -// -// ------------------------------------ - -// Enable creepy ambience to be played throughout the game (0: Disable) -// - -// Default: "1" -zr_ambience "1" - -// Path to ambient sound file that will be played throughout the game, when -// ambience is enabled. -// - -// Default: "ambient/zr/zr_ambience.mp3" -zr_ambience_file "ambient/zr/zr_ambience.mp3" - -// The length, in seconds, of the ambience sound file. -// - -// Default: "60.0" -zr_ambience_length "60.0" - -// Volume of ambience sound when ambience is enabled. (0.0: Unhearable, -// 1.0: Max volume) -// - -// Default: "0.8" -zr_ambience_volume "0.8" - -// Make maps dark. (0: Disable) -// - -// Default: "0" -zr_dark "0" - -// The darkness of the map, a being the darkest, z being extremely bright. -// - -// Default: "n" -zr_dark_level "n" - -// The sky the map will have when darkness is enabled. -// - -// Default: "sky_borealis01" -zr_dark_sky "sky_borealis01" - -// How often a zombie emits a sound, in seconds. (0: Disable) -// - -// Default: "50" -zr_emitsounds "50" - - -// ------------------------------------ -// -// Overlays -// -// ------------------------------------ - -// Will show overlays that tell who the winner of the round was (0: Disable) -// - -// Default: "1" -zr_overlays "1" - -// Overlay for humans win event. -// - -// Default: "overlays/zr/humans_win" -zr_overlays_human "overlays/zr/humans_win" - -// Overlay for zombies win event. -// - -// Default: "overlays/zr/zombies_win" -zr_overlays_zombie "overlays/zr/zombies_win" - -// Frequency, in seconds, to re-display overlay on the client's screen. -// - -// Default: "3" -zr_overlay_redisplay "3" - -// Allow players to disable overlays with their nightvision key (0: Disable) -// - -// Default: "1" -zr_zvision_allow_disable "1" - - -// ------------------------------------ -// -// Respawn -// -// ------------------------------------ - -// Respawn players when they die. -// - -// Default: "1" -zr_respawn "1" - -// How long to wait after death to respawn, in seconds. -// - -// Default: "1" -zr_respawn_delay "1" - -// Which team to respawn player as. (Choices: zombie, human) -// - -// Default: "human" -zr_respawn_team "human" - - -// ------------------------------------ -// -// Commands -// -// ------------------------------------ - -// Must be in buyzone to access !zmarket, if Market is installed. -// - -// Default: "1" -zr_zmarket_buyzone "1" - -// Allow players to spawn if they just joined the game. (0: Disable) -// - -// Default: "1" -zr_zspawn "1" - -// Startup delay for the deleporter. (0: Disable) -// - -// Default: "20" -zr_tele_startup_delay "20" - -// Cooldown delay before a teleport can be done again. (0: Disable) -// - -// Default: "15" -zr_tele_cooldown "15" - -// Teleport delays for humans. (0: Disable) -// - -// Default: "10" -zr_tele_human_delay "10" - -// Teleport delays for zombies. (0: Disable) -// - -// Default: "0" -zr_tele_zombie_delay "0" - -// Teleport limits for humans per round. (0: Not allowed to teleport, -// -1: Unlimited) -// - -// Default: "3" -zr_tele_human_limit "3" - -// Teleport limits for zombies per round. (0: Not allowed to teleport, -// -1: Unlimited) -// - -// Default: "8" -zr_tele_zombie_limit "8" - -// Allows clients to disable zombie health display. -// - -// Default: "1" -zr_zhp "1" - -// The default value of zombie health display to new clients. -// - -// Default: "1" -zr_zhp_default "1" + +// Spawn protection time on players that join late. +// - +// Default: "15" +zr_protect "15" + + +// ------------------------------------ +// +// Zombie Gameplay +// +// ------------------------------------ + +// Maximum time, in seconds, a player is picked to be zombie after the round +// starts. +// - +// Default: "50" +zr_spawn_max "50" + +// Minimum time, in seconds, a player is picked to be zombie after the round +// starts. +// - +// Default: "30" +zr_spawn_min "30" + +// Mother zombie ratio. For every "n" number of humans, there will be one +// zombie. (0: Always only 1 mother zombie) +// - +// Default: "8" +zr_mother_zombie_ratio "8" + +// The first zombie(s) will be teleported back to spawn on first infection. +// - +// Default: "0" +zr_mother_zombie_respawn "0" + +// Allow player to be randomly chosen twice in a row to be a mother zombie. +// - +// Default: "0" +zr_consecutive_infect "0" + + +// ------------------------------------ +// +// Zombie Info (deprecated) +// +// ------------------------------------ + +// The default health of a zombie +zr_zombie_health "5000" + +// How fast zombies travel (300: Default speed, 600: Double speed) +zr_zombie_speed "350" + +// How far the zombie jumps, (0: Regular jump distance) +zr_zombie_jump_distance "0.1" + +// How high a zombie jumps (0: Regular jump height) +zr_zombie_jump_height "10.0" + +// How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values. (1: Default) +zr_zombie_knockback "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) +zr_zombie_nvgs "-1" + +// The field of vision of zombies (90: Default vision) +zr_zombie_fov "110" + +// Zombies will regenerate health +zr_zombie_regen "0" + +// How much health is regenerated when zr_zombie_regen is 1 +zr_zombie_regen_health "1" + +// How often, in seconds, a zombie regenerates health when zr_zombie_regen is 1 +zr_zombie_regen_interval "5" + +// Turns grenades into napalm grenades that light zombies on fire (0: Disable) +zr_zombie_napalm "1" + +// How long the zombie burns when zr_napalm is 1 +zr_zombie_napalm_time "20" + +// Zombies wont be hurt from falling (0: Disable) +zr_zombie_nofalldamage "0" + +// How many additional kills are rewarded to the killer of the zombie +zr_zombie_kill_bonus "2" + +// How much health a zombie gains when infecting a human (0: Disable) +zr_zombie_infect_health "100" + +// Overlay to be shown on all zombies' screen on infection (Leave empty to disable) +zr_zombie_zvision "overlays/zr/zvision" + + +// ------------------------------------ +// +// Infection Effects +// +// ------------------------------------ + +// An energy splash is emitted when player is infected. +// - +// Default: "1" +zr_infect_esplash "1" + +// A fireball is created when a player is infected. +// - +// Default: "1" +zr_infect_fireball "1" + +// Sound played from from player on infection. Leave blank to disable. +// - +// Default: "npc/fast_zombie/fz_scream1.wav" +zr_infect_sound "npc/fast_zombie/fz_scream1.wav" + +// A puff of smoke is created when a player is infected. +// - +// Default: "1" +zr_infect_smoke "1" + +// Sparks are emitted when a player is infected. +// - +// Default: "1" +zr_infect_sparks "1" + +//Player's screen is shaken on infection. +// - +// Default: "1" +zr_infect_shake "1" + +// Amplitude of the shake, when shake is enabled. +// - +// Default: "15.0" +zr_infect_shake_amp "15.0" + +// Frequency of the shake, when shake is enabled. +// - +// Default: "1.0" +zr_infect_shake_frequency "1.0" + +// Duration of the shake, when shake is enabled. +// - +// Default: "5.0" +zr_infect_shake_duration "5.0" + + +// ------------------------------------ +// +// Classes +// +// ------------------------------------ + +// Enable zombie classes. (Deprecated) +zr_classes "1" + +// A random class is assigned to each player every round (0: Disable) +// - +// Default: "0" +zr_classes_random "0" + +// Classmenu is re-displayed every spawn (0: Disable) +// - +// Default: "0" +zr_classes_spawn "0" + +// The default class for zombies. (Deprecated) +zr_classes_default "classic" + + +// ------------------------------------ +// +// Ambience +// +// ------------------------------------ + +// Enable creepy ambience to be played throughout the game (0: Disable) +// - +// Default: "1" +zr_ambience "1" + +// Path to ambient sound file that will be played throughout the game, when +// ambience is enabled. +// - +// Default: "ambient/zr/zr_ambience.mp3" +zr_ambience_file "ambient/zr/zr_ambience.mp3" + +// The length, in seconds, of the ambience sound file. +// - +// Default: "60.0" +zr_ambience_length "60.0" + +// Volume of ambience sound when ambience is enabled. (0.0: Unhearable, +// 1.0: Max volume) +// - +// Default: "0.8" +zr_ambience_volume "0.8" + +// Make maps dark. (0: Disable) +// - +// Default: "0" +zr_dark "0" + +// The darkness of the map, a being the darkest, z being extremely bright. +// - +// Default: "n" +zr_dark_level "n" + +// The sky the map will have when darkness is enabled. +// - +// Default: "sky_borealis01" +zr_dark_sky "sky_borealis01" + +// How often a zombie emits a sound, in seconds. (0: Disable) +// - +// Default: "50" +zr_emitsounds "50" + + +// ------------------------------------ +// +// Overlays +// +// ------------------------------------ + +// Will show overlays that tell who the winner of the round was (0: Disable) +// - +// Default: "1" +zr_overlays "1" + +// Overlay for humans win event. +// - +// Default: "overlays/zr/humans_win" +zr_overlays_human "overlays/zr/humans_win" + +// Overlay for zombies win event. +// - +// Default: "overlays/zr/zombies_win" +zr_overlays_zombie "overlays/zr/zombies_win" + +// Frequency, in seconds, to re-display overlay on the client's screen. +// - +// Default: "3" +zr_overlay_redisplay "3" + +// Allow players to disable overlays with their nightvision key (0: Disable) +// - +// Default: "1" +zr_zvision_allow_disable "1" + + +// ------------------------------------ +// +// Respawn +// +// ------------------------------------ + +// Respawn players when they die. +// - +// Default: "1" +zr_respawn "1" + +// How long to wait after death to respawn, in seconds. +// - +// Default: "1" +zr_respawn_delay "1" + +// Which team to respawn player as. (Choices: zombie, human) +// - +// Default: "human" +zr_respawn_team "human" + + +// ------------------------------------ +// +// Commands +// +// ------------------------------------ + +// Must be in buyzone to access !zmarket, if Market is installed. +// - +// Default: "1" +zr_zmarket_buyzone "1" + +// Allow players to spawn if they just joined the game. (0: Disable) +// - +// Default: "1" +zr_zspawn "1" + +// Startup delay for the deleporter. (0: Disable) +// - +// Default: "20" +zr_tele_startup_delay "20" + +// Cooldown delay before a teleport can be done again. (0: Disable) +// - +// Default: "15" +zr_tele_cooldown "15" + +// Teleport delays for humans. (0: Disable) +// - +// Default: "10" +zr_tele_human_delay "10" + +// Teleport delays for zombies. (0: Disable) +// - +// Default: "0" +zr_tele_zombie_delay "0" + +// Teleport limits for humans per round. (0: Not allowed to teleport, +// -1: Unlimited) +// - +// Default: "3" +zr_tele_human_limit "3" + +// Teleport limits for zombies per round. (0: Not allowed to teleport, +// -1: Unlimited) +// - +// Default: "8" +zr_tele_zombie_limit "8" + +// Allows clients to disable zombie health display. +// - +// Default: "1" +zr_zhp "1" + +// The default value of zombie health display to new clients. +// - +// Default: "1" +zr_zhp_default "1" diff --git a/src/zr/weapons/menu_weapons.inc b/src/zr/weapons/menu_weapons.inc index 9d1cccf..f543488 100644 --- a/src/zr/weapons/menu_weapons.inc +++ b/src/zr/weapons/menu_weapons.inc @@ -40,7 +40,6 @@ WeaponsMenuMain(client) decl String:toggleweaponrestriction[64]; decl String:togglewgrouprestriction[64]; - decl String:zmarket[64]; Format(toggleweaponrestriction, sizeof(toggleweaponrestriction), "%t", "Weapons menu main toggle weapon restrict"); @@ -91,7 +90,7 @@ public WeaponsMenuMainHandle(Handle:menu_weapons_main, MenuAction:action, client } case 2: { - //WeaponsMenuMarket(client); + WeaponsMenuMarket(client); } } } @@ -142,8 +141,6 @@ WeaponsMenuWeapons(client, WeaponsMenu:type) { GetArrayString(arrayWeapons, x, weapon, sizeof(weapon)); - new bool:menu = WeaponsIsWeaponMenu(weapon); - strcopy(display, sizeof(display), weapon); if (RestrictIsWeaponRestricted(weapon)) @@ -152,6 +149,8 @@ WeaponsMenuWeapons(client, WeaponsMenu:type) } // If weapon restriction is blocked for the menu, disable option + new bool:menu = WeaponsIsWeaponMenu(weapon); + if (menu) { AddMenuItem(menu_weapons_weapons, weapon, display); @@ -387,4 +386,79 @@ public WeaponsMenuWeaponGroupHandle(Handle:menu_weapons_groupweapon, MenuAction: { CloseHandle(menu_weapons_groupweapon); } +} + +/** + * Sends market options menu to client. + * @param client The client index. + */ +WeaponsMenuMarket(client) +{ + // Create menu handle + new Handle:menu_weapons_market = CreateMenu(WeaponsMenuMarketHandle); + + SetGlobalTransTarget(client); + + SetMenuTitle(menu_weapons_market, "%t\n ", "Weapons menu market title"); + + decl String:togglebuyzone[64]; + + decl String:curSetting[8]; + BoolToConfigOption(GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]), curSetting, sizeof(curSetting)); + + Format(togglebuyzone, sizeof(togglebuyzone), "%t", "Weapons menu market toggle buyzone", curSetting); + + AddMenuItem(menu_weapons_market, "togglebuyzone", togglebuyzone); + + // Create a "Back" button to the weapons main menu + SetMenuExitBackButton(menu_weapons_market, true); + + // Send menu + DisplayMenu(menu_weapons_market, client, MENU_TIME_FOREVER); +} + +/** + * Called when client selects option in the weapons main menu, and handles it. + * @param menu_weapons_main Handle of the menu being used. + * @param action The action done on the menu (see menus.inc, enum MenuAction). + * @param client The client index. + * @param slot The slot index selected (starting from 0). + */ +public WeaponsMenuMarketHandle(Handle:menu_weapons_market, MenuAction:action, client, slot) +{ + // Client selected an option + if (action == MenuAction_Select) + { + switch(slot) + { + case 0: + { + if (GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE])) + { + SetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE], false); + } + else + { + SetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE], true); + } + } + } + + // Resend menu + WeaponsMenuMarket(client); + } + // Client closed the menu + if (action == MenuAction_Cancel) + { + // Client hit "Back" button + if (slot == MenuCancel_ExitBack) + { + WeaponsMenuMain(client); + } + } + // Client hit "Exit" button + else if (action == MenuAction_End) + { + CloseHandle(menu_weapons_market); + } } \ No newline at end of file diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index abbeaae..a30bade 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -70,9 +70,39 @@ RestrictOnMapStart() SetFailState("\"%s\" missing from server", path); } + RestrictDefaultRestrictions(); RestrictValidateWeaponGroups(); } +/** + * Restrict default restrictions (set in weapons.txt) + */ +RestrictDefaultRestrictions() +{ + KvRewind(kvWeapons); + + if (KvGotoFirstSubKey(kvWeapons)) + { + decl String:weapon[WEAPONS_MAX_LENGTH]; + decl String:display[WEAPONS_MAX_LENGTH + 1]; + + do + { + KvGetSectionName(kvWeapons, weapon, sizeof(weapon)); + + // If weapon is defaulted to restricted, then restrict weapon + if (WeaponsIsRestrict(weapon)) + { + new WpnRestrictQuery:output = RestrictRestrict(weapon, display); + RestrictPrintRestrictOutput(0, output, display, true); + } + } while (KvGotoNextKey(kvWeapons)); + } +} + +/** + * Validate weapon group options + */ RestrictValidateWeaponGroups() { KvRewind(kvWeaponGroups); @@ -319,7 +349,7 @@ WpnRestrictQuery:RestrictUnrestrict(const String:weapon[], String:display[] = "" * @param weapon The weapon client is trying to restrict. * @param cmd True if printing output in reply to a client command. */ -RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon[], bool:cmd) +RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon[], bool:reply) { switch(output) { @@ -336,7 +366,7 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon } case Failed_Weapon: { - if (cmd) + if (reply) { ZR_ReplyToCommand(client, "Restrict weapon failed", weapon); } @@ -350,7 +380,7 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon decl String:weaponlist[128]; RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", "); - if (cmd) + if (reply) { ZR_ReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist); } @@ -361,7 +391,7 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon } case Invalid: { - if (cmd) + if (reply) { ZR_ReplyToCommand(client, "Weapon invalid", weapon); } @@ -380,7 +410,7 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon * @param weapon The weapon client is trying to unrestrict. * @param cmd True if printing output in reply to a client command. */ -RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weapon[], bool:cmd) +RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weapon[], bool:reply) { switch(output) { @@ -397,7 +427,7 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap } case Failed_Weapon: { - if (cmd) + if (reply) { ZR_ReplyToCommand(client, "Unrestrict weapon failed", weapon); } @@ -411,7 +441,7 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap decl String:weaponlist[128]; RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", "); - if (cmd) + if (reply) { ZR_ReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist); } @@ -422,7 +452,7 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap } case Invalid: { - if (cmd) + if (reply) { ZR_ReplyToCommand(client, "Weapon invalid", weapon); } diff --git a/src/zr/weapons/weapons.inc b/src/zr/weapons/weapons.inc index 014d3f0..e64bc37 100644 --- a/src/zr/weapons/weapons.inc +++ b/src/zr/weapons/weapons.inc @@ -191,7 +191,7 @@ bool:WeaponsIsRestrict(const String:weapon[]) if (StrEqual(validweapon, weapon, false)) { - KvGetString(kvWeapons, validweapon, restrict, sizeof(restrict), "no"); + KvGetString(kvWeapons, "restrict", restrict, sizeof(restrict), "no"); return ConfigOptionToBool(restrict); } @@ -220,7 +220,7 @@ bool:WeaponsIsWeaponMenu(const String:weapon[]) if (StrEqual(validweapon, weapon, false)) { - KvGetString(kvWeapons, validweapon, menu, sizeof(menu), "yes"); + KvGetString(kvWeapons, "menu", menu, sizeof(menu), "yes"); return ConfigOptionToBool(menu); } diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index d4fd152..5f899b7 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -123,6 +123,18 @@ bool:ConfigOptionToBool(const String:option[]) return false; } +BoolToConfigOption(bool:bOption, String:option[], maxlen) +{ + if (bOption) + { + strcopy(option, maxlen, "yes"); + } + else + { + strcopy(option, maxlen, "no"); + } +} + FindClientDXLevel(client) { if (IsFakeClient(client))