Merged heads and fixed conflicts.
This commit is contained in:
commit
9b82451d1c
@ -4,34 +4,15 @@
|
|||||||
// General
|
// 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, цель для зомби - инфицировать всех людей."
|
"ru" "Битва @greenЛюдей против Зомби@default, цель для зомби - инфицировать всех людей."
|
||||||
}
|
}
|
||||||
|
|
||||||
"You are a zombie"
|
"General zmenu reminder"
|
||||||
{
|
{
|
||||||
"en" "You have been infected! Now go pass it on to as many people as you can."
|
"en" "For help on Zombie:Reloaded commands, type !zmenu in chat."
|
||||||
"ru" "Вы были инфицированы! Теперь вы охотитесь за людьми."
|
|
||||||
}
|
|
||||||
|
|
||||||
"Zombie replacement"
|
|
||||||
{
|
|
||||||
"en" "The last zombie has left the game, and has passed the infection on to you."
|
|
||||||
"ru" "Последний зомби покинул игру и передал свою инфекцию вам."
|
|
||||||
}
|
|
||||||
|
|
||||||
"Auto-assign"
|
|
||||||
{
|
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "You have randomly been assigned to the @green\"{1}\" @defaultclass."
|
|
||||||
"ru" "Вам был случайным образом установлен класс \"{1}\"."
|
|
||||||
}
|
|
||||||
|
|
||||||
"!zmenu reminder"
|
|
||||||
{
|
|
||||||
"en" "Type !zmenu in chat to view all ZR commands."
|
|
||||||
"ru" "Напишите !zmenu в чате для просмотра всех команд."
|
"ru" "Напишите !zmenu в чате для просмотра всех команд."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +22,13 @@
|
|||||||
|
|
||||||
// General
|
// General
|
||||||
|
|
||||||
|
"Literal text"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "{1}"
|
||||||
|
}
|
||||||
|
// Set string to "{1}" for all languages.
|
||||||
|
|
||||||
"Feature is disabled"
|
"Feature is disabled"
|
||||||
{
|
{
|
||||||
"en" "This feature is currently disabled by the server host."
|
"en" "This feature is currently disabled by the server host."
|
||||||
@ -94,38 +82,90 @@
|
|||||||
|
|
||||||
// General
|
// General
|
||||||
|
|
||||||
"!zclass admin mode enabled"
|
"Classes admin mode enabled"
|
||||||
{
|
{
|
||||||
"en" "Admin mode is enabled!"
|
"en" "Admin mode is enabled!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Classes random assignment"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "You have randomly been assigned to the @green\"{1}\" @defaultclass."
|
||||||
|
"ru" "Вам был случайным образом установлен класс \"{1}\"."
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center Text/HUD
|
||||||
|
|
||||||
|
"Classes overlay toggle"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Class overlay toggle commands: {1}"
|
||||||
|
}
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
|
|
||||||
"!zclass title"
|
"Classes menu title"
|
||||||
{
|
{
|
||||||
"en" "Class Selection:"
|
"en" "Class Selection:"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass zombie"
|
"Classes menu zombie"
|
||||||
{
|
{
|
||||||
"en" "Select Zombie Class"
|
"en" "Select Zombie Class"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass human"
|
"Classes menu human"
|
||||||
{
|
{
|
||||||
"en" "Select Human Class"
|
"en" "Select Human Class"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass admin"
|
"Classes menu admin"
|
||||||
{
|
{
|
||||||
"en" "Select Admin Class"
|
"en" "Select Admin Class"
|
||||||
}
|
}
|
||||||
|
|
||||||
"!zclass admin mode toggle"
|
"Classes menu admin mode toggle"
|
||||||
{
|
{
|
||||||
"en" "Toggle Admin Mode"
|
"en" "Toggle Admin Mode"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// (core) Overlays
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
"Overlays not supported"
|
||||||
|
{
|
||||||
|
"#format" "{1:d},{2:d}"
|
||||||
|
"en" "Blocking Overlay - DX{1} Detected (DX{2} Required)"
|
||||||
|
"ru" "Оверлей Отключен - Обнаружен DX{1} (Необходим DX{2})"
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// (core) Infect
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
// General
|
||||||
|
|
||||||
|
"Infect infected"
|
||||||
|
{
|
||||||
|
"en" "You have been infected! Go pass it on to as many other players as you can."
|
||||||
|
}
|
||||||
|
|
||||||
|
"Infect disconnect"
|
||||||
|
{
|
||||||
|
"en" "The last zombie has left the game, and has passed the infection on to you."
|
||||||
|
"ru" "Последний зомби покинул игру и передал свою инфекцию вам."
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// (core) Damage
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
"Damage suicide intercept"
|
||||||
|
{
|
||||||
|
"en" "Suicide attempt intercepted."
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Menu (core)
|
// Menu (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
@ -140,43 +180,40 @@
|
|||||||
|
|
||||||
"Menu main zadmin"
|
"Menu main zadmin"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZAdmin ({1}) - Open admin menu."
|
"en" "ZAdmin ({1}) - Open admin menu."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zclass"
|
"Menu main zclass"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZClass ({1}) - Configure your class settings."
|
"en" "ZClass ({1}) - Configure your class settings."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zspawn"
|
"Menu main zspawn"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZSpawn ({1}) - Join late? Use this to spawn."
|
"en" "ZSpawn ({1}) - Join late? Use this to spawn."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main ztele"
|
"Menu main ztele"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZTele ({1}) - Teleport back to your spawn location."
|
"en" "ZTele ({1}) - Teleport back to your spawn location."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zhp"
|
"Menu main zhp"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZHP ({1}) - Toggle real HP display when infected."
|
"en" "ZHP ({1}) - Toggle real HP display when infected."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zmarket"
|
"Menu main zmarket"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZMarket ({1}) - Need a weapon? Buy them here."
|
"en" "ZMarket ({1}) - Need a weapon? Buy them here."
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================
|
|
||||||
// (core) Damage
|
|
||||||
// ===========================
|
|
||||||
|
|
||||||
"Damage suicide intercept"
|
|
||||||
{
|
|
||||||
"en" "Suicide attempt intercepted."
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// (core) Weapons
|
// (core) Weapons
|
||||||
// ===========================
|
// ===========================
|
||||||
@ -460,13 +497,6 @@
|
|||||||
"en" "Player {1} has been slayed for camping in a restricted area. (ID: {2})"
|
"en" "Player {1} has been slayed for camping in a restricted area. (ID: {2})"
|
||||||
}
|
}
|
||||||
|
|
||||||
"DX90 not supported"
|
|
||||||
{
|
|
||||||
"#format" "{1:d},{2:d}"
|
|
||||||
"en" "Blocking Overlay - DX{1} Detected (DX{2} Required)"
|
|
||||||
"ru" "Оверлей Отключен - Обнаружен DX{1} (Необходим DX{2})"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// ZAdmin Menu
|
// ZAdmin Menu
|
||||||
// ===========================
|
// ===========================
|
||||||
@ -617,26 +647,4 @@
|
|||||||
{
|
{
|
||||||
"en" "Toggle Logging Flags:"
|
"en" "Toggle Logging Flags:"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================
|
|
||||||
// Server Messages
|
|
||||||
// ===========================
|
|
||||||
|
|
||||||
"ZR"
|
|
||||||
{
|
|
||||||
"en" "ZR"
|
|
||||||
"ru" "ZR"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Plugin loading"
|
|
||||||
{
|
|
||||||
"en" "-----------| Zombie:Reloaded Loading |----------"
|
|
||||||
"ru" "-----------| Zombie:Reloaded Загружается |----------"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Plugin loaded"
|
|
||||||
{
|
|
||||||
"en" "-----------| Zombie:Reloaded Loaded |----------"
|
|
||||||
"ru" "-----------| Zombie:Reloaded Загружен |----------"
|
|
||||||
}
|
|
||||||
}
|
}
|
50
cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.base.cfg
Normal file
50
cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.base.cfg
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// /*
|
||||||
|
// * ============================================================================
|
||||||
|
// *
|
||||||
|
// * Zombie:Reloaded
|
||||||
|
// *
|
||||||
|
// * File: zombiereloaded.cfg
|
||||||
|
// * Type: Core
|
||||||
|
// * Description: Plugin cvar configuration.
|
||||||
|
// *
|
||||||
|
// * ============================================================================
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Notes
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// All notes are generalities, exceptions will be noted in appropriate place.
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// * All units of time are read in seconds.
|
||||||
|
// * ...
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Format:
|
||||||
|
// <Cvar description>
|
||||||
|
// Default: "<Default value>"
|
||||||
|
// <Cvar> "<Value>"
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Description:
|
||||||
|
// "<Simple description> [<Specification> = '<Meaning>' | ...]"
|
||||||
|
// OR
|
||||||
|
// "<Simple description> [<Flag>: <Value> | ...]"
|
||||||
|
//
|
||||||
|
// Specifications:
|
||||||
|
// These are specific values that the cvar can be set to. Used to illustrate
|
||||||
|
// the scale of a cvar, min/max values, etc.
|
||||||
|
//
|
||||||
|
// Meaning:
|
||||||
|
// The description of what the specification does.
|
||||||
|
//
|
||||||
|
// Flag:
|
||||||
|
// Includes any of the following:
|
||||||
|
// * "Dependency" - Means this cvar relies on another cvar to be enabled.
|
||||||
|
// E.G. Has no effect until its dependencies are enabled.
|
||||||
|
// * "Delimiter" - Separate each item by this given character.
|
||||||
|
// * "Override" - Means this cvar overrides another if enabled.
|
||||||
|
// * "Recommended" - Means another cvar is recommended to be enabled if this
|
||||||
|
// one is.
|
||||||
|
// ...
|
||||||
|
//
|
||||||
|
// Value:
|
||||||
|
// The value of the flag. Usually a referenced cvar.
|
||||||
|
// ---------------------------------------------------------------------------
|
@ -1,436 +0,0 @@
|
|||||||
// ============================================================================
|
|
||||||
//
|
|
||||||
// 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"
|
|
||||||
|
|
||||||
// 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,
|
|
||||||
// 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"
|
|
@ -23,14 +23,15 @@
|
|||||||
|
|
||||||
// Core includes.
|
// Core includes.
|
||||||
#include "zr/zombiereloaded"
|
#include "zr/zombiereloaded"
|
||||||
#include "zr/log"
|
#include "zr/translation"
|
||||||
#include "zr/cvars"
|
#include "zr/cvars"
|
||||||
|
#include "zr/log"
|
||||||
#include "zr/config"
|
#include "zr/config"
|
||||||
#include "zr/serial"
|
#include "zr/serial"
|
||||||
#include "zr/translation"
|
|
||||||
#include "zr/sayhooks"
|
#include "zr/sayhooks"
|
||||||
#include "zr/tools"
|
#include "zr/tools"
|
||||||
#include "zr/models"
|
#include "zr/models"
|
||||||
|
#include "zr/overlays"
|
||||||
#include "zr/playerclasses/playerclasses"
|
#include "zr/playerclasses/playerclasses"
|
||||||
#include "zr/weapons/weapons"
|
#include "zr/weapons/weapons"
|
||||||
#include "zr/hitgroups"
|
#include "zr/hitgroups"
|
||||||
@ -52,11 +53,11 @@
|
|||||||
#include "zr/spawnprotect"
|
#include "zr/spawnprotect"
|
||||||
#include "zr/respawn"
|
#include "zr/respawn"
|
||||||
#include "zr/napalm"
|
#include "zr/napalm"
|
||||||
|
#include "zr/jumpboost"
|
||||||
#include "zr/zspawn"
|
#include "zr/zspawn"
|
||||||
#include "zr/ztele"
|
#include "zr/ztele"
|
||||||
#include "zr/zhp"
|
#include "zr/zhp"
|
||||||
#include "zr/jumpboost"
|
#include "zr/jumpboost"
|
||||||
#include "zr/anticamp"
|
|
||||||
#include "zr/volfeatures/volfeatures"
|
#include "zr/volfeatures/volfeatures"
|
||||||
|
|
||||||
// Almost replaced! :)
|
// Almost replaced! :)
|
||||||
@ -95,46 +96,15 @@ public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
|
|||||||
*/
|
*/
|
||||||
public OnPluginStart()
|
public OnPluginStart()
|
||||||
{
|
{
|
||||||
// Load translations phrases used by plugin.
|
// Forward event to modules.
|
||||||
LoadTranslations("common.phrases.txt");
|
TranslationInit();
|
||||||
LoadTranslations("zombiereloaded.phrases.txt");
|
|
||||||
|
|
||||||
// Start loading ZR init functions.
|
|
||||||
ZR_PrintToServer("Plugin loading");
|
|
||||||
|
|
||||||
// Log
|
|
||||||
LogInit();
|
|
||||||
|
|
||||||
// Cvars
|
|
||||||
CvarsInit();
|
CvarsInit();
|
||||||
|
|
||||||
// Tools
|
|
||||||
ToolsInit();
|
ToolsInit();
|
||||||
|
CommandsInit();
|
||||||
// TODO: Be modulized/recoded.
|
|
||||||
CreateCommands();
|
|
||||||
HookCommands();
|
|
||||||
|
|
||||||
// Weapons
|
|
||||||
WeaponsInit();
|
WeaponsInit();
|
||||||
|
|
||||||
// Damage
|
|
||||||
DamageInit();
|
|
||||||
|
|
||||||
// Say Hooks
|
|
||||||
SayHooksInit();
|
SayHooksInit();
|
||||||
|
|
||||||
// Event
|
|
||||||
EventInit();
|
EventInit();
|
||||||
|
MarketInit();
|
||||||
// Set market variable to true if market is installed.
|
|
||||||
g_bMarket = LibraryExists("market");
|
|
||||||
|
|
||||||
// Create public cvar for tracking.
|
|
||||||
CreateConVar("gs_zombiereloaded_version", VERSION, "[ZR] Current version of this plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
|
||||||
|
|
||||||
// Finish loading ZR init functions.
|
|
||||||
ZR_PrintToServer("Plugin loaded");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,12 +142,12 @@ public OnMapStart()
|
|||||||
{
|
{
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
SerialOnMapStart();
|
SerialOnMapStart();
|
||||||
|
OverlaysOnMapStart();
|
||||||
RoundEndOnMapStart();
|
RoundEndOnMapStart();
|
||||||
InfectOnMapStart();
|
InfectOnMapStart();
|
||||||
SEffectsOnMapStart();
|
SEffectsOnMapStart();
|
||||||
AntiStickOnMapStart();
|
AntiStickOnMapStart();
|
||||||
ZSpawnOnMapStart();
|
ZSpawnOnMapStart();
|
||||||
Anticamp_Startup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,7 +156,6 @@ public OnMapStart()
|
|||||||
public OnMapEnd()
|
public OnMapEnd()
|
||||||
{
|
{
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
Anticamp_Disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,8 +186,8 @@ public OnClientPutInServer(client)
|
|||||||
{
|
{
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassClientInit(client);
|
ClassClientInit(client);
|
||||||
|
OverlaysClientInit(client);
|
||||||
WeaponsClientInit(client);
|
WeaponsClientInit(client);
|
||||||
RoundEndClientInit(client);
|
|
||||||
InfectClientInit(client);
|
InfectClientInit(client);
|
||||||
DamageClientInit(client);
|
DamageClientInit(client);
|
||||||
SEffectsClientInit(client);
|
SEffectsClientInit(client);
|
||||||
|
@ -352,7 +352,7 @@ HurtPlayersInVolume(volume_index)
|
|||||||
{
|
{
|
||||||
if (IsPlayerInVolume(x, volume_index))
|
if (IsPlayerInVolume(x, volume_index))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(x, "Unfair camping");
|
TranslationPrintToChat(x, "Unfair camping");
|
||||||
client_health = GetClientHealth(x) - volumes[volume_index][volume_damage];
|
client_health = GetClientHealth(x) - volumes[volume_index][volume_damage];
|
||||||
if (client_health > 0)
|
if (client_health > 0)
|
||||||
{
|
{
|
||||||
|
@ -1,19 +1,33 @@
|
|||||||
/**
|
/*
|
||||||
* ====================
|
* ============================================================================
|
||||||
|
*
|
||||||
* Zombie:Reloaded
|
* Zombie:Reloaded
|
||||||
|
*
|
||||||
* File: commands.inc
|
* File: commands.inc
|
||||||
* Author: Greyscale
|
* Type: Core
|
||||||
* ====================
|
* Description: Console command creation and hooking.
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CreateCommands()
|
/**
|
||||||
|
* Commands are created/hooked.
|
||||||
|
*/
|
||||||
|
CommandsInit()
|
||||||
|
{
|
||||||
|
// Forward event to modules. (create commands)
|
||||||
|
WeaponsOnCommandsCreate();
|
||||||
|
|
||||||
|
// Forward event to modules. (hook commands)
|
||||||
|
ClassOnCommandsHook();
|
||||||
|
DamageOnCommandsHook();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*CreateCommands()
|
||||||
{
|
{
|
||||||
RegAdminCmd("zr_infect", Command_Infect, ADMFLAG_GENERIC, "Infects the specified player");
|
RegAdminCmd("zr_infect", Command_Infect, ADMFLAG_GENERIC, "Infects the specified player");
|
||||||
RegAdminCmd("zr_spawn", Command_Respawn, ADMFLAG_GENERIC, "Respawns the specified player following auto-respawning rules");
|
RegAdminCmd("zr_spawn", Command_Respawn, ADMFLAG_GENERIC, "Respawns the specified player following auto-respawning rules");
|
||||||
|
|
||||||
// Weapon restrict commands
|
|
||||||
RegAdminCmd("zr_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict a specified weapon");
|
|
||||||
RegAdminCmd("zr_unrestrict", Command_Unrestrict, ADMFLAG_GENERIC, "Unrestrict a specified weapon");
|
|
||||||
|
|
||||||
//RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback <class name> <value>");
|
//RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback <class name> <value>");
|
||||||
//RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>");
|
//RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>");
|
||||||
@ -29,9 +43,10 @@ CreateCommands()
|
|||||||
|
|
||||||
RegConsoleCmd("zr_class_dump", Command_ClassDump, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump <cachetype> <index|targetname>");
|
RegConsoleCmd("zr_class_dump", Command_ClassDump, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump <cachetype> <index|targetname>");
|
||||||
RegAdminCmd("zr_class_modify", Command_ClassModify, 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", Command_ClassModify, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify <classname|\"zombies\"|\"humans\"|\"admins\"> <attribute> <value> [is_multiplier]");
|
||||||
}
|
|
||||||
|
|
||||||
public Action:Command_Infect(client, argc)
|
}*/
|
||||||
|
|
||||||
|
/*public Action:Command_Infect(client, argc)
|
||||||
{
|
{
|
||||||
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
||||||
if (argc < 1 || !enabled)
|
if (argc < 1 || !enabled)
|
||||||
@ -128,111 +143,10 @@ public Action:Command_Respawn(client, argc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Command callback (zr_restrict)
|
|
||||||
* Restricts a weapon or group
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
* @param argc Argument count.
|
|
||||||
*/
|
|
||||||
public Action:Command_Restrict(client, argc)
|
|
||||||
{
|
|
||||||
// Disabled.
|
|
||||||
// If plugin is disabled then stop
|
|
||||||
/**new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (argc < 1 || !enabled)
|
|
||||||
{
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// If weapons module is disabled, then stop.
|
/*public Action:Command_AdminMenu(client, argc)
|
||||||
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
|
||||||
if (!weapons)
|
|
||||||
{
|
|
||||||
// Tell client command is disabled.
|
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If restrict module is disabled, then stop.
|
|
||||||
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
|
||||||
if (!restrict)
|
|
||||||
{
|
|
||||||
// Tell client command is disabled.
|
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// arg1 = weapon being restricted
|
|
||||||
decl String:arg1[32];
|
|
||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
|
||||||
|
|
||||||
// Strip "weapon_" from entity name
|
|
||||||
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
|
|
||||||
|
|
||||||
decl String:display[WEAPONS_MAX_LENGTH];
|
|
||||||
|
|
||||||
new WpnRestrictQuery:output = RestrictRestrict(arg1, display);
|
|
||||||
RestrictPrintRestrictOutput(client, output, display, true);
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Command callback (zr_unrestrict)
|
|
||||||
* Unrestricts a weapon or group
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
* @param argc Argument count.
|
|
||||||
*/
|
|
||||||
public Action:Command_Unrestrict(client, argc)
|
|
||||||
{
|
|
||||||
// Disabled.
|
|
||||||
// If plugin is disabled then stop
|
|
||||||
/**new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (argc < 1 || !enabled)
|
|
||||||
{
|
|
||||||
return Plugin_Handled;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// If weapons module is disabled, then stop.
|
|
||||||
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
|
||||||
if (!weapons)
|
|
||||||
{
|
|
||||||
// Tell client command is disabled.
|
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If restrict module is disabled, then stop.
|
|
||||||
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
|
||||||
if (!restrict)
|
|
||||||
{
|
|
||||||
// Tell client command is disabled.
|
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// arg1 = weapon being restricted
|
|
||||||
decl String:arg1[32];
|
|
||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
|
||||||
|
|
||||||
// Strip "weapon_" from entity name
|
|
||||||
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
|
|
||||||
|
|
||||||
decl String:display[WEAPONS_MAX_LENGTH];
|
|
||||||
|
|
||||||
new WpnRestrictQuery:output = RestrictUnrestrict(arg1, display);
|
|
||||||
RestrictPrintUnrestrictOutput(client, output, display, true);
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Action:Command_AdminMenu(client, argc)
|
|
||||||
{
|
{
|
||||||
if (ZRIsClientValid(client))
|
if (ZRIsClientValid(client))
|
||||||
{
|
{
|
||||||
@ -308,4 +222,4 @@ public Action:Command_LogFlags(client, argc)
|
|||||||
|
|
||||||
ReplyToCommand(client, message);
|
ReplyToCommand(client, message);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}*/
|
||||||
|
@ -89,10 +89,7 @@ ConfigLoad()
|
|||||||
ServerCommand("exec %s", mapconfig);
|
ServerCommand("exec %s", mapconfig);
|
||||||
|
|
||||||
// Log action.
|
// Log action.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS))
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed map config file: %s", path);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "", "", "Executed map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +103,6 @@ ConfigOnModulesLoaded()
|
|||||||
decl String:mapname[256];
|
decl String:mapname[256];
|
||||||
decl String:mapconfig[PLATFORM_MAX_PATH];
|
decl String:mapconfig[PLATFORM_MAX_PATH];
|
||||||
decl String:path[PLATFORM_MAX_PATH];
|
decl String:path[PLATFORM_MAX_PATH];
|
||||||
new bool:cfgexists;
|
|
||||||
|
|
||||||
// Get map name and format into config path.
|
// Get map name and format into config path.
|
||||||
GetCurrentMap(mapname, sizeof(mapname));
|
GetCurrentMap(mapname, sizeof(mapname));
|
||||||
@ -120,7 +116,7 @@ ConfigOnModulesLoaded()
|
|||||||
// boolean first works.
|
// boolean first works.
|
||||||
|
|
||||||
// Check if the file exist.
|
// Check if the file exist.
|
||||||
cfgexists = FileExists(path);
|
new bool:cfgexists = FileExists(path);
|
||||||
if (!cfgexists)
|
if (!cfgexists)
|
||||||
{
|
{
|
||||||
// File doesn't exist, then stop.
|
// File doesn't exist, then stop.
|
||||||
@ -131,10 +127,7 @@ ConfigOnModulesLoaded()
|
|||||||
ServerCommand("exec %s", mapconfig);
|
ServerCommand("exec %s", mapconfig);
|
||||||
|
|
||||||
// Log action.
|
// Log action.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS))
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed post map config file: %s", path);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "", "", "Executed post map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,7 +148,6 @@ bool:ConfigGetFilePath(CvarsList:cvar, String:path[])
|
|||||||
return FileExists(path);
|
return FileExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates, deletes, sets, or gets any key/setting of any ZR config keyvalue file in memory.
|
* Creates, deletes, sets, or gets any key/setting of any ZR config keyvalue file in memory.
|
||||||
* Only use when interacting with a command or manipulating single keys/values,
|
* Only use when interacting with a command or manipulating single keys/values,
|
||||||
|
334
src/zr/cvars.inc
334
src/zr/cvars.inc
@ -25,6 +25,15 @@
|
|||||||
enum CvarsList
|
enum CvarsList
|
||||||
{
|
{
|
||||||
Handle:CVAR_ENABLE,
|
Handle:CVAR_ENABLE,
|
||||||
|
Handle:CVAR_LOG,
|
||||||
|
Handle:CVAR_LOG_LOAD,
|
||||||
|
Handle:CVAR_LOG_CORE,
|
||||||
|
Handle:CVAR_LOG_FILTER_MODULES,
|
||||||
|
Handle:CVAR_LOG_FILTER_DESCRIPTION,
|
||||||
|
Handle:CVAR_LOG_FILTER_DEBUG,
|
||||||
|
Handle:CVAR_LOG_PRINT_ADMINS,
|
||||||
|
Handle:CVAR_LOG_PRINT_CHAT,
|
||||||
|
Handle:CVAR_LOG_PRINT_CONSOLE,
|
||||||
Handle:CVAR_CONFIG_PATH_MODELS,
|
Handle:CVAR_CONFIG_PATH_MODELS,
|
||||||
Handle:CVAR_CONFIG_PATH_DOWNLOADS,
|
Handle:CVAR_CONFIG_PATH_DOWNLOADS,
|
||||||
Handle:CVAR_CONFIG_PATH_PLAYERCLASSES,
|
Handle:CVAR_CONFIG_PATH_PLAYERCLASSES,
|
||||||
@ -36,6 +45,10 @@ enum CvarsList
|
|||||||
Handle:CVAR_CLASSES_DEFAULT_ZOMBIE,
|
Handle:CVAR_CLASSES_DEFAULT_ZOMBIE,
|
||||||
Handle:CVAR_CLASSES_DEFAULT_HUMAN,
|
Handle:CVAR_CLASSES_DEFAULT_HUMAN,
|
||||||
Handle:CVAR_CLASSES_DEFAULT_ADMIN,
|
Handle:CVAR_CLASSES_DEFAULT_ADMIN,
|
||||||
|
Handle:CVAR_CLASSES_MENU_AUTOCLOSE,
|
||||||
|
Handle:CVAR_CLASSES_OVERLAY_TOGGLE,
|
||||||
|
Handle:CVAR_CLASSES_OVERLAY_TOGGLECMDS,
|
||||||
|
Handle:CVAR_CLASSES_OVERLAY_DEFAULT,
|
||||||
Handle:CVAR_WEAPONS,
|
Handle:CVAR_WEAPONS,
|
||||||
Handle:CVAR_WEAPONS_RESTRICT,
|
Handle:CVAR_WEAPONS_RESTRICT,
|
||||||
Handle:CVAR_WEAPONS_ZMARKET_BUYZONE,
|
Handle:CVAR_WEAPONS_ZMARKET_BUYZONE,
|
||||||
@ -49,6 +62,7 @@ enum CvarsList
|
|||||||
Handle:CVAR_SAYHOOKS_QUIET,
|
Handle:CVAR_SAYHOOKS_QUIET,
|
||||||
Handle:CVAR_SAYHOOKS_QUIET_FILTER,
|
Handle:CVAR_SAYHOOKS_QUIET_FILTER,
|
||||||
Handle:CVAR_SAYHOOKS_QUIET_FLAGS,
|
Handle:CVAR_SAYHOOKS_QUIET_FLAGS,
|
||||||
|
Handle:CVAR_OVERLAYS_UPDATE_TIME,
|
||||||
Handle:CVAR_ROUNDEND_OVERLAY,
|
Handle:CVAR_ROUNDEND_OVERLAY,
|
||||||
Handle:CVAR_ROUNDEND_OVERLAY_ZOMBIE,
|
Handle:CVAR_ROUNDEND_OVERLAY_ZOMBIE,
|
||||||
Handle:CVAR_ROUNDEND_OVERLAY_HUMAN,
|
Handle:CVAR_ROUNDEND_OVERLAY_HUMAN,
|
||||||
@ -99,6 +113,7 @@ enum CvarsList
|
|||||||
Handle:CVAR_RESPAWN_DELAY,
|
Handle:CVAR_RESPAWN_DELAY,
|
||||||
Handle:CVAR_RESPAWN_TEAM_ZOMBIE,
|
Handle:CVAR_RESPAWN_TEAM_ZOMBIE,
|
||||||
Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD,
|
Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD,
|
||||||
|
Handle:CVAR_JUMPBOOST_BUNNYHOP_PROTECT,
|
||||||
Handle:CVAR_ZSPAWN,
|
Handle:CVAR_ZSPAWN,
|
||||||
Handle:CVAR_ZSPAWN_TEAM_OVERRIDE,
|
Handle:CVAR_ZSPAWN_TEAM_OVERRIDE,
|
||||||
Handle:CVAR_ZSPAWN_TEAM_ZOMBIE,
|
Handle:CVAR_ZSPAWN_TEAM_ZOMBIE,
|
||||||
@ -115,13 +130,6 @@ enum CvarsList
|
|||||||
Handle:CVAR_ZTELE_AUTOCANCEL_DISTANCE,
|
Handle:CVAR_ZTELE_AUTOCANCEL_DISTANCE,
|
||||||
Handle:CVAR_ZHP,
|
Handle:CVAR_ZHP,
|
||||||
Handle:CVAR_ZHP_DEFAULT,
|
Handle:CVAR_ZHP_DEFAULT,
|
||||||
|
|
||||||
// To be modulized/recoded.
|
|
||||||
Handle:CVAR_OVERLAY_REDISPLAY,
|
|
||||||
Handle:CVAR_ZVISION_ALLOW_DISABLE,
|
|
||||||
Handle:CVAR_MENU_AUTOCLOSE,
|
|
||||||
Handle:CVAR_ANTICAMP,
|
|
||||||
Handle:CVAR_ANTICAMP_UPDATE_INTERVAL,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,6 +163,11 @@ CvarsInit()
|
|||||||
// Hook cvars.
|
// Hook cvars.
|
||||||
CvarsHook();
|
CvarsHook();
|
||||||
|
|
||||||
|
// Create public cvar for tracking.
|
||||||
|
decl String:description[64];
|
||||||
|
Format(description, sizeof(description), "%s Current version of this plugin", TRANSLATION_PHRASE_PREFIX);
|
||||||
|
CreateConVar("gs_zombiereloaded_version", VERSION, description, FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
VEffectsOnCvarInit();
|
VEffectsOnCvarInit();
|
||||||
}
|
}
|
||||||
@ -164,21 +177,6 @@ CvarsInit()
|
|||||||
*/
|
*/
|
||||||
CvarsCreate()
|
CvarsCreate()
|
||||||
{
|
{
|
||||||
// Cvar naming guidelines:
|
|
||||||
// 1. Prefix: "zr_"
|
|
||||||
// 2. Module name next. "zr_modulename_"
|
|
||||||
// 3. (If applys) Submodule name next. "zr_modulename_submodulename_" Ex "zr_weapons_restrict_"
|
|
||||||
// 4. Name last part to be defaulted to "1" (if boolean cvar) Ex "zr_damage_suicide_zombie",
|
|
||||||
// because it will be defaulted to "1". "zr_damage_suicide_zombie_disable" = bad. Because we want
|
|
||||||
// to try to default everything to "1" and let hosts disable what they don't want.
|
|
||||||
//
|
|
||||||
// Cvar description guidelines
|
|
||||||
// Assume cvar is enabled.
|
|
||||||
// Ex. "zr_roundend_overlay" "1" "Display round win overlays to all clients."
|
|
||||||
// Explain (additional) options in brackets.
|
|
||||||
// Ex. "zr_classes_default_zombie" "" "Default zombie class. ['""' = Class config defaults. 'random' = Give client random class on connect.]"
|
|
||||||
// Any thing else?
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// General (Core)
|
// General (Core)
|
||||||
// ===========================
|
// ===========================
|
||||||
@ -189,7 +187,13 @@ CvarsCreate()
|
|||||||
// Log (core)
|
// Log (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
// Cvars created in log.inc, because of compilation problems when creating them here.
|
g_hCvarsList[CVAR_LOG] = CreateConVar("zr_log", "1", "Logs key actions performed by the plugin, including errors and debug.");
|
||||||
|
g_hCvarsList[CVAR_LOG_FILTER_MODULES] = CreateConVar("zr_log_filter_modules", "", "If any log module name is within this string, log will be suppressed. [Dependency: zr_log]");
|
||||||
|
g_hCvarsList[CVAR_LOG_FILTER_DESCRIPTION] = CreateConVar("zr_log_filter_description", "", "If any log description is within this string, log will be suppressed. [Dependency: zr_log]");
|
||||||
|
g_hCvarsList[CVAR_LOG_FILTER_DEBUG] = CreateConVar("zr_log_filter_debug", "1", "Supresses debug messages. [Dependency: zr_log]");
|
||||||
|
g_hCvarsList[CVAR_LOG_PRINT_ADMINS] = CreateConVar("zr_log_print_admins", "0", "Print all logs to currently connected admins. [Dependency: zr_log]");
|
||||||
|
g_hCvarsList[CVAR_LOG_PRINT_CHAT] = CreateConVar("zr_log_print_chat", "1", "Print log to admin's chat area. [Dependency: zr_log & zr_log_print_admins]");
|
||||||
|
g_hCvarsList[CVAR_LOG_PRINT_CONSOLE] = CreateConVar("zr_log_print_console", "1", "Print log to admin's console. [Dependency: zr_log & zr_log_print_admins]");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Translations (core)
|
// Translations (core)
|
||||||
@ -201,12 +205,12 @@ CvarsCreate()
|
|||||||
// Config (core)
|
// Config (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_MODELS] = CreateConVar("zr_config_path_models", "configs/zr/models.txt", "");
|
g_hCvarsList[CVAR_CONFIG_PATH_MODELS] = CreateConVar("zr_config_path_models", "configs/zr/models.txt", "Path, relative to root sourcemod directory, to models config file.");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_DOWNLOADS] = CreateConVar("zr_config_path_downloads", "configs/zr/downloads.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_DOWNLOADS] = CreateConVar("zr_config_path_downloads", "configs/zr/downloads.txt", "Path, relative to root sourcemod directory, to downloads file.");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_PLAYERCLASSES] = CreateConVar("zr_config_path_playerclasses", "configs/zr/playerclasses.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_PLAYERCLASSES] = CreateConVar("zr_config_path_playerclasses", "configs/zr/playerclasses.txt", "Path, relative to root sourcemod directory, to playerclasses config file.");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONS] = CreateConVar("zr_config_path_weapons", "configs/zr/weapons/weapons.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONS] = CreateConVar("zr_config_path_weapons", "configs/zr/weapons/weapons.txt", "Path, relative to root sourcemod directory, to weapons config file.");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONGROUPS] = CreateConVar("zr_config_path_weapongroups", "configs/zr/weapons/weapongroups.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONGROUPS] = CreateConVar("zr_config_path_weapongroups", "configs/zr/weapons/weapongroups.txt", "Path, relative to root sourcemod directory, to weapongroups config file.");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_HITGROUPS] = CreateConVar("zr_config_path_hitgroups", "configs/zr/hitgroups.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_HITGROUPS] = CreateConVar("zr_config_path_hitgroups", "configs/zr/hitgroups.txt", "Path, relative to root sourcemod directory, to hitgroups config file.");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Tools (core)
|
// Tools (core)
|
||||||
@ -224,16 +228,23 @@ CvarsCreate()
|
|||||||
// Classes (core)
|
// Classes (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "");
|
// General
|
||||||
// Old Desc: Classmenu is re-displayed every spawn (0: Disable)
|
|
||||||
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "");
|
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Re-display class selection menu every spawn.");
|
||||||
// Old Desc: A random class is assigned to each player every round. Overrides zr_classes_spawn and default classes. (0: Disable)
|
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "Player is assigned a random class every spawn. [Override: zr_classes_spawn & zr_classes_default_*]");
|
||||||
g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "");
|
g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "Zombie class assigned to players on connect. ['random' = Random class | '\"\"' = Class config default]");
|
||||||
// Old Desc: Default zombie class selected for all players when they connect. Use \"random\" to select a random class, or blank to use class config defaults.
|
g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "Human class assigned to players on connect. ['random' = Random class | '\"\"' = Class config default]");
|
||||||
g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "");
|
g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Admin class assigned to admins on connect. ['random' = Random class | '\"\"' = Class config default]");
|
||||||
// Old Desc:
|
|
||||||
g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "");
|
// Menu
|
||||||
// Old Desc: Default admin-only class selected for admins when they connect. Use \"random\" to select a random class, or blank to use class config defaults.
|
|
||||||
|
g_hCvarsList[CVAR_CLASSES_MENU_AUTOCLOSE] = CreateConVar("zr_classes_menu_autoclose", "0", "Automatically close class selection menu.");
|
||||||
|
|
||||||
|
// Overlays
|
||||||
|
|
||||||
|
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE] = CreateConVar("zr_classes_overlay_toggle", "1", "Allow players to toggle class overlay.");
|
||||||
|
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS] = CreateConVar("zr_classes_overlay_togglecmds", "nightvision", "List of commands to hook that players can use to toggle class overlay. [Dependency: zr_classes_overlay_toggle | Delimiter: \", \"]");
|
||||||
|
g_hCvarsList[CVAR_CLASSES_OVERLAY_DEFAULT] = CreateConVar("zr_classes_overlay_default", "0", "Default class overlay toggle state set on connecting player. [Dependency: zr_classes_overlay_toggle]");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Weapons (core)
|
// Weapons (core)
|
||||||
@ -241,60 +252,44 @@ CvarsCreate()
|
|||||||
|
|
||||||
// General
|
// General
|
||||||
|
|
||||||
g_hCvarsList[CVAR_WEAPONS] = CreateConVar("zr_weapons", "1", "");
|
g_hCvarsList[CVAR_WEAPONS] = CreateConVar("zr_weapons", "1", "Enable weapons module, disabling this will disable any weapons-related features. (weapon restrictions, weapon knockback multipliers, etc)");
|
||||||
// Note make config file cvar.
|
|
||||||
// Note this disables restrict submodule.
|
|
||||||
|
|
||||||
// Restrict
|
// Restrict
|
||||||
|
|
||||||
g_hCvarsList[CVAR_WEAPONS_RESTRICT] = CreateConVar("zr_weapons_restrict", "1", "");
|
g_hCvarsList[CVAR_WEAPONS_RESTRICT] = CreateConVar("zr_weapons_restrict", "1", "Enable weapon restriction module, disabling this will disable weapon restriction commands.");
|
||||||
// Note make config file cvar.
|
|
||||||
|
|
||||||
// Market Handler
|
// Market Handler
|
||||||
|
|
||||||
g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE] = CreateConVar("zr_weapons_zmarket_buyzone", "1", "");
|
g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE] = CreateConVar("zr_weapons_zmarket_buyzone", "1", "Requires player to be inside a buyzone to use ZMarket.");
|
||||||
// Old Desc: Must be in buyzone to access !zmarket, if Market is installed (0: Can be used anywhere)
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Hitgroups (core)
|
// Hitgroups (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_HITGROUPS] = CreateConVar("zr_hitgroups", "1", "");
|
g_hCvarsList[CVAR_HITGROUPS] = CreateConVar("zr_hitgroups", "1", "Enable hitgroups module, disabling this will disable hitgroup-related features. (hitgroup knockback multipliers, hitgroup damage control)");
|
||||||
// Note make config file cvar.
|
|
||||||
|
|
||||||
// ===========================
|
|
||||||
// Round End (core)
|
|
||||||
// ===========================
|
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "");
|
|
||||||
// Old Desc: Shows an overlay to all clients when a team wins. (0: Disable)
|
|
||||||
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "overlays/zr/humans_win");
|
|
||||||
// Old Desc: overlays/zr/humans_win", "Path to \"humans win\" overlay
|
|
||||||
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "");
|
|
||||||
// Old Desc: Path to \"zombies win\" overlay
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Infect (core)
|
// Infect (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_RATIO] = CreateConVar("zr_infect_mzombie_ratio", "5", "");
|
g_hCvarsList[CVAR_INFECT_MZOMBIE_RATIO] = CreateConVar("zr_infect_mzombie_ratio", "5", "Number of mother zombies to infect (when infect timer is up) in proportion to number of humans on the server.");
|
||||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN] = CreateConVar("zr_infect_mzombie_respawn", "0", "");
|
g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN] = CreateConVar("zr_infect_mzombie_respawn", "0", "Teleport mother zombies back to spawn on infect.");
|
||||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MIN] = CreateConVar("zr_infect_spawntime_min", "30.0", "");
|
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MIN] = CreateConVar("zr_infect_spawntime_min", "30.0", "Minimum time from the start of the round until picking the mother zombie(s).");
|
||||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "");
|
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "Maximum time from the start of the round until picking the mother zombie(s).");
|
||||||
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "");
|
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "Prevent a player from being chosen as mother zombie two rounds in a row.");
|
||||||
g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "");
|
g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead.");
|
||||||
|
|
||||||
// Effects
|
// Effects
|
||||||
|
|
||||||
g_hCvarsList[CVAR_INFECT_FIREBALL] = CreateConVar("zr_infect_fireball", "1", "");
|
g_hCvarsList[CVAR_INFECT_FIREBALL] = CreateConVar("zr_infect_fireball", "1", "Spawn a fireball effect around player on infection.");
|
||||||
g_hCvarsList[CVAR_INFECT_SMOKE] = CreateConVar("zr_infect_smoke", "1", "");
|
g_hCvarsList[CVAR_INFECT_SMOKE] = CreateConVar("zr_infect_smoke", "1", "Spawn a smoke cloud effect around player on infection.");
|
||||||
g_hCvarsList[CVAR_INFECT_SPARKS] = CreateConVar("zr_infect_sparks", "1", "");
|
g_hCvarsList[CVAR_INFECT_SPARKS] = CreateConVar("zr_infect_sparks", "1", "Emit sparks from player on infection.");
|
||||||
g_hCvarsList[CVAR_INFECT_SOUND] = CreateConVar("zr_infect_sound", "npc/fast_zombie/fz_scream1.wav", "");
|
g_hCvarsList[CVAR_INFECT_SOUND] = CreateConVar("zr_infect_sound", "npc/fast_zombie/fz_scream1.wav", "Sound, relative to \"sounds\" folder, to play from player on infection. ['\"\"' = No sound]");
|
||||||
g_hCvarsList[CVAR_INFECT_ESPLASH] = CreateConVar("zr_infect_esplash", "1", "");
|
g_hCvarsList[CVAR_INFECT_ESPLASH] = CreateConVar("zr_infect_esplash", "1", "Emit an energy splash from player on infection.");
|
||||||
g_hCvarsList[CVAR_INFECT_SHAKE] = CreateConVar("zr_infect_shake", "1", "");
|
g_hCvarsList[CVAR_INFECT_SHAKE] = CreateConVar("zr_infect_shake", "1", "Shake player's view on infect.");
|
||||||
g_hCvarsList[CVAR_INFECT_SHAKE_AMP] = CreateConVar("zr_infect_shake_amp", "15.0", "");
|
g_hCvarsList[CVAR_INFECT_SHAKE_AMP] = CreateConVar("zr_infect_shake_amp", "15.0", "Amplitude of shaking effect. [Dependency: zr_infect_shake]");
|
||||||
g_hCvarsList[CVAR_INFECT_SHAKE_FREQUENCY] = CreateConVar("zr_infect_shake_frequency", "1.0", "");
|
g_hCvarsList[CVAR_INFECT_SHAKE_FREQUENCY] = CreateConVar("zr_infect_shake_frequency", "1.0", "Frequency of shaking effect. [Dependency: zr_infect_shake]");
|
||||||
g_hCvarsList[CVAR_INFECT_SHAKE_DURATION] = CreateConVar("zr_infect_shake_duration", "5.0", "");
|
g_hCvarsList[CVAR_INFECT_SHAKE_DURATION] = CreateConVar("zr_infect_shake_duration", "5.0", "Duration of shaking effect. [Dependency: zr_infect_shake]");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Damage (core)
|
// Damage (core)
|
||||||
@ -302,49 +297,48 @@ CvarsCreate()
|
|||||||
|
|
||||||
// Hitgroup Damage
|
// Hitgroup Damage
|
||||||
|
|
||||||
g_hCvarsList[CVAR_DAMAGE_HITGROUPS] = CreateConVar("zr_damage_hitgroups", "1", "");
|
g_hCvarsList[CVAR_DAMAGE_HITGROUPS] = CreateConVar("zr_damage_hitgroups", "1", "Read hitgroup damage control from hitgroup config file, disabling this allows all zombie hitgroups to be shot.");
|
||||||
|
|
||||||
// Block Damage Types
|
// Block Damage Types
|
||||||
|
|
||||||
g_hCvarsList[CVAR_DAMAGE_BLOCK_FF] = CreateConVar("zr_damage_block_ff", "1", "");
|
g_hCvarsList[CVAR_DAMAGE_BLOCK_FF] = CreateConVar("zr_damage_block_ff", "1", "Block friendly fire.");
|
||||||
// note overrides mp_friendlyfire
|
g_hCvarsList[CVAR_DAMAGE_BLOCK_BLAST] = CreateConVar("zr_damage_block_blast", "1", "Block blast damage inflicted on self or teammates.");
|
||||||
g_hCvarsList[CVAR_DAMAGE_BLOCK_BLAST] = CreateConVar("zr_damage_block_blast", "1", "");
|
|
||||||
|
|
||||||
// Suicide Intercept
|
// Suicide Intercept
|
||||||
|
|
||||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "1", "");
|
g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "1", "Intercept suicide commands attempted by zombies.");
|
||||||
// Old Desc: Intercept human suicide attempts.
|
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", "");
|
g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]");
|
||||||
// Old Desc: Intercept zombie suicide attempts.
|
|
||||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam", "");
|
|
||||||
// Old Desc: List of suicide commands to intercept. (Delimited by \", \"
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Say Hooks (core)
|
// Say Hooks (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_SAYHOOKS_QUIET] = CreateConVar("zr_sayhooks_quiet", "1", "");
|
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", "");
|
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]");
|
||||||
// when enabled it filters out failed sayhooks
|
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");
|
||||||
g_hCvarsList[CVAR_SAYHOOKS_QUIET_FLAGS] = CreateConVar("zr_sayhooks_quiet_flags", "58", "");
|
|
||||||
// Flags (default: 2 + 8 + 16 + 32)
|
// Flags (default: 2 + 8 + 16 + 32)
|
||||||
// 0 Allow all.
|
|
||||||
// 1 Quiet "!zmenu" say hook.
|
// ===========================
|
||||||
// 2 Quiet "!zadmin" say hook.
|
// Overlays (core)
|
||||||
// 4 Quiet "!zclass" say hook.
|
// ===========================
|
||||||
// 8 Quiet "!zspawn" say hook.
|
|
||||||
// 16 Quiet "!ztele" say hook.
|
g_hCvarsList[CVAR_OVERLAYS_UPDATE_TIME] = CreateConVar("zr_overlays_update_time", "1.0", "How often to update overlays on players. [0.0 = Disabled]");
|
||||||
// 32 Quiet "!zhp" say hook.
|
|
||||||
// 64 Quiet "!zmarket" say hook.
|
// ===========================
|
||||||
|
// Round End (core)
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
g_hCvarsList[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "Show specified overlay to players depending on winner when the round ends.");
|
||||||
|
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "overlays/zr/humans_win", "Overlay, relative to \"materials\" folder, to display when humans win the round. [Dependency: zr_roundend_overlay]");
|
||||||
|
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "Overlay, relative to \"materials\" folder, to display when zombies win the round. [Dependency: zr_roundend_overlay]");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Account (module)
|
// Account (module)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ACCOUNT_CASHFILL] = CreateConVar("zr_account_cashfill", "1", "");
|
g_hCvarsList[CVAR_ACCOUNT_CASHFILL] = CreateConVar("zr_account_cashfill", "1", "Reset player's cash each spawn.");
|
||||||
// Old Desc: Enable the mod to set the players cash to zr_cashamount (0: Disabled)
|
g_hCvarsList[CVAR_ACCOUNT_CASHFILL_VALUE] = CreateConVar("zr_account_cashfill_value", "12000", "Amount of cash to set player's account to. [Dependency: zr_account_cashfill]");
|
||||||
g_hCvarsList[CVAR_ACCOUNT_CASHFILL_VALUE] = CreateConVar("zr_account_cashfill_value", "12000", "");
|
|
||||||
// Old Desc: How much money players will have when they spawn when zr_cashfill is 1
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Visual Effects (module)
|
// Visual Effects (module)
|
||||||
@ -352,30 +346,28 @@ CvarsCreate()
|
|||||||
|
|
||||||
// Lightstyle
|
// Lightstyle
|
||||||
|
|
||||||
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE] = CreateConVar("zr_veffects_lightstyle", "1", "");
|
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE] = CreateConVar("zr_veffects_lightstyle", "1", "Change lightstyle (brightness) of the map.");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE] = CreateConVar("zr_veffects_lightstyle_value", "b", "");
|
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE] = CreateConVar("zr_veffects_lightstyle_value", "b", "Lightstyle value. ['a' = Darkest | 'z' = Brightest | Dependency: zr_veffects_lightstyle]");
|
||||||
|
|
||||||
// Sky
|
// Sky
|
||||||
|
|
||||||
g_hCvarsList[CVAR_VEFFECTS_SKY] = CreateConVar("zr_veffects_sky", "1", "");
|
g_hCvarsList[CVAR_VEFFECTS_SKY] = CreateConVar("zr_veffects_sky", "1", "Change map skybox.");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_SKY_PATH] = CreateConVar("zr_veffects_sky_path", "sky_borealis01up.vmt", "");
|
g_hCvarsList[CVAR_VEFFECTS_SKY_PATH] = CreateConVar("zr_veffects_sky_path", "sky_borealis01up.vmt", "Skybox file, relative to \"materials/skybox\" folder, to change map skybox to. [Dependency: zr_veffects_sky]");
|
||||||
|
|
||||||
// Sun
|
// Sun
|
||||||
|
|
||||||
g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE] = CreateConVar("zr_veffects_sun_disable", "1", "");
|
g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE] = CreateConVar("zr_veffects_sun_disable", "1", "Disable sun rendering on map.");
|
||||||
|
|
||||||
// Fog
|
// Fog
|
||||||
|
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG] = CreateConVar("zr_veffects_fog", "0", "");
|
g_hCvarsList[CVAR_VEFFECTS_FOG] = CreateConVar("zr_veffects_fog", "0", "(UNSUPPORTED) Enable fog rendering on the map.");
|
||||||
// NOTE DISABLE. SOURCEMOD DOESNT SUPPORT THIS YET.
|
g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE] = CreateConVar("zr_veffects_fog_override", "0", "(UNSUPPORTED) If fog exists already on the map, then replace with new modified fog. [Dependency: zr_veffects_fog]");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE] = CreateConVar("zr_veffects_fog_override", "0", "");
|
g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR] = CreateConVar("zr_veffects_fog_pcolor", "255 255 255", "(UNSUPPORTED) Primary color of the fog. [Dependency: zr_veffects_fog]");
|
||||||
// NOTE DISABLE. SOURCEMOD DOESNT SUPPORT THIS YET.
|
g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR] = CreateConVar("zr_veffects_fog_scolor", "255 255 255", "(UNSUPPORTED) Secondary color of the fog. [Dependency: zr_veffects_fog]");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR] = CreateConVar("zr_veffects_fog_pcolor", "255 255 255", "");
|
g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY] = CreateConVar("zr_veffects_fog_density", "0.8", "(UNSUPPORTED) Density (thickness) of the fog. [Dependency: zr_veffects_fog]");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR] = CreateConVar("zr_veffects_fog_scolor", "255 255 255", "");
|
g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST] = CreateConVar("zr_veffects_fog_startdist", "0", "(UNSUPPORTED) Distance from player to start rendering foremost fog. [Dependency: zr_veffects_fog]");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY] = CreateConVar("zr_veffects_fog_density", "0.8", "");
|
g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST] = CreateConVar("zr_veffects_fog_enddist", "400", "(UNSUPPORTED) Distance from player to stop rendering fog. [Dependency: zr_veffects_fog]");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST] = CreateConVar("zr_veffects_fog_startdist", "0", "");
|
g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ] = CreateConVar("zr_veffects_fog_farz", "2000", "(UNSUPPORTED) Vertical clipping plane.");
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST] = CreateConVar("zr_veffects_fog_enddist", "400", "");
|
|
||||||
g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ] = CreateConVar("zr_veffects_fog_farz", "2000", "");
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Sound Effects (module)
|
// Sound Effects (module)
|
||||||
@ -383,32 +375,23 @@ CvarsCreate()
|
|||||||
|
|
||||||
// Zombie Sounds
|
// Zombie Sounds
|
||||||
|
|
||||||
g_hCvarsList[CVAR_SEFFECTS_MOAN] = CreateConVar("zr_seffects_moan", "30", "");
|
g_hCvarsList[CVAR_SEFFECTS_MOAN] = CreateConVar("zr_seffects_moan", "30.0", "Time between emission of a moan sound from a zombie.");
|
||||||
// Old Desc: How often, in seconds, a zombie moans (0: Disable)
|
g_hCvarsList[CVAR_SEFFECTS_GROAN] = CreateConVar("zr_seffects_groan", "5", "The probability that a groan sound will be emitted from a zombie when shot. ['100' = 1% chance | '50' = 2% chance | '1' = 100% chance]");
|
||||||
g_hCvarsList[CVAR_SEFFECTS_GROAN] = CreateConVar("zr_seffects_groan", "5", "");
|
g_hCvarsList[CVAR_SEFFECTS_DEATH] = CreateConVar("zr_seffects_death", "1", "Emit a death sound when a zombie dies.");
|
||||||
// Old Desc: Chance factor a zombie will groan when shot (Lower: More often, 0: Disable)
|
|
||||||
g_hCvarsList[CVAR_SEFFECTS_DEATH] = CreateConVar("zr_seffects_death", "1", "");
|
|
||||||
// Old Desc: Zombie will emit a death sound when killed (0: Disable)
|
|
||||||
|
|
||||||
// Ambient Sounds
|
// Ambient Sounds
|
||||||
|
|
||||||
g_hCvarsList[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "");
|
g_hCvarsList[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "Play an ambient sound to all players during gameplay.");
|
||||||
// Old Desc: Enable creepy ambience to be played throughout the game (0: Disable)
|
g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE] = CreateConVar("zr_ambientsounds_file", "ambient/zr/zr_ambience.mp3", "Sound file, relative to \"sounds\" folder, to play as ambience. [Dependency: zr_ambientsounds]");
|
||||||
g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE] = CreateConVar("zr_ambientsounds_file", "ambient/zr/zr_ambience.mp3", "");
|
g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH] = CreateConVar("zr_ambientsounds_length", "60.0", "Length of the ambient sound. [Dependency: zr_ambientsounds]");
|
||||||
// Old Desc: Path to ambient sound file that will be played throughout the game, when zr_ambience is 1
|
g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME] = CreateConVar("zr_ambientsounds_volume", "0.8", "Volume of the ambient sound. [1.0 = Max volume | 0.0001 = Not audible | Dependency: zr_ambientsounds]");
|
||||||
g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH] = CreateConVar("zr_ambientsounds_length", "60.0", "");
|
|
||||||
// Old Desc: The length, in seconds, of the ambient sound file
|
|
||||||
g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME] = CreateConVar("zr_ambientsounds_volume", "1.0", "");
|
|
||||||
// Old Desc: Volume of ambient sounds when zr_ambience is 1 (0.0: Unhearable, 1.0: Max volume)
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Antistick (module)
|
// Antistick (module)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ANTISTICK] = CreateConVar("zr_antistick", "1", "");
|
g_hCvarsList[CVAR_ANTISTICK] = CreateConVar("zr_antistick", "1", "Automatically unstick players when stuck within each others' collision hull.");
|
||||||
// Old Desc: Enable the anti-stick module, which will automatically unstick players stuck within each other. (0:Disable)
|
g_hCvarsList[CVAR_ANTISTICK_INTERVAL] = CreateConVar("zr_antistick_interval", "0.5", "Time between each check for stuck players. [Dependency: zr_antistick]");
|
||||||
g_hCvarsList[CVAR_ANTISTICK_INTERVAL] = CreateConVar("zr_antistick_interval", "0.5", "");
|
|
||||||
// Old Desc: How often, in seconds, the anti-stick module checks each player for being stuck. (1.0: Default)
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Knockback (module)
|
// Knockback (module)
|
||||||
@ -429,14 +412,10 @@ CvarsCreate()
|
|||||||
// Respawn (module)
|
// Respawn (module)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_RESPAWN] = CreateConVar("zr_respawn", "0", "");
|
g_hCvarsList[CVAR_RESPAWN] = CreateConVar("zr_respawn", "0", "Respawn players after death. [Recommended: (Enable) zr_zspawn*]");
|
||||||
// Old Desc: When player is killed, player will respawn
|
g_hCvarsList[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "Time after death to delay player respawn. [Dependency: zr_respawn]");
|
||||||
g_hCvarsList[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "");
|
g_hCvarsList[CVAR_RESPAWN_TEAM_ZOMBIE] = CreateConVar("zr_respawn_team_zombie", "1", "Respawn player as a zombie. [Dependency: zr_respawn]");
|
||||||
// Old Desc: How long to wait after death to respawn, in seconds
|
g_hCvarsList[CVAR_RESPAWN_TEAM_ZOMBIE_WORLD] = CreateConVar("zr_respawn_team_zombie_world", "1", "Respawn player as a zombie if player was killed by the world. [Override: zr_respawn_team_zombie]");
|
||||||
g_hCvarsList[CVAR_RESPAWN_TEAM_ZOMBIE] = CreateConVar("zr_respawn_team_zombie", "1", "");
|
|
||||||
// Old Desc: Respawn player as zombie (0: Respawn as human)
|
|
||||||
g_hCvarsList[CVAR_RESPAWN_TEAM_ZOMBIE_WORLD] = CreateConVar("zr_respawn_team_zombie_world", "1", "");
|
|
||||||
// Old Desc: Respawn zombies as zombies if they were killed by the world, like elevators, doors and lasers. (0: Disable)
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Napalm (module)
|
// Napalm (module)
|
||||||
@ -444,53 +423,43 @@ CvarsCreate()
|
|||||||
|
|
||||||
// (None)
|
// (None)
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// Jump Boost (module)
|
||||||
|
// ===========================
|
||||||
|
|
||||||
|
g_hCvarsList[CVAR_JUMPBOOST_BUNNYHOP_PROTECT] = CreateConVar("zr_jumpboost_bunnyhop_protect", "1", "Prevent players from using forward jump boost multipliers to bunny hop.");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// ZSpawn (module)
|
// ZSpawn (module)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ZSPAWN] = CreateConVar("zr_zspawn", "1", "");
|
g_hCvarsList[CVAR_ZSPAWN] = CreateConVar("zr_zspawn", "1", "Allow players to spawn into the game late.");
|
||||||
// Old Desc: Allow players to spawn if they just joined the game (0: Disable)
|
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ZSPAWN_TEAM_OVERRIDE] = CreateConVar("zr_zspawn_team_override", "1", "");
|
g_hCvarsList[CVAR_ZSPAWN_TEAM_OVERRIDE] = CreateConVar("zr_zspawn_team_override", "1", "Override spawn team when spawning by means of ZSpawn.");
|
||||||
g_hCvarsList[CVAR_ZSPAWN_TEAM_ZOMBIE] = CreateConVar("zr_zspawn_team_zombie", "0", "");
|
g_hCvarsList[CVAR_ZSPAWN_TEAM_ZOMBIE] = CreateConVar("zr_zspawn_team_zombie", "0", "Spawn player on zombie team when spawning by means of ZSpawn. [Dependency: zr_zspawn_team_override | Override: zr_respawn_zombie]");
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT] = CreateConVar("zr_zspawn_timelimit", "1", "");
|
g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT] = CreateConVar("zr_zspawn_timelimit", "1", "Put a time limit on the use of ZSpawn.");
|
||||||
g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME] = CreateConVar("zr_zspawn_timelimit_time", "120", "");
|
g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME] = CreateConVar("zr_zspawn_timelimit_time", "120.0", "Time from the start of the round to allow ZSpawn. [Dependency: zr_zspawn_timelimit]");
|
||||||
// ===========================
|
// ===========================
|
||||||
// ZTele (module)
|
// ZTele (module)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ZTELE_ZOMBIE] = CreateConVar("zr_ztele_zombie", "1", "");
|
g_hCvarsList[CVAR_ZTELE_ZOMBIE] = CreateConVar("zr_ztele_zombie", "1", "Allow zombies to use ZTele.");
|
||||||
g_hCvarsList[CVAR_ZTELE_HUMAN_BEFORE] = CreateConVar("zr_ztele_human_before", "1", "");
|
g_hCvarsList[CVAR_ZTELE_HUMAN_BEFORE] = CreateConVar("zr_ztele_human_before", "1", "Allow humans to use ZTele before the mother zombie has spawned.");
|
||||||
g_hCvarsList[CVAR_ZTELE_HUMAN_AFTER] = CreateConVar("zr_ztele_human_after", "0", "");
|
g_hCvarsList[CVAR_ZTELE_HUMAN_AFTER] = CreateConVar("zr_ztele_human_after", "0", "Allow humans to use ZTele after the mother zombie has spawned.");
|
||||||
g_hCvarsList[CVAR_ZTELE_DELAY_ZOMBIE] = CreateConVar("zr_ztele_delay_zombie", "3", "");
|
g_hCvarsList[CVAR_ZTELE_DELAY_ZOMBIE] = CreateConVar("zr_ztele_delay_zombie", "3.0", "Time between using ZTele command and teleportation for zombies. [Dependency: zr_ztele_zombie]");
|
||||||
g_hCvarsList[CVAR_ZTELE_DELAY_HUMAN] = CreateConVar("zr_ztele_delay_human", "3", "");
|
g_hCvarsList[CVAR_ZTELE_DELAY_HUMAN] = CreateConVar("zr_ztele_delay_human", "3.0", "Time between using ZTele command and teleportation for humans. [Dependency: zr_ztele_human_(before)/(after)]");
|
||||||
g_hCvarsList[CVAR_ZTELE_MAX_ZOMBIE] = CreateConVar("zr_ztele_max_zombie", "3", "");
|
g_hCvarsList[CVAR_ZTELE_MAX_ZOMBIE] = CreateConVar("zr_ztele_max_zombie", "3", "Max number of times a zombie is allowed to use ZTele per round. [Dependency: zr_ztele_zombie]");
|
||||||
g_hCvarsList[CVAR_ZTELE_MAX_HUMAN] = CreateConVar("zr_ztele_max_human", "1", "");
|
g_hCvarsList[CVAR_ZTELE_MAX_HUMAN] = CreateConVar("zr_ztele_max_human", "1", "Max number of times a human is allowed to use ZTele per round. [Dependency: zr_ztele_human_(before)/(after)]");
|
||||||
g_hCvarsList[CVAR_ZTELE_AUTOCANCEL] = CreateConVar("zr_ztele_autocancel", "1", "");
|
g_hCvarsList[CVAR_ZTELE_AUTOCANCEL] = CreateConVar("zr_ztele_autocancel", "1", "Automatically cancel ZTele if player moves out of a set boundary. [Dependency: zr_ztele_(zombie)/(human)[_(before)/(after)]]");
|
||||||
g_hCvarsList[CVAR_ZTELE_AUTOCANCEL_DISTANCE] = CreateConVar("zr_ztele_autocancel_distance", "20", "");
|
g_hCvarsList[CVAR_ZTELE_AUTOCANCEL_DISTANCE] = CreateConVar("zr_ztele_autocancel_distance", "20", "Maximum distance, in feet, player is allowed to travel before teleport is cancelled. [Dependency: zr_ztele_autocancel]");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// ZHP (module)
|
// ZHP (module)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_ZHP] = CreateConVar("zr_zhp", "1", "");
|
g_hCvarsList[CVAR_ZHP] = CreateConVar("zr_zhp", "1", "Allow player to toggle real HP display as a zombie.");
|
||||||
// Old Desc: Allows clients to enable/disable zombie health display (1: On, 0: Off)
|
g_hCvarsList[CVAR_ZHP_DEFAULT] = CreateConVar("zr_zhp_default", "1", "Default ZHP toggle state set on connecting player. [Dependency: zr_zhp]");
|
||||||
g_hCvarsList[CVAR_ZHP_DEFAULT] = CreateConVar("zr_zhp_default", "1", "");
|
|
||||||
// Old Desc: The default value of zombie health display to new clients (1: On, 0: Off)
|
|
||||||
|
|
||||||
|
|
||||||
// TO BE MODULIZED/RECODED.
|
|
||||||
g_hCvarsList[CVAR_OVERLAY_REDISPLAY] = CreateConVar("zr_overlay_redisplay", "3", "");
|
|
||||||
// Old Desc: Frequency, in seconds, to display overlay on the client's screen (Never go below 0.1, 0.2 seems safe)
|
|
||||||
g_hCvarsList[CVAR_ZVISION_ALLOW_DISABLE] = CreateConVar("zr_zvision_allow_disable", "1", "");
|
|
||||||
// Old Desc: Allow users to disable ZVision with their nightvision key (0: Disable)
|
|
||||||
g_hCvarsList[CVAR_MENU_AUTOCLOSE] = CreateConVar("zr_menu_autoclose", "0", "");
|
|
||||||
// Old Desc: Automatically close menus on selection. If disabled the menu will remain open.
|
|
||||||
g_hCvarsList[CVAR_ANTICAMP] = CreateConVar("zr_anticamp", "1", "");
|
|
||||||
// Old Desc: Enables or disables hurt volumes for preventing unfair camping. (0: Disable)
|
|
||||||
g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL] = CreateConVar("zr_anticamp_update_interval", "1", "");
|
|
||||||
// Old Desc: How often to update player locations (in seconds).
|
|
||||||
|
|
||||||
// Auto-generate config file if it doesn't exist, then execute.
|
// Auto-generate config file if it doesn't exist, then execute.
|
||||||
AutoExecConfig(true, "zombiereloaded", "sourcemod/zombiereloaded");
|
AutoExecConfig(true, "zombiereloaded", "sourcemod/zombiereloaded");
|
||||||
@ -523,10 +492,6 @@ CvarsHook(bool:unhook = false)
|
|||||||
HookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
|
HookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
|
||||||
HookConVarChange(g_hLimitTeams, CvarsHookLocked);
|
HookConVarChange(g_hLimitTeams, CvarsHookLocked);
|
||||||
HookConVarChange(g_hRestartGame, CvarsHookRestartGame);
|
HookConVarChange(g_hRestartGame, CvarsHookRestartGame);
|
||||||
|
|
||||||
// Anticamp shtuff. (needs to be moved to anticamp if these hooks are necessary)
|
|
||||||
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP], AnticampHook);
|
|
||||||
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL], UpdateIntervalHook);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -552,10 +517,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
|||||||
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
|
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
|
||||||
|
|
||||||
// If log flag check fails, then don't log.
|
// If log flag check fails, then don't log.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".", LOG_FORMAT_TYPE_FULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If cvar is mp_limitteams, then continue.
|
// If cvar is mp_limitteams, then continue.
|
||||||
else if (cvar == g_hLimitTeams)
|
else if (cvar == g_hLimitTeams)
|
||||||
@ -570,10 +532,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
|||||||
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
|
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
|
||||||
|
|
||||||
// If log flag check fails, then don't log.
|
// If log flag check fails, then don't log.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".", LOG_FORMAT_TYPE_FULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,8 +560,5 @@ public CvarsHookRestartGame(Handle:cvar, const String:oldvalue[], const String:n
|
|||||||
RoundEndTerminateRound(delay);
|
RoundEndTerminateRound(delay);
|
||||||
|
|
||||||
// If log flag check fails, then don't log.
|
// If log flag check fails, then don't log.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
LogPrintToLog(_, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.", LOG_FORMAT_TYPE_FULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -24,23 +24,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of damage-related hooks.
|
* Array to store TraceAttack HookIDs.
|
||||||
*/
|
*/
|
||||||
enum DamageHooks
|
new g_iDamageTraceAttackHookID[MAXPLAYERS + 1] = {-1, ...};
|
||||||
{
|
|
||||||
Hook_TraceAttack, /** TraceAttack HookID */
|
|
||||||
Hook_OnTakeDamage, /** OnTakeDamage HookID */
|
|
||||||
}
|
|
||||||
|
|
||||||
new g_iDamageHookID[MAXPLAYERS + 1][DamageHooks];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Damage module init function.
|
* Array to store OnTakeDamage HookIDs.
|
||||||
*/
|
*/
|
||||||
DamageInit()
|
new g_iDamageOnTakeDamageHookID[MAXPLAYERS + 1] = {-1, ...};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook commands related to damage here.
|
||||||
|
*/
|
||||||
|
DamageOnCommandsHook()
|
||||||
{
|
{
|
||||||
// Create command callbacks (intercepts) for listed suicide commands.
|
// Create command callbacks (intercepts) for listed suicide commands.
|
||||||
decl String:suicidecmds[64];
|
decl String:suicidecmds[DAMAGE_SUICIDE_MAX_CMDS * DAMAGE_SUICIDE_MAX_LENGTH];
|
||||||
GetConVarString(g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds));
|
GetConVarString(g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds));
|
||||||
|
|
||||||
// Create array to store cmds
|
// Create array to store cmds
|
||||||
@ -66,8 +65,8 @@ DamageInit()
|
|||||||
DamageClientInit(client)
|
DamageClientInit(client)
|
||||||
{
|
{
|
||||||
// Hook damage callbacks.
|
// Hook damage callbacks.
|
||||||
g_iDamageHookID[client][Hook_TraceAttack] = ZRTools_HookTraceAttack(client, DamageTraceAttack);
|
g_iDamageTraceAttackHookID[client] = ZRTools_HookTraceAttack(client, DamageTraceAttack);
|
||||||
g_iDamageHookID[client][Hook_OnTakeDamage] = ZRTools_HookOnTakeDamage(client, DamageOnTakeDamage);
|
g_iDamageOnTakeDamageHookID[client] = ZRTools_HookOnTakeDamage(client, DamageOnTakeDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,9 +76,19 @@ DamageClientInit(client)
|
|||||||
*/
|
*/
|
||||||
DamageOnClientDisconnect(client)
|
DamageOnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
// Unhook damage callbacks.
|
// Unhook damage callbacks, and reset variables.
|
||||||
ZRTools_UnhookTraceAttack(g_iDamageHookID[client][Hook_TraceAttack]);
|
|
||||||
ZRTools_UnhookOnTakeDamage(g_iDamageHookID[client][Hook_OnTakeDamage]);
|
if (g_iDamageTraceAttackHookID[client] != -1)
|
||||||
|
{
|
||||||
|
ZRTools_UnhookTraceAttack(g_iDamageTraceAttackHookID[client]);
|
||||||
|
g_iDamageTraceAttackHookID[client] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_iDamageOnTakeDamageHookID[client] != -1)
|
||||||
|
{
|
||||||
|
ZRTools_UnhookOnTakeDamage(g_iDamageOnTakeDamageHookID[client]);
|
||||||
|
g_iDamageOnTakeDamageHookID[client] = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,14 +275,6 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
*/
|
*/
|
||||||
public Action:DamageSuicideIntercept(client, argc)
|
public Action:DamageSuicideIntercept(client, argc)
|
||||||
{
|
{
|
||||||
// Disabled.
|
|
||||||
/**
|
|
||||||
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
return Plugin_Continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// If zombie hasn't spawned, then stop.
|
// If zombie hasn't spawned, then stop.
|
||||||
if (!g_bZombieSpawned)
|
if (!g_bZombieSpawned)
|
||||||
{
|
{
|
||||||
@ -309,13 +310,10 @@ public Action:DamageSuicideIntercept(client, argc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tell client their command has been intercepted.
|
// Tell client their command has been intercepted.
|
||||||
ZR_ReplyToCommand(client, "Damage suicide intercept");
|
TranslationReplyToCommand(client, "Damage suicide intercept");
|
||||||
|
|
||||||
// Log attempt.
|
// Log suicide interception
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_DAMAGE))
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Damage", "Suicide Intercept", "\"%L\" attempted suicide.", client);
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Damage", "Suicide Intercept", "Player %N attempted suicide.", LOG_FORMAT_TYPE_FULL, client);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Block command.
|
// Block command.
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -66,9 +66,11 @@ EventHook(bool:unhook = false)
|
|||||||
*/
|
*/
|
||||||
public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(0, "Round objective");
|
// Print round objective to all clients.
|
||||||
|
TranslationPrintToChatAll(true, false, "General round objective");
|
||||||
|
|
||||||
// Forward event to sub-modules.
|
// Forward event to sub-modules.
|
||||||
|
OverlaysOnRoundStart();
|
||||||
RoundEndOnRoundStart();
|
RoundEndOnRoundStart();
|
||||||
InfectOnRoundStart();
|
InfectOnRoundStart();
|
||||||
SEffectsOnRoundStart();
|
SEffectsOnRoundStart();
|
||||||
@ -184,7 +186,24 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
|
|||||||
ZTeleOnClientSpawn(index);
|
ZTeleOnClientSpawn(index);
|
||||||
ZHPOnClientSpawn(index);
|
ZHPOnClientSpawn(index);
|
||||||
|
|
||||||
ZR_PrintToChat(index, "!zmenu reminder");
|
TranslationPrintToChat(index, "General zmenu reminder");
|
||||||
|
|
||||||
|
// Fire post player_spawn event.
|
||||||
|
CreateTimer(0.0, EventPlayerSpawnPost, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event callback (player_spawn)
|
||||||
|
* Client is spawning into the game. *Post
|
||||||
|
*
|
||||||
|
* @param event The event handle.
|
||||||
|
* @param name Name of the event.
|
||||||
|
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
|
||||||
|
*/
|
||||||
|
public Action:EventPlayerSpawnPost(Handle:timer, any:index)
|
||||||
|
{
|
||||||
|
// Forward event to modules.
|
||||||
|
SpawnProtectOnClientSpawnPost(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,11 +69,7 @@ HitgroupsLoad()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure.
|
// Log failure.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", pathhitgroups);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", LOG_FORMAT_TYPE_ERROR, pathhitgroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,16 +85,11 @@ HitgroupsLoad()
|
|||||||
*/
|
*/
|
||||||
HitgroupsValidateConfig()
|
HitgroupsValidateConfig()
|
||||||
{
|
{
|
||||||
// If log flag check fails, then don't log.
|
|
||||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KvRewind(kvHitgroups);
|
KvRewind(kvHitgroups);
|
||||||
if (!KvGotoFirstSubKey(kvHitgroups))
|
if (!KvGotoFirstSubKey(kvHitgroups))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Hitgroups", "Config Validation", "No hitgroups listed in hitgroups.txt, disabling hitgroup-based modules.", LOG_FORMAT_TYPE_FULL);
|
// Log that no data was loaded from hitgroup file.
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Hitgroups", "Config Validation", "No hitgroups listed in hitgroups.txt, disabling hitgroup-based modules.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ InfectOnClientDisconnect(client)
|
|||||||
InfectClient(randclient);
|
InfectClient(randclient);
|
||||||
|
|
||||||
// Tell client they have been randomly been chosen to replace disconnecting zombie.
|
// Tell client they have been randomly been chosen to replace disconnecting zombie.
|
||||||
ZR_PrintToChat(randclient, "Zombie replacement");
|
TranslationPrintToChat(randclient, "Infect disconnect");
|
||||||
|
|
||||||
// Destroy handle.
|
// Destroy handle.
|
||||||
CloseHandle(arrayEligibleClients);
|
CloseHandle(arrayEligibleClients);
|
||||||
@ -565,6 +565,22 @@ InfectClient(client, attacker = -1, bool:motherinfect = false)
|
|||||||
// TODO: A solution to stop confusing bots? Respawn and teleport?
|
// TODO: A solution to stop confusing bots? Respawn and teleport?
|
||||||
CS_SwitchTeam(client, CS_TEAM_T);
|
CS_SwitchTeam(client, CS_TEAM_T);
|
||||||
|
|
||||||
|
// If respawn is enabled, then teleport mother zombie back to spawnpoint.
|
||||||
|
if (motherinfect)
|
||||||
|
{
|
||||||
|
new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]);
|
||||||
|
if(zombierespawn)
|
||||||
|
{
|
||||||
|
ZTeleTeleportClient(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format infection message.
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Print message to client.
|
||||||
|
TranslationPrintToChat(client, "Infect infected");
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassOnClientInfected(client, motherinfect);
|
ClassOnClientInfected(client, motherinfect);
|
||||||
RoundEndOnClientInfected();
|
RoundEndOnClientInfected();
|
||||||
|
@ -30,13 +30,17 @@ JumpBoostOnClientJump(client)
|
|||||||
new Float:vecVelocity[3];
|
new Float:vecVelocity[3];
|
||||||
ToolsClientVelocity(client, vecVelocity, false);
|
ToolsClientVelocity(client, vecVelocity, false);
|
||||||
|
|
||||||
// Protect against bunnyhopping.
|
// Protect against bunnyhopping, if cvar is enabled.
|
||||||
|
new bool:bunnyhopprotect = GetConVarBool(g_hCvarsList[CVAR_JUMPBOOST_BUNNYHOP_PROTECT]);
|
||||||
|
if (bunnyhopprotect)
|
||||||
|
{
|
||||||
new Float:magnitude = SquareRoot(Pow(vecVelocity[0], 2.0) + Pow(vecVelocity[1], 2.0));
|
new Float:magnitude = SquareRoot(Pow(vecVelocity[0], 2.0) + Pow(vecVelocity[1], 2.0));
|
||||||
if (magnitude >= JUMPBOOST_FORWARD_VEL_MAX)
|
if (magnitude >= JUMPBOOST_FORWARD_VEL_MAX)
|
||||||
{
|
{
|
||||||
// Set distance multiplier to 0.
|
// Set distance multiplier to 0.
|
||||||
distance = 0.0;
|
distance = 0.0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Apply forward jump boost.
|
// Apply forward jump boost.
|
||||||
vecVelocity[0] *= distance;
|
vecVelocity[0] *= distance;
|
||||||
|
232
src/zr/log.inc
232
src/zr/log.inc
@ -22,225 +22,101 @@
|
|||||||
/**
|
/**
|
||||||
* @section Log format types
|
* @section Log format types
|
||||||
*/
|
*/
|
||||||
#define LOG_FORMAT_TYPE_SIMPLE 0 /** Simple log message. */
|
#define LOG_FORMAT_TYPE_NORMAL 1 /** Printed in normal log. */
|
||||||
#define LOG_FORMAT_TYPE_FULL 1 /** Full log message, printed in normal log. */
|
#define LOG_FORMAT_TYPE_DEBUG 2 /** Printed in normal log, flagged as debug. */
|
||||||
#define LOG_FORMAT_TYPE_ERROR 2 /** Full log message, printed in error log. */
|
#define LOG_FORMAT_TYPE_ERROR 3 /** Printed in error log. */
|
||||||
#define LOG_FORMAT_TYPE_FATALERROR 3 /** Full log message, stops the plugin and printed in error logs. */
|
#define LOG_FORMAT_TYPE_FATALERROR 4 /** Stops the plugin + LOG_FORMAT_TYPE_ERROR */
|
||||||
/**
|
/**
|
||||||
* @endsection
|
* @endsection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @section Logging flags.
|
* Print a formatted message to logs or error logs.
|
||||||
*/
|
|
||||||
#define LOG_CORE_EVENTS 1 /** Config validation, other core events. */
|
|
||||||
#define LOG_GAME_EVENTS 2 /** Admin commands, suicide prevention, anticamp kills. */
|
|
||||||
#define LOG_PLAYER_COMMANDS 4 /** Commands executed by non-admins: zspawn, teleport, class change. */
|
|
||||||
#define LOG_DEBUG 8 /** Debug messages. */
|
|
||||||
#define LOG_DEBUG_DETAIL 16 /** Debug messages with more detail. May cause spam. */
|
|
||||||
#define LOG_DEBUG_MAX_DETAIL 32 /** Low level debug messages. Causes spam! Only enable for a limited period right before and after testing. */
|
|
||||||
#define LOG_TO_ADMINS 64 /** Copy kinds of log events to admin chat. */
|
|
||||||
#define LOG_TO_CLIENT 128 /** Copy all log events related to a player, to the players console. */
|
|
||||||
#define LOG_IGNORE_CONSOLE 256 /** Don't log messages from the console (client 0). */
|
|
||||||
#define LOG_MODULES_ENABLED 512 /** Enable module based log control. Module logs overrides previous flags, including debug flags. */
|
|
||||||
#define LOG_MODULE_CORE 1024 /** The core of the plugin (startup, loading configs, etc.). Not really a module. */
|
|
||||||
#define LOG_MODULE_COMMANDS 2048 /** commands.inc */
|
|
||||||
#define LOG_MODULE_CLASSES 4096 /** Class system - playerclasses/ *.inc */
|
|
||||||
#define LOG_MODULE_ZOMBIE 8192 /** zombie.inc */
|
|
||||||
#define LOG_MODULE_SAYTRIGGERS 16384 /** sayhooks.inc */
|
|
||||||
#define LOG_MODULE_AMBIENTSOUNDS 32768 /** ambientsounds.inc */
|
|
||||||
#define LOG_MODULE_OVERLAYS 65536 /** overlays.inc */
|
|
||||||
#define LOG_MODULE_TELEPORT 131072 /** teleport.inc */
|
|
||||||
#define LOG_MODULE_WEAPONS 262144 /** Weapons module - weapons/ *.inc */
|
|
||||||
#define LOG_MODULE_HITGROUPS 524288 /** hitgroups.inc */
|
|
||||||
#define LOG_MODULE_ANTICAMP 1048576 /** anticamp.inc */
|
|
||||||
#define LOG_MODULE_DAMAGE 2097152 /** damage.inc */
|
|
||||||
#define LOG_MODULE_OFFSETS 4194304 /** offsets.inc */
|
|
||||||
/*
|
|
||||||
* @endsection
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @section Global handles for modules cvars.
|
|
||||||
*/
|
|
||||||
new Handle:g_hLog = INVALID_HANDLE;
|
|
||||||
new Handle:g_hLogFlags = INVALID_HANDLE;
|
|
||||||
/**
|
|
||||||
* @endsection
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log module init function.
|
|
||||||
*/
|
|
||||||
LogInit()
|
|
||||||
{
|
|
||||||
// Create modules cvars.
|
|
||||||
g_hLog = CreateConVar("zr_log", "1", "");
|
|
||||||
g_hLogFlags = CreateConVar("zr_logflags", "331", "");
|
|
||||||
// Old Desc: Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a formatted message with module and block info depending, on the type.
|
|
||||||
*
|
*
|
||||||
* @param client Specifies the client who triggered the event/command. Use
|
* @param type (Optional) Logging type. (See LOG_FORMAT_TYPE_* defines)
|
||||||
* -1 for core events like validation, etc.
|
* @param module Module the log belongs to.
|
||||||
* @param module what module the log event belongs to.
|
* @param description Short descriptive phrase to group together similar logs.
|
||||||
* @param block What function or code block the log is triggered from.
|
* @param text Text to print to log.
|
||||||
* @param message Log message. Formatted string.
|
* @param ... Formatting parameters.
|
||||||
* @param type Optional. What logging type or style to use. Options:
|
|
||||||
* LOG_FORMAT_TYPE_SIMPLE - Simple, no module or block info.
|
|
||||||
* LOG_FORMAT_TYPE_FULL - Full, with module and block info, printed in normal log.
|
|
||||||
* LOG_FORMAT_TYPE_ERROR - Full, printed in error log.
|
|
||||||
* LOG_FORMAT_TYPE_FATALERROR - Full, stops the plugin.
|
|
||||||
* @param any... Formatting parameters.
|
|
||||||
*/
|
*/
|
||||||
LogMessageFormatted(client, const String:module[], const String:block[], const String:message[], type = LOG_FORMAT_TYPE_FULL, any:...)
|
LogPrintToLog(type = LOG_FORMAT_TYPE_NORMAL, const String:module[], const String:description[], const String:text[], any:...)
|
||||||
{
|
{
|
||||||
// If logging is disabled, then stop.
|
// If logging is disabled, then stop.
|
||||||
new bool:log = GetConVarBool(g_hLog);
|
new bool:log = GetConVarBool(g_hCvarsList[CVAR_LOG]);
|
||||||
if (!log)
|
if (!log)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
decl String:logtext[LOG_MAX_LENGTH_FILE];
|
// If module is filtered, then stop.
|
||||||
|
decl String:filtermodules[256];
|
||||||
|
GetConVarString(g_hCvarsList[CVAR_LOG_FILTER_MODULES], filtermodules, sizeof(filtermodules));
|
||||||
|
|
||||||
// If client is invalid (console), and console log events are ignored, then stop.
|
if (StrContains(filtermodules, module, false) > -1)
|
||||||
if (client == 0 && LogCheckFlag(LOG_IGNORE_CONSOLE))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format log text.
|
// If description is filtered, then stop.
|
||||||
VFormat(logtext, sizeof(logtext), message, 6);
|
decl String:filterdescription[256];
|
||||||
|
GetConVarString(g_hCvarsList[CVAR_LOG_FILTER_DESCRIPTION], filterdescription, sizeof(filterdescription));
|
||||||
|
|
||||||
|
if (StrContains(filterdescription, description, false) > -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If debug is disabled, then stop.
|
||||||
|
new bool:filterdebug = GetConVarBool(g_hCvarsList[CVAR_LOG_FILTER_DEBUG]);
|
||||||
|
if (filterdebug && type == LOG_FORMAT_TYPE_DEBUG)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format extra parameters into the log buffer.
|
||||||
|
decl String:logbuffer[LOG_MAX_LENGTH_FILE];
|
||||||
|
VFormat(logbuffer, sizeof(logbuffer), text, 5);
|
||||||
|
|
||||||
|
// Format
|
||||||
|
Format(logbuffer, sizeof(logbuffer), "[%s]|[%s]: %s", module, description, logbuffer);
|
||||||
|
|
||||||
// Format other parameters onto the log text.
|
// Format other parameters onto the log text.
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
// Log type is simple.
|
// Log type is normal.
|
||||||
case LOG_FORMAT_TYPE_SIMPLE:
|
case LOG_FORMAT_TYPE_NORMAL:
|
||||||
{
|
{
|
||||||
LogMessage(logtext);
|
LogMessage(logbuffer);
|
||||||
}
|
|
||||||
// Log type is full.
|
|
||||||
case LOG_FORMAT_TYPE_FULL:
|
|
||||||
{
|
|
||||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
|
||||||
LogMessage(logtext);
|
|
||||||
}
|
}
|
||||||
// Log type is error.
|
// Log type is error.
|
||||||
case LOG_FORMAT_TYPE_ERROR:
|
case LOG_FORMAT_TYPE_ERROR:
|
||||||
{
|
{
|
||||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
LogError(logbuffer);
|
||||||
LogError(logtext);
|
|
||||||
}
|
}
|
||||||
|
// Log type is fatal error.
|
||||||
case LOG_FORMAT_TYPE_FATALERROR:
|
case LOG_FORMAT_TYPE_FATALERROR:
|
||||||
{
|
{
|
||||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
SetFailState(logbuffer);
|
||||||
SetFailState(logtext);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If log to admin flag is enabled, then print to admins.
|
// If print to admin cvar is enabled, then print to all connect admins.
|
||||||
if (LogCheckFlag(LOG_TO_ADMINS))
|
new bool:printadmins = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_ADMINS]);
|
||||||
|
if (printadmins)
|
||||||
{
|
{
|
||||||
// Print text to admins.
|
// Print text to admins.
|
||||||
LogToAdmins(logtext);
|
// Note: The phrase "Literal text" is a blank phrase to pass any string we want into it.
|
||||||
}
|
|
||||||
|
|
||||||
// If client is a valid client (but not console), and we log to client's then continue.
|
new bool:printchat = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CHAT]);
|
||||||
if (ZRIsClientValid(client) && LogCheckFlag(LOG_TO_CLIENT))
|
if (printchat)
|
||||||
{
|
{
|
||||||
// Set client as translation target.
|
TranslationPrintToChatAll(false, true, "Literal text", logbuffer);
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
// Print to client.
|
|
||||||
PrintToConsole(client, "%t %s", "ZR", logtext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogToAdmins(String:message[])
|
new bool:printconsole = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CONSOLE]);
|
||||||
|
if (printconsole)
|
||||||
{
|
{
|
||||||
decl String:buffer[LOG_MAX_LENGTH_CHAT];
|
TranslationPrintToConsoleAll(false, true, "Literal text", logbuffer);
|
||||||
|
|
||||||
// x = client index.
|
|
||||||
for (new x = 1; x < MaxClients; x++)
|
|
||||||
{
|
|
||||||
// If client isn't in-game, then stop.
|
|
||||||
if (!IsClientInGame(x))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If client isn't an admin, then stop.
|
|
||||||
if (!ZRIsClientAdmin(x))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set client as translation target.
|
|
||||||
SetGlobalTransTarget(x);
|
|
||||||
|
|
||||||
// Format message to admin, then print.
|
|
||||||
Format(buffer, sizeof(buffer), "%t %s", "ZR", message);
|
|
||||||
PrintToChat(x, buffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the zr_logflags cvar has a certain flag.
|
|
||||||
*
|
|
||||||
* @param flag The flag.
|
|
||||||
*/
|
|
||||||
bool:LogHasFlag(flag)
|
|
||||||
{
|
|
||||||
// Get log flags.
|
|
||||||
new logflags = GetConVarInt(g_hLogFlags);
|
|
||||||
|
|
||||||
// Return true if flag is found, false if not.
|
|
||||||
return bool:(logflags & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a log message should be written depending on log flags. If module
|
|
||||||
* overrides are enabled only logs with it's module flag set will be logged.
|
|
||||||
*
|
|
||||||
* @param logtype Log type flag.
|
|
||||||
* @param modulefilter Specifies what module the log event belongs to.
|
|
||||||
* @return True if the event should be logged, false otherwise.
|
|
||||||
*/
|
|
||||||
bool:LogCheckFlag(logtype, modulefilter = 0)
|
|
||||||
{
|
|
||||||
if (modulefilter && (logtype & LOG_MODULES_ENABLED))
|
|
||||||
{
|
|
||||||
return bool:(logtype & modulefilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return LogHasFlag(logtype);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles a log flag.
|
|
||||||
*
|
|
||||||
* @param flag The flag to toggle.
|
|
||||||
*/
|
|
||||||
LogToggleFlag(flag)
|
|
||||||
{
|
|
||||||
// Get current flags
|
|
||||||
new logflags = GetConVarInt(g_hLogFlags);
|
|
||||||
|
|
||||||
// If cvar contains flag, then remove it.
|
|
||||||
if (logflags & flag)
|
|
||||||
{
|
|
||||||
logflags = logflags - flag;
|
|
||||||
}
|
|
||||||
// If cvar doesn't have the flag, then add it.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logflags = logflags + flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set new value to logflags cvar.
|
|
||||||
SetConVarInt(g_hLogFlags, logflags);
|
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,6 @@ ModelsLoad()
|
|||||||
*/
|
*/
|
||||||
ModelsPrepModels()
|
ModelsPrepModels()
|
||||||
{
|
{
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE);
|
|
||||||
|
|
||||||
// Get models file path.
|
// Get models file path.
|
||||||
decl String:pathmodels[PLATFORM_MAX_PATH];
|
decl String:pathmodels[PLATFORM_MAX_PATH];
|
||||||
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_MODELS, pathmodels);
|
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_MODELS, pathmodels);
|
||||||
@ -51,7 +48,7 @@ ModelsPrepModels()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure and stop plugin.
|
// Log failure and stop plugin.
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Fatal error: Missing models file: \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: Missing models file: \"%s\"", pathmodels);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If model array exists, then destroy it.
|
// If model array exists, then destroy it.
|
||||||
@ -65,7 +62,7 @@ ModelsPrepModels()
|
|||||||
// If array couldn't be created, then fail.
|
// If array couldn't be created, then fail.
|
||||||
if (arrayModelsList == INVALID_HANDLE)
|
if (arrayModelsList == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Fatal error: Error parsing \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: Error parsing \"%s\"", pathmodels);
|
||||||
}
|
}
|
||||||
|
|
||||||
new modelcount;
|
new modelcount;
|
||||||
@ -155,26 +152,17 @@ ModelsPrepModels()
|
|||||||
x--;
|
x--;
|
||||||
|
|
||||||
// Log missing model files.
|
// Log missing model files.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Models", "Config Validation", "Missing model files on server (%s)", modelbase);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Missing model files on server (%s)", LOG_FORMAT_TYPE_ERROR, modelbase);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log model validation info.
|
// Log model validation info.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", modelcount, modelvalidcount, modelcount - modelvalidcount);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", LOG_FORMAT_TYPE_FULL, modelcount, modelvalidcount, modelcount - modelvalidcount);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If none of the model paths are valid, then log and fail.
|
// If none of the model paths are valid, then log and fail.
|
||||||
if (!modelvalidcount)
|
if (!modelvalidcount)
|
||||||
{
|
{
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: No usable model paths in %s", pathmodels);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "No usable model paths in %s", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,9 +171,6 @@ ModelsPrepModels()
|
|||||||
*/
|
*/
|
||||||
ModelsPrepDownloads()
|
ModelsPrepDownloads()
|
||||||
{
|
{
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE);
|
|
||||||
|
|
||||||
// Get downloads file path.
|
// Get downloads file path.
|
||||||
decl String:pathdownloads[PLATFORM_MAX_PATH];
|
decl String:pathdownloads[PLATFORM_MAX_PATH];
|
||||||
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_DOWNLOADS, pathdownloads);
|
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_DOWNLOADS, pathdownloads);
|
||||||
@ -194,10 +179,7 @@ ModelsPrepDownloads()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log error, then stop.
|
// Log error, then stop.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing downloads file: \"%s\"", pathdownloads);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Missing downloads file: \"%s\"", LOG_FORMAT_TYPE_ERROR, pathdownloads);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -207,10 +189,7 @@ ModelsPrepDownloads()
|
|||||||
// If array couldn't be created, then fail.
|
// If array couldn't be created, then fail.
|
||||||
if (arrayModelsList == INVALID_HANDLE)
|
if (arrayModelsList == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Error parsing \"%s\"", pathdownloads);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Error parsing \"%s\"", LOG_FORMAT_TYPE_ERROR, pathdownloads);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new downloadcount;
|
new downloadcount;
|
||||||
@ -238,11 +217,7 @@ ModelsPrepDownloads()
|
|||||||
// Backtrack one index, because we deleted it out from under the loop.
|
// Backtrack one index, because we deleted it out from under the loop.
|
||||||
x--;
|
x--;
|
||||||
|
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing file \"%s\"", downloadpath);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Missing file \"%s\"", LOG_FORMAT_TYPE_ERROR, downloadpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +229,5 @@ ModelsPrepDownloads()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log model validation info.
|
// Log model validation info.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", LOG_FORMAT_TYPE_FULL, downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
284
src/zr/overlays.inc
Normal file
284
src/zr/overlays.inc
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
/*
|
||||||
|
* ============================================================================
|
||||||
|
*
|
||||||
|
* Zombie:Reloaded
|
||||||
|
*
|
||||||
|
* File: overlays.inc
|
||||||
|
* Type: Core
|
||||||
|
* Description: Overlay system, separating different types into "overlay channels."
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum dx level required to see overlays.
|
||||||
|
*/
|
||||||
|
#define OVERLAYS_DXL_MIN 90
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum amount of overlay channels.
|
||||||
|
*/
|
||||||
|
#define OVERLAYS_CHANNEL_MAX 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All possible overlay channels, in order of priority.
|
||||||
|
*/
|
||||||
|
enum OverlaysChannel
|
||||||
|
{
|
||||||
|
OVERLAYS_CHANNEL_NONE = -1, /** Client has no overlay */
|
||||||
|
OVERLAYS_CHANNEL_ROUNDEND = 0, /** Round win overlay */
|
||||||
|
OVERLAYS_CHANNEL_CLASSES = 1, /** Class overlay */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global variable to store a convar query cookie
|
||||||
|
*/
|
||||||
|
new QueryCookie:mat_dxlevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DirectX level of a client.
|
||||||
|
*/
|
||||||
|
new g_iOverlaysDXL[MAXPLAYERS + 1];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array to track overlay channel state on each client.
|
||||||
|
*/
|
||||||
|
new bool:g_bOverlayChannel[MAXPLAYERS + 1][OverlaysChannel];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array to store overlay path for each channel.
|
||||||
|
*/
|
||||||
|
new String:g_strOverlayPath[MAXPLAYERS + 1][OverlaysChannel][PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create variable to store global timer handle.
|
||||||
|
*/
|
||||||
|
new Handle:tOverlays = INVALID_HANDLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map is starting.
|
||||||
|
*/
|
||||||
|
OverlaysOnMapStart()
|
||||||
|
{
|
||||||
|
// Reset timer handle.
|
||||||
|
tOverlays = INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client is joining the server.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
OverlaysClientInit(client)
|
||||||
|
{
|
||||||
|
// x = channel index.
|
||||||
|
for (new x = 0; x < OVERLAYS_CHANNEL_MAX; x++)
|
||||||
|
{
|
||||||
|
// Disable all channels, and reset.
|
||||||
|
OverlaysClientSetChannelState(client, OverlaysChannel:x, false, false, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get client's DX level.
|
||||||
|
OverlaysGetClientDXLevel(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds DX level of a client.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
OverlaysGetClientDXLevel(client)
|
||||||
|
{
|
||||||
|
// If client is fake (or bot), then stop.
|
||||||
|
if (IsFakeClient(client))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query mat_dxlevel on client.
|
||||||
|
mat_dxlevel = QueryClientConVar(client, "mat_dxlevel", OverlaysQueryClientDXLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query callback function.
|
||||||
|
*
|
||||||
|
* @param cookie Unique cookie of the query.
|
||||||
|
* @param client The client index.
|
||||||
|
* @param result The result of the query (see console.inc enum ConVarQueryResult)
|
||||||
|
* @param cvarName Name of the cvar.
|
||||||
|
* @param cvarValue Value of the cvar.
|
||||||
|
*/
|
||||||
|
public OverlaysQueryClientDXLevel(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
|
||||||
|
{
|
||||||
|
// If query cookie does not match cookie given by mat_dxlevel query, then stop, this isn't our query.
|
||||||
|
if (cookie != mat_dxlevel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset dxLevel.
|
||||||
|
g_iOverlaysDXL[client] = 0;
|
||||||
|
|
||||||
|
// If result is any other than ConVarQuery_Okay, then stop.
|
||||||
|
if (result != ConVarQuery_Okay)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy cvar value to dxLevel array.
|
||||||
|
g_iOverlaysDXL[client] = StringToInt(cvarValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The round is starting.
|
||||||
|
*/
|
||||||
|
OverlaysOnRoundStart()
|
||||||
|
{
|
||||||
|
// If timer is running, kill it.
|
||||||
|
if (tOverlays != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
KillTimer(tOverlays);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If antistick is disabled, then stop.
|
||||||
|
new Float:overlaysupdate = GetConVarFloat(g_hCvarsList[CVAR_OVERLAYS_UPDATE_TIME]);
|
||||||
|
if (overlaysupdate <= 0.0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start repeating timer.
|
||||||
|
tOverlays = CreateTimer(overlaysupdate, OverlaysTimer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update overlay on a client. (Displays highest priority overlays first, if enabled.)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param channel (Optional) The channel overlay to update.
|
||||||
|
*/
|
||||||
|
OverlaysClientUpdateOverlay(client, OverlaysChannel:channel = OVERLAYS_CHANNEL_NONE)
|
||||||
|
{
|
||||||
|
// Find highest priority, enabled, overlay channel of client.
|
||||||
|
if (channel == OVERLAYS_CHANNEL_NONE)
|
||||||
|
{
|
||||||
|
channel = OverlaysClientFindChannel(client);
|
||||||
|
}
|
||||||
|
// Stop here if client has no overlay channel enabled.
|
||||||
|
if (channel == OVERLAYS_CHANNEL_NONE)
|
||||||
|
{
|
||||||
|
// Clear any existing overlay from screen.
|
||||||
|
ClientCommand(client, "r_screenoverlay \"\"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If dxLevel is 0, then query on client failed, so try again, then stop.
|
||||||
|
if (!g_iOverlaysDXL[client])
|
||||||
|
{
|
||||||
|
// Query dxlevel cvar, again.
|
||||||
|
OverlaysGetClientDXLevel(client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client doesn't meet DXLevel requirement, then tell client, then stop.
|
||||||
|
if (g_iOverlaysDXL[client] < OVERLAYS_DXL_MIN)
|
||||||
|
{
|
||||||
|
TranslationPrintCenterText(client, "Overlays not supported", g_iOverlaysDXL[client], OVERLAYS_DXL_MIN);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display overlay to client.
|
||||||
|
ClientCommand(client, "r_screenoverlay %s", g_strOverlayPath[client][channel]);
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlaysChannel:OverlaysClientFindChannel(client)
|
||||||
|
{
|
||||||
|
// x = channel index.
|
||||||
|
for (new x = 0; x < OVERLAYS_CHANNEL_MAX; x++)
|
||||||
|
{
|
||||||
|
// Convert to OverlaysChannel datatype.
|
||||||
|
new OverlaysChannel:channel = OverlaysChannel:x;
|
||||||
|
|
||||||
|
if (OverlaysClientGetChannelState(client, channel))
|
||||||
|
{
|
||||||
|
// Return channel.
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return OVERLAYS_CHANNEL_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle or set new value to a channel state of a client.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param channel The channel to change state of.
|
||||||
|
* @param toggle Set to true to toggle state, false to use value param.
|
||||||
|
* @param value (Optional) New value of the state, only used if toggle is false.
|
||||||
|
*/
|
||||||
|
bool:OverlaysClientSetChannelState(client, OverlaysChannel:channel, bool:update = false, bool:toggle = true, bool:value = false, bool:reset = false)
|
||||||
|
{
|
||||||
|
// Toggle or set new state to channel of a client.
|
||||||
|
g_bOverlayChannel[client][channel] = toggle ? !g_bOverlayChannel[client][channel] : value;
|
||||||
|
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
// Update client overlay.
|
||||||
|
OverlaysClientUpdateOverlay(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reset)
|
||||||
|
{
|
||||||
|
OverlaysClientSetChannelPath(client, channel, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return new value.
|
||||||
|
return g_bOverlayChannel[client][channel];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current value of a channel state of a client.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param channel The channel to get state of.
|
||||||
|
*/
|
||||||
|
bool:OverlaysClientGetChannelState(client, OverlaysChannel:channel)
|
||||||
|
{
|
||||||
|
// Return current value.
|
||||||
|
return g_bOverlayChannel[client][channel];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set overlay path for a channel.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param channel The channel to set path on.
|
||||||
|
* @param path Path to overlay.
|
||||||
|
*/
|
||||||
|
OverlaysClientSetChannelPath(client, OverlaysChannel:channel, const String:path[])
|
||||||
|
{
|
||||||
|
// Copy path to the overlay channel's path string.
|
||||||
|
strcopy(g_strOverlayPath[client][channel], PLATFORM_MAX_PATH, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer callback, updates overlay on each client.
|
||||||
|
*
|
||||||
|
* @param timer The timer handle.
|
||||||
|
*/
|
||||||
|
public Action:OverlaysTimer(Handle:timer)
|
||||||
|
{
|
||||||
|
// x = client index
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in game, then stop.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update client's overlay.
|
||||||
|
OverlaysClientUpdateOverlay(x);
|
||||||
|
}
|
||||||
|
}
|
@ -136,21 +136,6 @@ bool:ClassApplyAlpha(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
|
|||||||
*/
|
*/
|
||||||
bool:ClassApplyOverlay(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
|
bool:ClassApplyOverlay(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
|
||||||
{
|
{
|
||||||
// If dxLevel is 0, then query on client failed, so try again, then stop.
|
|
||||||
if (!dxLevel[client])
|
|
||||||
{
|
|
||||||
// Query dxlevel cvar.
|
|
||||||
RoundEndGetClientDXLevel(client);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If client doesn't meet minimum requirement, then print unsupported text.
|
|
||||||
if (dxLevel[client] < GENERAL_DXLEVEL_MIN)
|
|
||||||
{
|
|
||||||
ZR_PrintCenterText(client, "DX90 not supported", dxLevel[client], GENERAL_DXLEVEL_MIN);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
decl String:overlaypath[PLATFORM_MAX_PATH];
|
decl String:overlaypath[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
// Get the overlay path from the specified cache.
|
// Get the overlay path from the specified cache.
|
||||||
|
@ -92,10 +92,20 @@ public Action:Command_ClassDump(client, argc)
|
|||||||
// Dump the specified cache.
|
// Dump the specified cache.
|
||||||
ReplyToCommand(client, "DUMPING CACHE: \"%s\" (%d classes total)\n========================================\n", type, ClassCount);
|
ReplyToCommand(client, "DUMPING CACHE: \"%s\" (%d classes total)\n========================================\n", type, ClassCount);
|
||||||
ClassDumpData(index, cachetype, buffer, sizeof(buffer));
|
ClassDumpData(index, cachetype, buffer, sizeof(buffer));
|
||||||
ZR_ReplyToCommandLong(client, buffer);
|
|
||||||
|
// Print all data to client.
|
||||||
|
decl String:partbuffer[1024];
|
||||||
|
new pos;
|
||||||
|
new cellswritten = 1; // Initialize for the loop.
|
||||||
|
|
||||||
|
while (cellswritten)
|
||||||
|
{
|
||||||
|
cellswritten = strcopy(partbuffer, sizeof(partbuffer), buffer[pos]);
|
||||||
|
ReplyToCommand(client, partbuffer);
|
||||||
|
pos += cellswritten;
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +29,18 @@ ClassClientInit(client)
|
|||||||
// Set default class indexes on the player.
|
// Set default class indexes on the player.
|
||||||
ClassClientSetDefaultIndexes(client);
|
ClassClientSetDefaultIndexes(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Forward event to sub-modules
|
||||||
|
ClassOverlayClientInit(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook commands related to classes here.
|
||||||
|
*/
|
||||||
|
ClassOnCommandsHook()
|
||||||
|
{
|
||||||
|
// Forward event to sub-modules.
|
||||||
|
ClassOverlayOnCommandsHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,9 +56,13 @@ ClassOnClientDisconnect(client)
|
|||||||
{
|
{
|
||||||
// Disable class attributes with timers.
|
// Disable class attributes with timers.
|
||||||
ClassHealthRegenStop(client);
|
ClassHealthRegenStop(client);
|
||||||
ClassOverlayStop(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client is spawning into the game.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
ClassOnClientSpawn(client)
|
ClassOnClientSpawn(client)
|
||||||
{
|
{
|
||||||
// Check if the player is alive.
|
// Check if the player is alive.
|
||||||
@ -78,12 +94,12 @@ ClassOnClientSpawn(client)
|
|||||||
// Mark zombie class as selected.
|
// Mark zombie class as selected.
|
||||||
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
|
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
|
||||||
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
|
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
|
||||||
ZR_PrintToChat(client, "Auto-assign", classname);
|
TranslationPrintToChat(client, "Classes random assignment", classname);
|
||||||
|
|
||||||
// Mark human class as selected.
|
// Mark human class as selected.
|
||||||
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
|
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
|
||||||
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
|
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
|
||||||
ZR_PrintToChat(client, "Auto-assign", classname);
|
TranslationPrintToChat(client, "Classes random assignment", classname);
|
||||||
|
|
||||||
// Update player cache with the human class data, and apply it.
|
// Update player cache with the human class data, and apply it.
|
||||||
ClassReloadPlayerCache(client, randomhuman);
|
ClassReloadPlayerCache(client, randomhuman);
|
||||||
@ -111,13 +127,18 @@ ClassOnClientSpawn(client)
|
|||||||
ClassReloadPlayerCache(client, ClassGetActiveIndex(client));
|
ClassReloadPlayerCache(client, ClassGetActiveIndex(client));
|
||||||
ClassApplyAttributes(client);
|
ClassApplyAttributes(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Forward event to sub-modules.
|
||||||
|
ClassOverlayOnClientSpawn(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassOnClientDeath(client)
|
ClassOnClientDeath(client)
|
||||||
{
|
{
|
||||||
// Disable class attributes with timers.
|
// Disable class attributes with timers.
|
||||||
ClassHealthRegenStop(client);
|
ClassHealthRegenStop(client);
|
||||||
ClassOverlayStop(client);
|
|
||||||
|
// Disable overlay.
|
||||||
|
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true);
|
||||||
|
|
||||||
// Set client's FOV back to normal.
|
// Set client's FOV back to normal.
|
||||||
ToolsSetClientDefaultFOV(client, 90);
|
ToolsSetClientDefaultFOV(client, 90);
|
||||||
@ -129,11 +150,13 @@ ClassOnClientInfected(client, bool:motherzombie = false)
|
|||||||
|
|
||||||
// Disable class attributes with timers.
|
// Disable class attributes with timers.
|
||||||
ClassHealthRegenStop(client);
|
ClassHealthRegenStop(client);
|
||||||
ClassOverlayStop(client);
|
|
||||||
|
|
||||||
// Update the players cache with zombie attributes.
|
// Update the players cache with zombie attributes.
|
||||||
ClassReloadPlayerCache(client, classindex);
|
ClassReloadPlayerCache(client, classindex);
|
||||||
|
|
||||||
// Apply the new attributes.
|
// Apply the new attributes.
|
||||||
ClassApplyAttributes(client, motherzombie);
|
ClassApplyAttributes(client, motherzombie);
|
||||||
|
|
||||||
|
// Forward event to sub-modules.
|
||||||
|
ClassOverlayOnClientInfected(client);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ ClassMenuMain(client)
|
|||||||
new Handle:menu = CreateMenu(ClassMenuMainHandle);
|
new Handle:menu = CreateMenu(ClassMenuMainHandle);
|
||||||
|
|
||||||
SetGlobalTransTarget(client);
|
SetGlobalTransTarget(client);
|
||||||
SetMenuTitle(menu, "%t\n", "!zclass title");
|
SetMenuTitle(menu, "%t\n", "Classes menu title");
|
||||||
|
|
||||||
decl String:zombieclass[128];
|
decl String:zombieclass[128];
|
||||||
decl String:humanclass[128];
|
decl String:humanclass[128];
|
||||||
@ -55,18 +55,18 @@ ClassMenuMain(client)
|
|||||||
if (ClassPlayerInAdminMode[client])
|
if (ClassPlayerInAdminMode[client])
|
||||||
{
|
{
|
||||||
// Notify the player.
|
// Notify the player.
|
||||||
Format(inadminmnode, sizeof(inadminmnode), "%t\n", "!zclass admin mode enabled");
|
Format(inadminmnode, sizeof(inadminmnode), "%t\n", "Classes admin mode enabled");
|
||||||
AddMenuItem(menu, "", inadminmnode, ITEMDRAW_RAWLINE);
|
AddMenuItem(menu, "", inadminmnode, ITEMDRAW_RAWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// List zombie class options.
|
// List zombie class options.
|
||||||
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES], zombieclass, sizeof(zombieclass), ZR_CLASS_CACHE_MODIFIED);
|
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES], zombieclass, sizeof(zombieclass), ZR_CLASS_CACHE_MODIFIED);
|
||||||
Format(zombieselect, sizeof(zombieselect), "%t\n %s", "!zclass zombie", zombieclass);
|
Format(zombieselect, sizeof(zombieselect), "%t\n %s", "Classes menu zombie", zombieclass);
|
||||||
AddMenuItem(menu, "", zombieselect, zombie_itemdraw);
|
AddMenuItem(menu, "", zombieselect, zombie_itemdraw);
|
||||||
|
|
||||||
// List human class options.
|
// List human class options.
|
||||||
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_HUMANS], humanclass, sizeof(humanclass), ZR_CLASS_CACHE_MODIFIED);
|
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_HUMANS], humanclass, sizeof(humanclass), ZR_CLASS_CACHE_MODIFIED);
|
||||||
Format(humanselect, sizeof(humanselect), "%t\n %s", "!zclass human", humanclass);
|
Format(humanselect, sizeof(humanselect), "%t\n %s", "Classes menu human", humanclass);
|
||||||
AddMenuItem(menu, "", humanselect, human_itemdraw);
|
AddMenuItem(menu, "", humanselect, human_itemdraw);
|
||||||
|
|
||||||
// Only display admin class options for admins, and if admin classes exist.
|
// Only display admin class options for admins, and if admin classes exist.
|
||||||
@ -74,7 +74,7 @@ ClassMenuMain(client)
|
|||||||
{
|
{
|
||||||
// List admin class options.
|
// List admin class options.
|
||||||
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ADMINS], adminclass, sizeof(adminclass), ZR_CLASS_CACHE_MODIFIED);
|
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ADMINS], adminclass, sizeof(adminclass), ZR_CLASS_CACHE_MODIFIED);
|
||||||
Format(adminselect, sizeof(adminselect), "%t\n %s", "!zclass admin", adminclass);
|
Format(adminselect, sizeof(adminselect), "%t\n %s", "Classes menu admin", adminclass);
|
||||||
AddMenuItem(menu, "", adminselect, admin_itemdraw);
|
AddMenuItem(menu, "", adminselect, admin_itemdraw);
|
||||||
|
|
||||||
// Set admin mode status string.
|
// Set admin mode status string.
|
||||||
@ -91,7 +91,7 @@ ClassMenuMain(client)
|
|||||||
AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE);
|
AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE);
|
||||||
|
|
||||||
// Show admin mode toggle option.
|
// Show admin mode toggle option.
|
||||||
Format(toggleadminmode, sizeof(toggleadminmode), "%t\n %s", "!zclass admin mode toggle", adminmode);
|
Format(toggleadminmode, sizeof(toggleadminmode), "%t\n %s", "Classes menu admin mode toggle", adminmode);
|
||||||
AddMenuItem(menu, "", toggleadminmode, admin_itemdraw);
|
AddMenuItem(menu, "", toggleadminmode, admin_itemdraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,15 +174,15 @@ ClassMenuSelect(client, teamid)
|
|||||||
{
|
{
|
||||||
case ZR_CLASS_TEAM_ZOMBIES:
|
case ZR_CLASS_TEAM_ZOMBIES:
|
||||||
{
|
{
|
||||||
Format(title, sizeof(title), "%t\n", "!zclass zombie");
|
Format(title, sizeof(title), "%t\n", "Classes menu zombie");
|
||||||
}
|
}
|
||||||
case ZR_CLASS_TEAM_HUMANS:
|
case ZR_CLASS_TEAM_HUMANS:
|
||||||
{
|
{
|
||||||
Format(title, sizeof(title), "%t\n", "!zclass human");
|
Format(title, sizeof(title), "%t\n", "Classes menu human");
|
||||||
}
|
}
|
||||||
case ZR_CLASS_TEAM_ADMINS:
|
case ZR_CLASS_TEAM_ADMINS:
|
||||||
{
|
{
|
||||||
Format(title, sizeof(title), "%t\n", "!zclass admin");
|
Format(title, sizeof(title), "%t\n", "Classes menu admin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetMenuTitle(menu, title);
|
SetMenuTitle(menu, title);
|
||||||
@ -213,7 +213,8 @@ ClassMenuSelect(client, teamid)
|
|||||||
{
|
{
|
||||||
// No classes found. Display message. The main class menu should
|
// No classes found. Display message. The main class menu should
|
||||||
// prevent this from happening, but we print a message just in case.
|
// prevent this from happening, but we print a message just in case.
|
||||||
Format(menuitem, sizeof(menuitem), "%t\n", "!zclass not found");
|
// THIS TRANSLATION PHRASES IS NOT IN FILE.
|
||||||
|
Format(menuitem, sizeof(menuitem), "%t\n", "Classes menu not found");
|
||||||
AddMenuItem(menu, classname, menuitem, ITEMDRAW_RAWLINE);
|
AddMenuItem(menu, classname, menuitem, ITEMDRAW_RAWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +230,7 @@ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
|
|||||||
decl String:classname[64];
|
decl String:classname[64];
|
||||||
new classindex;
|
new classindex;
|
||||||
new teamid;
|
new teamid;
|
||||||
new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_MENU_AUTOCLOSE]);
|
new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_AUTOCLOSE]);
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
@ -11,46 +11,100 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer handles for redisplaying overlays on clients.
|
* @section Suicide intercept defines.
|
||||||
|
*/
|
||||||
|
#define CLASSOVERLAY_TOGGLE_MAX_CMDS 5
|
||||||
|
#define CLASSOVERLAY_TOGGLE_MAX_LENGTH 16
|
||||||
|
/**
|
||||||
|
* @endsection
|
||||||
*/
|
*/
|
||||||
new Handle:tOverlay[MAXPLAYERS + 1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies if a client have a overlay.
|
* Array to store default class overlay enable flag.
|
||||||
*/
|
*/
|
||||||
new bool:bClientHasOverlay[MAXPLAYERS + 1];
|
new bool:h_bClassOverlay[MAXPLAYERS + 1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells whether the overlay is on or not.
|
* Client is joining the server.
|
||||||
*/
|
|
||||||
new bool:bClientOverlayOn[MAXPLAYERS + 1];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path to the currently active overlay.
|
|
||||||
*/
|
|
||||||
new String:ActiveOverlay[MAXPLAYERS + 1][PLATFORM_MAX_PATH];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if the have a overlay path specified.
|
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @return True if a overlay path is specified, false otherwise.
|
|
||||||
*/
|
*/
|
||||||
bool:ClassClientHasOverlay(client)
|
ClassOverlayClientInit(client)
|
||||||
{
|
{
|
||||||
return bClientHasOverlay[client];
|
// Get overlay toggle cvar values.
|
||||||
|
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
|
||||||
|
new bool:overlaydefault = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_DEFAULT]);
|
||||||
|
|
||||||
|
// Apply default value if toggle is enabled, default to true if toggle is disabled.
|
||||||
|
h_bClassOverlay[client] = overlaytoggle ? overlaydefault : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the overlay is currently on or not.
|
* Hook commands related to overlay here.
|
||||||
|
*/
|
||||||
|
ClassOverlayOnCommandsHook()
|
||||||
|
{
|
||||||
|
// Create command callbacks (intercepts) for listed suicide commands.
|
||||||
|
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||||
|
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
||||||
|
|
||||||
|
// Create array to store cmds
|
||||||
|
new String:arrayCmds[CLASSOVERLAY_TOGGLE_MAX_CMDS][CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||||
|
|
||||||
|
// Explode string into array indexes.
|
||||||
|
new cmdcount = ExplodeString(togglecmds, ", ", arrayCmds, CLASSOVERLAY_TOGGLE_MAX_CMDS, CLASSOVERLAY_TOGGLE_MAX_LENGTH);
|
||||||
|
|
||||||
|
// x = array index.
|
||||||
|
// arrayCmds[x] = suicide command.
|
||||||
|
for (new x = 0; x <= cmdcount - 1; x++)
|
||||||
|
{
|
||||||
|
// Prepare intercept for this command.
|
||||||
|
RegConsoleCmd(arrayCmds[x], ClassOverlayEnableCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client is spawning into the game.
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @return True if on, false otherwise.
|
|
||||||
*/
|
*/
|
||||||
bool:ClassOverlayIsOn(client)
|
ClassOverlayOnClientSpawn(client)
|
||||||
{
|
{
|
||||||
return bClientOverlayOn[client];
|
// If overlay toggle is enabled and class has an overlay, then send center text.
|
||||||
|
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
|
||||||
|
|
||||||
|
decl String:overlaypath[PLATFORM_MAX_PATH];
|
||||||
|
ClassGetOverlayPath(client, overlaypath, sizeof(overlaypath));
|
||||||
|
|
||||||
|
if (overlaytoggle && overlaypath[0])
|
||||||
|
{
|
||||||
|
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||||
|
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
||||||
|
|
||||||
|
TranslationPrintHUDText(client, "Classes overlay toggle", togglecmds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client has been infected.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
ClassOverlayOnClientInfected(client)
|
||||||
|
{
|
||||||
|
// If overlay toggle is enabled and class has an overlay, then send center text.
|
||||||
|
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
|
||||||
|
|
||||||
|
decl String:overlaypath[PLATFORM_MAX_PATH];
|
||||||
|
ClassGetOverlayPath(client, overlaypath, sizeof(overlaypath));
|
||||||
|
|
||||||
|
if (overlaytoggle && overlaypath[0])
|
||||||
|
{
|
||||||
|
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||||
|
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
||||||
|
|
||||||
|
TranslationPrintCenterText(client, "Classes overlay toggle", togglecmds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassOverlayInitialize(client, const String:overlay[])
|
ClassOverlayInitialize(client, const String:overlay[])
|
||||||
@ -60,57 +114,34 @@ ClassOverlayInitialize(client, const String:overlay[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(overlay) == 0)
|
// If overlay path is empty, then disable channel, then stop.
|
||||||
|
if (!overlay[0])
|
||||||
{
|
{
|
||||||
bClientHasOverlay[client] = false;
|
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true);
|
||||||
}
|
return;
|
||||||
else
|
|
||||||
{
|
|
||||||
bClientHasOverlay[client] = true;
|
|
||||||
strcopy(ActiveOverlay[client], PLATFORM_MAX_PATH, overlay);
|
|
||||||
|
|
||||||
ClassOverlayStart(client);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassOverlayStart(client)
|
// Display class overlays.
|
||||||
{
|
OverlaysClientSetChannelPath(client, OVERLAYS_CHANNEL_CLASSES, overlay);
|
||||||
// Kill timer if it exist.
|
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, h_bClassOverlay[client]);
|
||||||
if (tOverlay[client] != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
KillTimer(tOverlay[client]);
|
|
||||||
tOverlay[client] = INVALID_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientCommand(client, "r_screenoverlay \"%s\"", ActiveOverlay[client]);
|
/**
|
||||||
bClientOverlayOn[client] = true;
|
* Command callback (See zr_classes_overlay_togglecmds)
|
||||||
|
* Toggles nightvision of a client.
|
||||||
new Float:redisplay = GetConVarFloat(g_hCvarsList[CVAR_OVERLAY_REDISPLAY]);
|
*
|
||||||
tOverlay[client] = CreateTimer(redisplay, ClassOverlayTimer, client, TIMER_REPEAT);
|
* @param client The client index.
|
||||||
}
|
* @param argc Argument count.
|
||||||
|
*/
|
||||||
ClassOverlayStop(client)
|
public Action:ClassOverlayEnableCommand(client, argc)
|
||||||
{
|
{
|
||||||
// Kill timer if it exist.
|
// If overlay toggle is disabled, then stop.
|
||||||
if (tOverlay[client] != INVALID_HANDLE)
|
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
|
||||||
|
if (!overlaytoggle)
|
||||||
{
|
{
|
||||||
KillTimer(tOverlay[client]);
|
return;
|
||||||
tOverlay[client] = INVALID_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable client overlay.
|
// Toggle current overlay channel, and retrieve new value.
|
||||||
ClientCommand(client, "r_screenoverlay \"\"");
|
h_bClassOverlay[client] = OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, true);
|
||||||
bClientOverlayOn[client] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action:ClassOverlayTimer(Handle:timer, any:client)
|
|
||||||
{
|
|
||||||
if (!IsClientInGame(client) || !InfectIsClientInfected(client))
|
|
||||||
{
|
|
||||||
tOverlay[client] = INVALID_HANDLE;
|
|
||||||
return Plugin_Stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientCommand(client, "r_screenoverlay \"%s\"", ActiveOverlay[client]);
|
|
||||||
return Plugin_Continue;
|
|
||||||
}
|
}
|
||||||
|
@ -674,9 +674,6 @@ ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
|
|||||||
decl String:classname[64];
|
decl String:classname[64];
|
||||||
new classindex;
|
new classindex;
|
||||||
|
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES);
|
|
||||||
|
|
||||||
// Get the default class name from the correct CVAR depending on teamid.
|
// Get the default class name from the correct CVAR depending on teamid.
|
||||||
switch (teamid)
|
switch (teamid)
|
||||||
{
|
{
|
||||||
@ -740,20 +737,13 @@ ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
|
|||||||
// in the specified team, and log a warning.
|
// in the specified team, and log a warning.
|
||||||
classindex = ClassGetFirstClass(teamid, _, cachetype);
|
classindex = ClassGetFirstClass(teamid, _, cachetype);
|
||||||
|
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Default Spawn Class", "Warning: Failed to set \"%s\" as default spawn class for team %d. The class doesn't exist or the team IDs doesn't match. Falling back to the first class in the team.", classname, teamid);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "DefaultSpawnClass", "Warning: Failed to set \"%s\" as default spawn class for team %d. The class doesn't exist or the team IDs doesn't match. Falling back to the first class in the team.", _, classname, teamid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate the new index.
|
// Validate the new index.
|
||||||
if (ClassValidateIndex(classindex))
|
if (ClassValidateIndex(classindex))
|
||||||
{
|
{
|
||||||
// Log a warning.
|
// Log a warning.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Default Spawn Class", "Warning: The default class name \"%s\" does not exist or matches the team ID.", classname);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "DefaultSpawnClass", "Warning: The default class name \"%s\" does not exist or matches the team ID.", _, classname);
|
|
||||||
}
|
|
||||||
|
|
||||||
return classindex;
|
return classindex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -322,9 +322,6 @@ new ClassPlayerNextAdminClass[MAXPLAYERS + 1];
|
|||||||
*/
|
*/
|
||||||
ClassLoad()
|
ClassLoad()
|
||||||
{
|
{
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES);
|
|
||||||
|
|
||||||
// Make sure kvClassData is ready to use.
|
// Make sure kvClassData is ready to use.
|
||||||
if (kvClassData != INVALID_HANDLE)
|
if (kvClassData != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
@ -339,16 +336,12 @@ ClassLoad()
|
|||||||
// If file doesn't exist, then log and stop.
|
// If file doesn't exist, then log and stop.
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Fatal error: Missing playerclasses config file \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathclasses);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Missing playerclasses config file \"%s\"", pathclasses);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log what class file that is loaded.
|
// Log what class file that is loaded.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Loading classes from file \"%s\".", pathclasses);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Loading classes from file \"%s\".", LOG_FORMAT_TYPE_SIMPLE, pathclasses);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put file data into memory.
|
// Put file data into memory.
|
||||||
FileToKeyValues(kvClassData, pathclasses);
|
FileToKeyValues(kvClassData, pathclasses);
|
||||||
@ -357,7 +350,7 @@ ClassLoad()
|
|||||||
KvRewind(kvClassData);
|
KvRewind(kvClassData);
|
||||||
if (!KvGotoFirstSubKey(kvClassData))
|
if (!KvGotoFirstSubKey(kvClassData))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Fatal error: Can't find any classes in \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathclasses);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Can't find any classes in \"%s\"", pathclasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
decl String:name[64];
|
decl String:name[64];
|
||||||
@ -375,10 +368,7 @@ ClassLoad()
|
|||||||
if (ClassCount > ZR_CLASS_MAX)
|
if (ClassCount > ZR_CLASS_MAX)
|
||||||
{
|
{
|
||||||
// Maximum classes reached. Write a warning and exit the loop.
|
// Maximum classes reached. Write a warning and exit the loop.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Warning: Maximum classes reached (%d). Skipping other classes.", ZR_CLASS_MAX + 1);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Warning: Maximum classes reached (%d). Skipping other classes.", _, ZR_CLASS_MAX + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -439,10 +429,7 @@ ClassLoad()
|
|||||||
// There's one or more invalid class attributes. Disable the class
|
// There's one or more invalid class attributes. Disable the class
|
||||||
// and log an error message.
|
// and log an error message.
|
||||||
ClassData[ClassCount][class_enabled] = false;
|
ClassData[ClassCount][class_enabled] = false;
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", LOG_FORMAT_TYPE_ERROR, ClassCount, ClassErrorFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
failedcount++;
|
failedcount++;
|
||||||
}
|
}
|
||||||
@ -454,13 +441,13 @@ ClassLoad()
|
|||||||
// Validate team requirements.
|
// Validate team requirements.
|
||||||
if (!ClassValidateTeamRequirements())
|
if (!ClassValidateTeamRequirements())
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Fatal error: The class configuration doesn't match the team requirements.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: The class configuration doesn't match the team requirements.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate team default requirements.
|
// Validate team default requirements.
|
||||||
if (!ClassValidateTeamDefaults())
|
if (!ClassValidateTeamDefaults())
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Fatal error: Couldn't find a default class for one or more teams. At least one class per team must be marked as default.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Couldn't find a default class for one or more teams. At least one class per team must be marked as default.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache class data.
|
// Cache class data.
|
||||||
@ -470,12 +457,11 @@ ClassLoad()
|
|||||||
ClassValidated = true;
|
ClassValidated = true;
|
||||||
|
|
||||||
// Log summary.
|
// Log summary.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", ClassCount, ClassCount - failedcount, failedcount);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", _, ClassCount, ClassCount - failedcount, failedcount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the class data cache. Original values are retrieved from ClassData.
|
* Updates the class data cache. Original values are retrieved from ClassData.
|
||||||
*
|
*
|
||||||
@ -655,10 +641,7 @@ ClassClientSetDefaultIndexes(client = -1)
|
|||||||
{
|
{
|
||||||
// Invalid class index. Fall back to default class in class config and
|
// Invalid class index. Fall back to default class in class config and
|
||||||
// log a warning.
|
// log a warning.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Set Default Indexes", "Warning: Failed to get default zombie class, falling back to default class in class config. Check spelling in \"zr_classes_default_zombie\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "SetDefaultIndexes", "Warning: Failed to get default zombie class, falling back to default class in class config. Check spelling in \"zr_classes_default_zombie\".", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use default class.
|
// Use default class.
|
||||||
zombieindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ZOMBIES);
|
zombieindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ZOMBIES);
|
||||||
@ -669,10 +652,7 @@ ClassClientSetDefaultIndexes(client = -1)
|
|||||||
{
|
{
|
||||||
// Invalid class index. Fall back to default class in class config and
|
// Invalid class index. Fall back to default class in class config and
|
||||||
// log a warning.
|
// log a warning.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Set Default Indexes", "Warning: Failed to get default human class, falling back to default class in class config. Check spelling in \"zr_classes_default_human\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "SetDefaultIndexes", "Warning: Failed to get default human class, falling back to default class in class config. Check spelling in \"zr_classes_default_human\".", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use default class.
|
// Use default class.
|
||||||
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS);
|
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS);
|
||||||
|
@ -115,18 +115,6 @@ RespawnOnRoundEnd()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if a player is to be respawned as a zombie, because they were killed by world.
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
* @return True if they were killed by world, false if not or cvar is disabled.
|
|
||||||
*/
|
|
||||||
RespawnKilledByWorld(client)
|
|
||||||
{
|
|
||||||
// Return true if both the cvar is enabled and the player was killed by world.
|
|
||||||
return (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_TEAM_ZOMBIE_WORLD]) && bKilledByWorld[client]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawns a player into the round.
|
* Spawns a player into the round.
|
||||||
*
|
*
|
||||||
|
@ -54,11 +54,6 @@ enum RoundEndOutcome
|
|||||||
*/
|
*/
|
||||||
new Handle:tRoundEnd = INVALID_HANDLE;
|
new Handle:tRoundEnd = INVALID_HANDLE;
|
||||||
|
|
||||||
/**
|
|
||||||
* Global variable to store a convar query cookie
|
|
||||||
*/
|
|
||||||
new QueryCookie:mat_dxlevel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map is starting.
|
* Map is starting.
|
||||||
*/
|
*/
|
||||||
@ -68,17 +63,6 @@ RoundEndOnMapStart()
|
|||||||
tRoundEnd = INVALID_HANDLE;
|
tRoundEnd = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Client is joining the server.
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
*/
|
|
||||||
RoundEndClientInit(client)
|
|
||||||
{
|
|
||||||
// Get client's DX level.
|
|
||||||
RoundEndGetClientDXLevel(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client has been killed.
|
* Client has been killed.
|
||||||
*/
|
*/
|
||||||
@ -167,53 +151,6 @@ RoundEndOnRoundEnd(reason)
|
|||||||
RoundEndBalanceTeams();
|
RoundEndBalanceTeams();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds DX level of a client.
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
*/
|
|
||||||
RoundEndGetClientDXLevel(client)
|
|
||||||
{
|
|
||||||
// If client is fake (or bot), then stop.
|
|
||||||
if (IsFakeClient(client))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Query mat_dxlevel on client.
|
|
||||||
mat_dxlevel = QueryClientConVar(client, "mat_dxlevel", RoundEndQueryClientDXLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query callback function.
|
|
||||||
*
|
|
||||||
* @param cookie Unique cookie of the query.
|
|
||||||
* @param client The client index.
|
|
||||||
* @param result The result of the query (see console.inc enum ConVarQueryResult)
|
|
||||||
* @param cvarName Name of the cvar.
|
|
||||||
* @param cvarValue Value of the cvar.
|
|
||||||
*/
|
|
||||||
public RoundEndQueryClientDXLevel(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
|
|
||||||
{
|
|
||||||
// If query cookie does not match cookie given by mat_dxlevel query, then stop, this isn't our query.
|
|
||||||
if (cookie != mat_dxlevel)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset dxLevel.
|
|
||||||
dxLevel[client] = 0;
|
|
||||||
|
|
||||||
// If result is any other than ConVarQuery_Okay, then stop.
|
|
||||||
if (result != ConVarQuery_Okay)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy cvar value to dxLevel array.
|
|
||||||
dxLevel[client] = StringToInt(cvarValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a round_end reason, to a round winner, or draw.
|
* Convert a round_end reason, to a round winner, or draw.
|
||||||
*
|
*
|
||||||
@ -397,34 +334,6 @@ RoundEndBalanceTeams()
|
|||||||
CloseHandle(arrayEligibleClients);
|
CloseHandle(arrayEligibleClients);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays overlay to client, or prints unsupported message on client's screen.
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
* @param overlay The overlay path.
|
|
||||||
*/
|
|
||||||
RoundEndDisplayClientOverlay(client, const String:overlay[])
|
|
||||||
{
|
|
||||||
// If dxLevel is 0, then query on client failed, so try again, then stop.
|
|
||||||
if (!dxLevel[client])
|
|
||||||
{
|
|
||||||
// Query dxlevel cvar.
|
|
||||||
RoundEndGetClientDXLevel(client);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If dxLevel is above or equal to minimum requirement, then display overlay.
|
|
||||||
if (dxLevel[client] >= GENERAL_DXLEVEL_MIN)
|
|
||||||
{
|
|
||||||
ClientCommand(client, "r_screenoverlay \"%s\"", overlay);
|
|
||||||
}
|
|
||||||
// If client doesn't meet minimum requirement, then print unsupported text.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ZR_PrintCenterText(client, "DX90 not supported", dxLevel[client], GENERAL_DXLEVEL_MIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays overlays to clients, depending on the outcome.
|
* Displays overlays to clients, depending on the outcome.
|
||||||
*
|
*
|
||||||
@ -470,7 +379,14 @@ RoundEndOverlayStart(Float:time, RoundEndOutcome:outcome)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoundEndDisplayClientOverlay(x, overlaypath);
|
// If client is fake (or bot), then stop.
|
||||||
|
if (IsFakeClient(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlaysClientSetChannelPath(x, OVERLAYS_CHANNEL_ROUNDEND, overlaypath);
|
||||||
|
OverlaysClientSetChannelState(x, OVERLAYS_CHANNEL_ROUNDEND, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateTimer(time, RoundEndOverlayTimer, _, TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(time, RoundEndOverlayTimer, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||||
@ -487,8 +403,14 @@ RoundEndOverlayStop()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes overlay from client's screen.
|
// If client is fake (or bot), then stop.
|
||||||
ClientCommand(x, "r_screenoverlay \"\"");
|
if (IsFakeClient(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable roundend overlay channel.
|
||||||
|
OverlaysClientSetChannelState(x, OVERLAYS_CHANNEL_ROUNDEND, true, false, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,6 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_AMBIENTSOUNDS);
|
|
||||||
|
|
||||||
// Get ambient sound file.
|
// Get ambient sound file.
|
||||||
decl String:sound[SOUND_MAX_PATH];
|
decl String:sound[SOUND_MAX_PATH];
|
||||||
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
||||||
@ -69,11 +66,7 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
if (!FileExists(sound, true))
|
if (!FileExists(sound, true))
|
||||||
{
|
{
|
||||||
// Log invalid sound file error.
|
// Log invalid sound file error.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Invalid sound file specified in \"zr_ambientsounds_file\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Invalid sound file specified in zr_ambientsounds_file.", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,10 +75,7 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
if (ambientvolume <= 0.0)
|
if (ambientvolume <= 0.0)
|
||||||
{
|
{
|
||||||
// Log invalid ambient sound volume error.
|
// Log invalid ambient sound volume error.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -95,10 +85,7 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
if (ambientlength <= 0.0)
|
if (ambientlength <= 0.0)
|
||||||
{
|
{
|
||||||
// Log invalid ambient sound length error.
|
// Log invalid ambient sound length error.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,17 @@ SpawnProtectOnClientSpawn(client)
|
|||||||
|
|
||||||
// Reset timer handle.
|
// Reset timer handle.
|
||||||
tSpawnProtect[client] = INVALID_HANDLE;
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client is spawning into the game. *Post
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
SpawnProtectOnClientSpawnPost(client)
|
||||||
|
{
|
||||||
// If client isn't on a team, then stop.
|
// If client isn't on a team, then stop.
|
||||||
new team = GetClientTeam(client);
|
if (!ZRIsClientOnTeam(client))
|
||||||
if (team != CS_TEAM_T && team != CS_TEAM_CT)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -70,11 +77,12 @@ SpawnProtectOnClientSpawn(client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If player respawns as human, and either cvar zr_suicide_world_damage or the client
|
// If client is a zombie, then stop.
|
||||||
// wasn't killed by world is false, then continue on to protect client.
|
if (InfectIsClientInfected(client))
|
||||||
new bool:respawn_zombie = GetConVarBool(g_hCvarsList[CVAR_RESPAWN_TEAM_ZOMBIE]);
|
|
||||||
if (!respawn_zombie && !RespawnKilledByWorld(client))
|
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set spawn protect flag on client.
|
// Set spawn protect flag on client.
|
||||||
bInfectImmune[client][INFECT_TYPE_NORMAL] = true;
|
bInfectImmune[client][INFECT_TYPE_NORMAL] = true;
|
||||||
|
|
||||||
@ -91,15 +99,14 @@ SpawnProtectOnClientSpawn(client)
|
|||||||
pSpawnProtectTime[client] = protect_time;
|
pSpawnProtectTime[client] = protect_time;
|
||||||
|
|
||||||
// Tell client they are being protected.
|
// Tell client they are being protected.
|
||||||
ZR_PrintToChat(client, "Spawn protection begin", protect_time);
|
TranslationPrintToChat(client, "Spawn protection begin", protect_time);
|
||||||
|
|
||||||
// Send time left in a hud message.
|
// Send time left in a hud message.
|
||||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||||
|
|
||||||
// Start repeating timer.
|
// Start repeating timer.
|
||||||
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client has been killed.
|
* Client has been killed.
|
||||||
@ -142,7 +149,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
|||||||
pSpawnProtectTime[client]--;
|
pSpawnProtectTime[client]--;
|
||||||
|
|
||||||
// Print time left to client.
|
// Print time left to client.
|
||||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||||
|
|
||||||
// Time has expired.
|
// Time has expired.
|
||||||
if (pSpawnProtectTime[client] <= 0)
|
if (pSpawnProtectTime[client] <= 0)
|
||||||
@ -151,7 +158,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
|||||||
bInfectImmune[client][INFECT_TYPE_NORMAL] = false;
|
bInfectImmune[client][INFECT_TYPE_NORMAL] = false;
|
||||||
|
|
||||||
// Tell client spawn protection is over.
|
// Tell client spawn protection is over.
|
||||||
ZR_HudHint(client, "Spawn protection end");
|
TranslationPrintHUDText(client, "Spawn protection end");
|
||||||
|
|
||||||
// Fix attributes.
|
// Fix attributes.
|
||||||
ToolsSetClientAlpha(client, ClassGetAlphaInitial(client));
|
ToolsSetClientAlpha(client, ClassGetAlphaInitial(client));
|
||||||
|
@ -62,70 +62,70 @@ ToolsFindOffsets()
|
|||||||
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
||||||
if (g_iToolsVelocity == -1)
|
if (g_iToolsVelocity == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_vecBaseVelocity" can't be found, then stop the plugin.
|
// If offset "m_vecBaseVelocity" can't be found, then stop the plugin.
|
||||||
g_iToolsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
|
g_iToolsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
|
||||||
if (g_iToolsBaseVelocity == -1)
|
if (g_iToolsBaseVelocity == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecBaseVelocity\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecBaseVelocity\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_flLaggedMovementValue" can't be found, then stop the plugin.
|
// If offset "m_flLaggedMovementValue" can't be found, then stop the plugin.
|
||||||
g_iToolsLMV = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue");
|
g_iToolsLMV = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue");
|
||||||
if (g_iToolsLMV == -1)
|
if (g_iToolsLMV == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_flLaggedMovementValue\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_flLaggedMovementValue\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_bHasNightVision" can't be found, then stop the plugin.
|
// If offset "m_bHasNightVision" can't be found, then stop the plugin.
|
||||||
g_iToolsHasNightVision = FindSendPropInfo("CCSPlayer", "m_bHasNightVision");
|
g_iToolsHasNightVision = FindSendPropInfo("CCSPlayer", "m_bHasNightVision");
|
||||||
if (g_iToolsHasNightVision == -1)
|
if (g_iToolsHasNightVision == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bHasNightVision\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bHasNightVision\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_bNightVisionOn" can't be found, then stop the plugin.
|
// If offset "m_bNightVisionOn" can't be found, then stop the plugin.
|
||||||
g_iToolsNightVisionOn = FindSendPropInfo("CCSPlayer", "m_bNightVisionOn");
|
g_iToolsNightVisionOn = FindSendPropInfo("CCSPlayer", "m_bNightVisionOn");
|
||||||
if (g_iToolsNightVisionOn == -1)
|
if (g_iToolsNightVisionOn == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bNightVisionOn\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bNightVisionOn\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_CollisionGroup" can't be found, then stop the plugin.
|
// If offset "m_CollisionGroup" can't be found, then stop the plugin.
|
||||||
g_iToolsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
|
g_iToolsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
|
||||||
if (g_iToolsCollisionGroup == -1)
|
if (g_iToolsCollisionGroup == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBaseEntity::m_CollisionGroup\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBaseEntity::m_CollisionGroup\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_iAccount" can't be found, then stop the plugin.
|
// If offset "m_iAccount" can't be found, then stop the plugin.
|
||||||
g_iToolsAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
|
g_iToolsAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
|
||||||
if (g_iToolsAccount == -1)
|
if (g_iToolsAccount == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_iAccount\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_iAccount\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_iDefaultFOV" can't be found, then stop the plugin.
|
// If offset "m_iDefaultFOV" can't be found, then stop the plugin.
|
||||||
g_iToolsDefaultFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV");
|
g_iToolsDefaultFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV");
|
||||||
if (g_iToolsDefaultFOV == -1)
|
if (g_iToolsDefaultFOV == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_iDefaultFOV\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_iDefaultFOV\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_bInBuyZone" can't be found, then stop the plugin.
|
// If offset "m_bInBuyZone" can't be found, then stop the plugin.
|
||||||
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
||||||
if (g_iToolsInBuyZone == -1)
|
if (g_iToolsInBuyZone == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
|
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
|
||||||
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
||||||
if (g_iToolsActiveWeapon == -1)
|
if (g_iToolsActiveWeapon == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ ToolsSetupGameData()
|
|||||||
// If gamedata file can't be loaded, then stop the plugin.
|
// If gamedata file can't be loaded, then stop the plugin.
|
||||||
if (g_hToolsGameConfig == INVALID_HANDLE)
|
if (g_hToolsGameConfig == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prep the SDKCall for "EyeAngles."
|
// Prep the SDKCall for "EyeAngles."
|
||||||
@ -152,7 +152,7 @@ ToolsSetupGameData()
|
|||||||
// If offset "EyeAngles" can't be found, then stop the plugin.
|
// If offset "EyeAngles" can't be found, then stop the plugin.
|
||||||
if(g_hToolsEyeAngles == INVALID_HANDLE)
|
if(g_hToolsEyeAngles == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Offset \"EyeAngles\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Offset \"EyeAngles\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prep the SDKCall for "TerminateRound."
|
// Prep the SDKCall for "TerminateRound."
|
||||||
@ -165,7 +165,7 @@ ToolsSetupGameData()
|
|||||||
// If offset "TerminateRound" can't be found, then stop the plugin.
|
// If offset "TerminateRound" can't be found, then stop the plugin.
|
||||||
if(g_hToolsTerminateRound == INVALID_HANDLE)
|
if(g_hToolsTerminateRound == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Signature \"CGameRules::TerminateRound\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Signature \"CGameRules::TerminateRound\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prep the SDKCall for "CSWeaponDrop."
|
// Prep the SDKCall for "CSWeaponDrop."
|
||||||
@ -179,6 +179,6 @@ ToolsSetupGameData()
|
|||||||
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
|
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
|
||||||
if(g_hToolsCSWeaponDrop == INVALID_HANDLE)
|
if(g_hToolsCSWeaponDrop == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Signature \"CBasePlaye::CSWeaponDrop\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Signature \"CBasePlaye::CSWeaponDrop\" was not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,138 +10,326 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FormatTextString(String:text[], maxlen)
|
/**
|
||||||
|
* @section Max length of different message formats.
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_MAX_LENGTH_CHAT 192
|
||||||
|
#define TRANSLATION_MAX_LENGTH_CONSOLE 1024
|
||||||
|
/**
|
||||||
|
* @endsection
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix on all messages printed from the plugin.
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_PHRASE_PREFIX "[ZR]"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @section Text color chars.
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_TEXT_COLOR_DEFAULT "\x01"
|
||||||
|
#define TRANSLATION_TEXT_COLOR_LGREEN "\x03"
|
||||||
|
#define TRANSLATION_TEXT_COLOR_GREEN "\x04"
|
||||||
|
/**
|
||||||
|
* @endsection
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HUD text usermsg
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_USERMSG_HINTTEXT "HintText"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load translations file here.
|
||||||
|
*/
|
||||||
|
TranslationInit()
|
||||||
{
|
{
|
||||||
Format(text, maxlen, "@green[%t] @default%s", "ZR", text);
|
// Load translations phrases used by plugin.
|
||||||
|
LoadTranslations("common.phrases.txt");
|
||||||
ReplaceString(text, maxlen, "@default","\x01");
|
LoadTranslations("zombiereloaded.phrases.txt");
|
||||||
ReplaceString(text, maxlen, "@lgreen","\x03");
|
|
||||||
ReplaceString(text, maxlen, "@green","\x04");
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_PrintToChat(client, any:...)
|
|
||||||
{
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
if (ZRIsClientValid(client))
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
PrintToChat(client, phrase);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
PrintToServer(phrase);
|
|
||||||
|
|
||||||
for (new x = 1; x <= MaxClients; x++)
|
|
||||||
{
|
|
||||||
if (IsClientInGame(x))
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(x);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
PrintToChat(x, phrase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_PrintCenterText(client, any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
|
|
||||||
PrintCenterText(client, phrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_HudHint(client, any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
|
|
||||||
new Handle:hHintText = StartMessageOne("HintText", client);
|
|
||||||
if (hHintText != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
BfWriteByte(hHintText, -1);
|
|
||||||
BfWriteString(hHintText, phrase);
|
|
||||||
EndMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_PrintToServer(any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(LANG_SERVER);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
decl String:buffer[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 1);
|
|
||||||
Format(buffer, sizeof(buffer), "[%t] %s", "ZR", phrase);
|
|
||||||
|
|
||||||
PrintToServer(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_LogMessage(any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(LANG_SERVER);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 1);
|
|
||||||
|
|
||||||
LogMessage(phrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_TranslateMessage(String:buffer[], maxlen, any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(LANG_SERVER);
|
|
||||||
VFormat(buffer, maxlen, "%t", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_ReplyToCommand(client, any:...)
|
|
||||||
{
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
ReplyToCommand(client, phrase);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds support for printing long strings.
|
* Translate a phrase in zombiereloaded.phrases.txt
|
||||||
|
*
|
||||||
|
* @param client The client index
|
||||||
|
* @param translation The translated text.
|
||||||
|
* @param maxlen Maximum length of the translated string.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationTranslatePhrase(client, String:translation[], maxlen, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target to given target.
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Dump translation into return string.
|
||||||
|
VFormat(translation, maxlen, "%t", 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the string to the plugin's style.
|
||||||
|
*
|
||||||
|
* @param text Text to format.
|
||||||
|
* @param maxlen Maximum length of the formatted text.
|
||||||
|
*/
|
||||||
|
stock TranslationPluginFormatString(String:text[], maxlen, bool:color = true)
|
||||||
|
{
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
// Format prefix onto the string.
|
||||||
|
Format(text, maxlen, "@green%s @default%s", TRANSLATION_PHRASE_PREFIX, text);
|
||||||
|
|
||||||
|
// Replace color tokens with CS:S color chars.
|
||||||
|
ReplaceString(text, maxlen, "@default", TRANSLATION_TEXT_COLOR_DEFAULT);
|
||||||
|
ReplaceString(text, maxlen, "@lgreen", TRANSLATION_TEXT_COLOR_LGREEN);
|
||||||
|
ReplaceString(text, maxlen, "@green", TRANSLATION_TEXT_COLOR_GREEN);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format prefix onto the string.
|
||||||
|
Format(text, maxlen, "%s %s", TRANSLATION_PHRASE_PREFIX, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print chat text to client. (with style)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param text The text to print.
|
* @param ... Translation formatting parameters.
|
||||||
*/
|
*/
|
||||||
stock ZR_ReplyToCommandLong(client, const String:text[])
|
stock TranslationPrintToChat(client, any:...)
|
||||||
{
|
{
|
||||||
decl String:partbuffer[1024];
|
// Set translation target
|
||||||
new pos;
|
SetGlobalTransTarget(client);
|
||||||
new cellswritten = 1; // Initialize for the loop.
|
|
||||||
|
|
||||||
while (cellswritten)
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation));
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToChat(client, translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the string to the plugin's style.
|
||||||
|
*
|
||||||
|
* @param server True to also print text to server console, false just to clients.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToChatAll(bool:server, bool:admin, any:...)
|
||||||
{
|
{
|
||||||
cellswritten = strcopy(partbuffer, sizeof(partbuffer), text[pos]);
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
ReplyToCommand(client, partbuffer);
|
|
||||||
pos += cellswritten;
|
if (server)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print phrase to server.
|
||||||
|
PrintToServer(translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// x = client index.
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in-game, then stop.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client isn't an admin, and we're only printing to admins, then stop.
|
||||||
|
if (admin && !ZRIsClientAdmin(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation));
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToChat(x, translation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print console text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToConsole(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToConsole(client, translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the string to the plugin's style.
|
||||||
|
*
|
||||||
|
* @param server True to also print text to server console, false just to clients.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToConsoleAll(bool:server, bool:admin, any:...)
|
||||||
|
{
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
|
||||||
|
if (server)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print phrase to server.
|
||||||
|
PrintToServer(translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// x = client index.
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in-game, then stop.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client isn't an admin, and we're only printing to admins, then stop.
|
||||||
|
if (admin && !ZRIsClientAdmin(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToConsole(x, translation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print center text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintCenterText(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintCenterText(client, translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print HUD text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintHUDText(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
|
||||||
|
// If hint text usermsg is invalid, then stop.
|
||||||
|
new Handle:hHintText = StartMessageOne(TRANSLATION_USERMSG_HINTTEXT, client);
|
||||||
|
if (hHintText == INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BfWriteByte(hHintText, -1);
|
||||||
|
BfWriteString(hHintText, translation);
|
||||||
|
EndMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print text to server. (with style)
|
||||||
|
*
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToServer(any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 1);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToServer(translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print chat text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationReplyToCommand(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation));
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
ReplyToCommand(client, translation);
|
||||||
|
}
|
@ -282,6 +282,17 @@ VEffectsApplySunDisable(bool:disable = false)
|
|||||||
|
|
||||||
VEffectsApplyFog(bool:override = false)
|
VEffectsApplyFog(bool:override = false)
|
||||||
{
|
{
|
||||||
|
// If fog is disabled, then stop.
|
||||||
|
new bool:fog = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG]);
|
||||||
|
|
||||||
|
// DUE TO SOURCEMOD NOT SUPPORT FOG, DISABLE.
|
||||||
|
fog = false;
|
||||||
|
|
||||||
|
if (!fog)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find current fog index
|
// Find current fog index
|
||||||
new fogindex = FindEntityByClassname(-1, "env_fog_controller");
|
new fogindex = FindEntityByClassname(-1, "env_fog_controller");
|
||||||
|
|
||||||
@ -296,13 +307,6 @@ VEffectsApplyFog(bool:override = false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If fog is disabled, then stop.
|
|
||||||
new bool:fog = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG]);
|
|
||||||
if (!fog)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is no fog on the map, create new fog.
|
// If there is no fog on the map, create new fog.
|
||||||
if (fogindex == -1)
|
if (fogindex == -1)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
new bool:g_bMarket;
|
new bool:g_bMarket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set global market flag variable
|
||||||
|
*/
|
||||||
|
MarketInit()
|
||||||
|
{
|
||||||
|
// Set market variable to true if market is installed.
|
||||||
|
g_bMarket = LibraryExists("market");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends market menu to client.
|
* Sends market menu to client.
|
||||||
*
|
*
|
||||||
@ -26,7 +35,7 @@ bool:ZMarketMenu(client)
|
|||||||
if (!g_bMarket)
|
if (!g_bMarket)
|
||||||
{
|
{
|
||||||
// Tell client market is disabled.
|
// Tell client market is disabled.
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +43,7 @@ bool:ZMarketMenu(client)
|
|||||||
if (!IsPlayerAlive(client))
|
if (!IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
// Tell player they must be alive.
|
// Tell player they must be alive.
|
||||||
ZR_PrintToChat(client, "Must be alive");
|
TranslationPrintToChat(client, "Must be alive");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +52,7 @@ bool:ZMarketMenu(client)
|
|||||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||||
{
|
{
|
||||||
// Tell client they must be in a buyzone.
|
// Tell client they must be in a buyzone.
|
||||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +102,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
// If player is a zombie, then stop.
|
// If player is a zombie, then stop.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -120,7 +129,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
// If the weapon is restricted, then stop.
|
// If the weapon is restricted, then stop.
|
||||||
if (RestrictIsWeaponRestricted(weapon))
|
if (RestrictIsWeaponRestricted(weapon))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -129,7 +138,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
||||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||||
{
|
{
|
||||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ new Handle:gRestrictedWeapons = INVALID_HANDLE;
|
|||||||
/**
|
/**
|
||||||
* Array that stores the "HookID" to be later unhooked on player disconnect.
|
* Array that stores the "HookID" to be later unhooked on player disconnect.
|
||||||
*/
|
*/
|
||||||
new gCanUseHookID[MAXPLAYERS + 1];
|
new g_iCanUseHookID[MAXPLAYERS + 1] = {-1, ...};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query results returned when (un)restricting a weapon.
|
* Query results returned when (un)restricting a weapon.
|
||||||
@ -52,6 +52,16 @@ RestrictInit()
|
|||||||
RegConsoleCmd("rebuy", RestrictBuyCommand);
|
RegConsoleCmd("rebuy", RestrictBuyCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook commands related to restrict here.
|
||||||
|
*/
|
||||||
|
RestrictOnCommandsCreate()
|
||||||
|
{
|
||||||
|
// Create admin commands.
|
||||||
|
RegAdminCmd("zr_restrict", RestrictRestrictCommand, ADMFLAG_GENERIC, "zr_restrict <weapon> - Restrict a weapon.");
|
||||||
|
RegAdminCmd("zr_unrestrict", RestrictUnrestrictCommand, ADMFLAG_GENERIC, "zr_unrestrict <weapon> - Unrestrict a weapon.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears weapon restrict data.
|
* Clears weapon restrict data.
|
||||||
*/
|
*/
|
||||||
@ -95,10 +105,7 @@ RestrictOnMapStart()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure.
|
// Log failure.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Missing weapon groups config file: %s", pathweapongroups);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapon groups config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapongroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -149,12 +156,6 @@ RestrictDefaultRestrictions()
|
|||||||
*/
|
*/
|
||||||
RestrictValidateWeaponGroups()
|
RestrictValidateWeaponGroups()
|
||||||
{
|
{
|
||||||
// If log flag check fails, then don't log.
|
|
||||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset keygroup's traversal stack.
|
// Reset keygroup's traversal stack.
|
||||||
KvRewind(kvWeaponGroups);
|
KvRewind(kvWeaponGroups);
|
||||||
|
|
||||||
@ -178,7 +179,7 @@ RestrictValidateWeaponGroups()
|
|||||||
// If weapon is invalid, then log it.
|
// If weapon is invalid, then log it.
|
||||||
if (!WeaponsIsValidWeapon(groupweapon))
|
if (!WeaponsIsValidWeapon(groupweapon))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Weapon Restrict", "Config Validation", "Invalid weapon \"%s\" in group \"%s\" configured in weapongroups.txt.", LOG_FORMAT_TYPE_ERROR, groupweapon, weapongroup);
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Invalid weapon \"%s\" in group \"%s\" configured in weapongroups.txt.", groupweapon, weapongroup);
|
||||||
}
|
}
|
||||||
} while (KvGotoNextKey(kvWeaponGroups));
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ RestrictValidateWeaponGroups()
|
|||||||
// If it couldn't traverse to the weapons, then log no weapons within group.
|
// If it couldn't traverse to the weapons, then log no weapons within group.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Weapon Restrict", "Config Validation", "No weapons listed in weapon group \"%s\" in weapongroups.txt.", LOG_FORMAT_TYPE_ERROR, weapongroup);
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "No weapons listed in weapon group \"%s\" in weapongroups.txt.", weapongroup);
|
||||||
}
|
}
|
||||||
} while (KvGotoNextKey(kvWeaponGroups));
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
}
|
}
|
||||||
@ -209,7 +210,7 @@ RestrictWeaponUnrestrictAll()
|
|||||||
RestrictClientInit(client)
|
RestrictClientInit(client)
|
||||||
{
|
{
|
||||||
// Hook "Weapon_CanUse" on client.
|
// Hook "Weapon_CanUse" on client.
|
||||||
gCanUseHookID[client] = ZRTools_HookWeapon_CanUse(client, RestrictCanUse);
|
g_iCanUseHookID[client] = ZRTools_HookWeapon_CanUse(client, RestrictCanUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,8 +220,13 @@ RestrictClientInit(client)
|
|||||||
*/
|
*/
|
||||||
RestrictOnClientDisconnect(client)
|
RestrictOnClientDisconnect(client)
|
||||||
{
|
{
|
||||||
// Unhook "Weapon_CanUse" on client.
|
// Unhook "Weapon_CanUse" callback, and reset variable.
|
||||||
ZRTools_UnhookWeapon_CanUse(gCanUseHookID[client]);
|
|
||||||
|
if (g_iCanUseHookID[client] != -1)
|
||||||
|
{
|
||||||
|
ZRTools_UnhookWeapon_CanUse(g_iCanUseHookID[client]);
|
||||||
|
g_iCanUseHookID[client] = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,8 +237,8 @@ RestrictOnClientDisconnect(client)
|
|||||||
RestrictOnClientSpawn(client)
|
RestrictOnClientSpawn(client)
|
||||||
{
|
{
|
||||||
// Re-hook "canuse" on client.
|
// Re-hook "canuse" on client.
|
||||||
ZRTools_UnhookWeapon_CanUse(gCanUseHookID[client]);
|
ZRTools_UnhookWeapon_CanUse(g_iCanUseHookID[client]);
|
||||||
gCanUseHookID[client] = ZRTools_HookWeapon_CanUse(client, RestrictCanUse);
|
g_iCanUseHookID[client] = ZRTools_HookWeapon_CanUse(client, RestrictCanUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -244,19 +250,10 @@ RestrictOnClientSpawn(client)
|
|||||||
*/
|
*/
|
||||||
public Action:RestrictBuyCommand(client, argc)
|
public Action:RestrictBuyCommand(client, argc)
|
||||||
{
|
{
|
||||||
// If plugin is disabled then stop.
|
|
||||||
/*new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
// Allow command.
|
|
||||||
return Plugin_Continue;
|
|
||||||
}*/
|
|
||||||
// Disabled
|
|
||||||
|
|
||||||
// If player is a zombie, then block command.
|
// If player is a zombie, then block command.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||||
|
|
||||||
// Block command
|
// Block command
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -270,7 +267,7 @@ public Action:RestrictBuyCommand(client, argc)
|
|||||||
// Check if the weapon is restricted, if so then block command.
|
// Check if the weapon is restricted, if so then block command.
|
||||||
if (RestrictIsWeaponRestricted(weapon))
|
if (RestrictIsWeaponRestricted(weapon))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||||
|
|
||||||
// Block command.
|
// Block command.
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -465,12 +462,8 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
// Weapon was successfully restricted.
|
// Weapon was successfully restricted.
|
||||||
case Successful_Weapon:
|
case Successful_Weapon:
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(0, "Restrict weapon", weapon);
|
TranslationPrintToChatAll(true, false, "Restrict weapon", weapon);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", client, weapon);
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon group was successfully restricted.
|
// Weapon group was successfully restricted.
|
||||||
case Successful_Group:
|
case Successful_Group:
|
||||||
@ -478,23 +471,19 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
decl String:weaponlist[128];
|
decl String:weaponlist[128];
|
||||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
ZR_PrintToChat(0, "Restrict custom weapon group", weapon, weaponlist);
|
TranslationPrintToChatAll(true, false, "Restrict custom weapon group", weapon, weaponlist);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", client, weapon);
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon was already restricted.
|
// Weapon was already restricted.
|
||||||
case Failed_Weapon:
|
case Failed_Weapon:
|
||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Restrict weapon failed", weapon);
|
TranslationReplyToCommand(client, "Restrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Restrict weapon failed", weapon);
|
TranslationPrintToChat(client, "Restrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon group was already restricted.
|
// Weapon group was already restricted.
|
||||||
@ -505,11 +494,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
|
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
TranslationReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
TranslationPrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon name was invalid.
|
// Weapon name was invalid.
|
||||||
@ -517,11 +506,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -541,12 +530,9 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
// Weapon was successfully unrestricted.
|
// Weapon was successfully unrestricted.
|
||||||
case Successful_Weapon:
|
case Successful_Weapon:
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(0, "Unrestrict weapon", weapon);
|
TranslationPrintToChatAll(true, false, "Unrestrict weapon", weapon);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon: \"%s\".", client, weapon);
|
||||||
|
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon group was successfully unrestricted.
|
// Weapon group was successfully unrestricted.
|
||||||
case Successful_Group:
|
case Successful_Group:
|
||||||
@ -554,23 +540,19 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
decl String:weaponlist[128];
|
decl String:weaponlist[128];
|
||||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
ZR_PrintToChat(0, "Unrestrict custom weapon group", weapon, weaponlist);
|
TranslationPrintToChatAll(true, false, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", client, weapon);
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon wasn't restricted.
|
// Weapon wasn't restricted.
|
||||||
case Failed_Weapon:
|
case Failed_Weapon:
|
||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
TranslationReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Unrestrict weapon failed", weapon);
|
TranslationPrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon group wasn't restricted.
|
// Weapon group wasn't restricted.
|
||||||
@ -581,11 +563,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
|
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
TranslationReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
TranslationPrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon name was invalid.
|
// Weapon name was invalid.
|
||||||
@ -593,11 +575,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -903,3 +885,87 @@ public ZRTools_Action:RestrictCanUse(client, weapon)
|
|||||||
// Allow pickup.
|
// Allow pickup.
|
||||||
return ZRTools_Continue;
|
return ZRTools_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command callback (zr_restrict)
|
||||||
|
* Restricts a weapon or group
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param argc Argument count.
|
||||||
|
*/
|
||||||
|
public Action:RestrictRestrictCommand(client, argc)
|
||||||
|
{
|
||||||
|
// If weapons module is disabled, then stop.
|
||||||
|
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
||||||
|
if (!weapons)
|
||||||
|
{
|
||||||
|
// Tell client command is disabled.
|
||||||
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If restrict module is disabled, then stop.
|
||||||
|
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
||||||
|
if (!restrict)
|
||||||
|
{
|
||||||
|
// Tell client command is disabled.
|
||||||
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// arg1 = weapon being restricted
|
||||||
|
decl String:arg1[32];
|
||||||
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
|
|
||||||
|
// Strip "weapon_" from entity name
|
||||||
|
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
|
||||||
|
|
||||||
|
decl String:display[WEAPONS_MAX_LENGTH];
|
||||||
|
|
||||||
|
new WpnRestrictQuery:output = RestrictRestrict(arg1, display);
|
||||||
|
RestrictPrintRestrictOutput(client, output, display, true);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command callback (zr_unrestrict)
|
||||||
|
* Unrestricts a weapon or group
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param argc Argument count.
|
||||||
|
*/
|
||||||
|
public Action:RestrictUnrestrictCommand(client, argc)
|
||||||
|
{
|
||||||
|
// If weapons module is disabled, then stop.
|
||||||
|
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
||||||
|
if (!weapons)
|
||||||
|
{
|
||||||
|
// Tell client command is disabled.
|
||||||
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If restrict module is disabled, then stop.
|
||||||
|
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
||||||
|
if (!restrict)
|
||||||
|
{
|
||||||
|
// Tell client command is disabled.
|
||||||
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// arg1 = weapon being restricted
|
||||||
|
decl String:arg1[32];
|
||||||
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
|
|
||||||
|
// Strip "weapon_" from entity name
|
||||||
|
ReplaceString(arg1, sizeof(arg1), "weapon_", "");
|
||||||
|
|
||||||
|
decl String:display[WEAPONS_MAX_LENGTH];
|
||||||
|
|
||||||
|
new WpnRestrictQuery:output = RestrictUnrestrict(arg1, display);
|
||||||
|
RestrictPrintUnrestrictOutput(client, output, display, true);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
@ -93,10 +93,7 @@ WeaponsLoad()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure.
|
// Log failure.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Missing weapons config file: %s", pathweapons);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapons config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapons);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -116,19 +113,19 @@ WeaponsLoad()
|
|||||||
*/
|
*/
|
||||||
WeaponsValidateConfig()
|
WeaponsValidateConfig()
|
||||||
{
|
{
|
||||||
// If log flag check fails, then don't log.
|
|
||||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KvRewind(kvWeapons);
|
KvRewind(kvWeapons);
|
||||||
if (!KvGotoFirstSubKey(kvWeapons))
|
if (!KvGotoFirstSubKey(kvWeapons))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt.", LOG_FORMAT_TYPE_ERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "No weapons listed in weapons.txt.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WeaponsOnCommandsCreate()
|
||||||
|
{
|
||||||
|
// Forward event to sub-modules.
|
||||||
|
RestrictOnCommandsCreate();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client is joining the server.
|
* Client is joining the server.
|
||||||
*
|
*
|
||||||
|
@ -17,7 +17,7 @@ bool:ZRAdminMenu(client)
|
|||||||
{
|
{
|
||||||
if (!ZRIsClientAdmin(client))
|
if (!ZRIsClientAdmin(client))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Must be admin");
|
TranslationPrintToChat(client, "Must be admin");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,76 +504,14 @@ ZRLogFlagsMenu(client)
|
|||||||
|
|
||||||
SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title");
|
SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title");
|
||||||
|
|
||||||
new client_flags = GetUserFlagBits(client);
|
//new client_flags = GetUserFlagBits(client);
|
||||||
new item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
//new item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
||||||
|
|
||||||
decl String:z_log_core[64];
|
//decl String:z_log_core[64];
|
||||||
decl String:z_log_game[64];
|
|
||||||
decl String:z_log_player[64];
|
|
||||||
decl String:z_log_debug[64];
|
|
||||||
decl String:z_log_debug_detail[64];
|
|
||||||
decl String:z_log_debug_max[64];
|
|
||||||
decl String:z_log_admins[64];
|
|
||||||
decl String:z_log_client[64];
|
|
||||||
decl String:z_log_ignore_console[64];
|
|
||||||
decl String:z_log_modules_enabled[64];
|
|
||||||
decl String:z_log_module_zombie[64];
|
|
||||||
decl String:z_log_module_ambientsounds[64];
|
|
||||||
decl String:z_log_module_overlays[64];
|
|
||||||
decl String:z_log_module_saytriggers[64];
|
|
||||||
decl String:z_log_module_teleport[64];
|
|
||||||
decl String:z_log_module_classes[64];
|
|
||||||
decl String:z_log_module_weapons[64];
|
|
||||||
decl String:z_log_module_hitgroups[64];
|
|
||||||
decl String:z_log_module_commands[64];
|
|
||||||
decl String:z_log_module_anticamp[64];
|
|
||||||
decl String:z_log_module_damage[64];
|
|
||||||
decl String:z_log_module_offsets[64];
|
|
||||||
|
|
||||||
Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogCheckFlag(LOG_CORE_EVENTS));
|
//Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogCheckFlag(LOG_CORE_EVENTS));
|
||||||
Format(z_log_game, sizeof(z_log_game), "Log game events (%d)", LogCheckFlag(LOG_GAME_EVENTS));
|
|
||||||
Format(z_log_player, sizeof(z_log_player), "Log player commands (%d)", LogCheckFlag(LOG_PLAYER_COMMANDS));
|
|
||||||
Format(z_log_debug, sizeof(z_log_debug), "Log debug messages (%d)", LogCheckFlag(LOG_DEBUG));
|
|
||||||
Format(z_log_debug_detail, sizeof(z_log_debug_detail), "Log detailed debug messages (%d)", LogCheckFlag(LOG_DEBUG_DETAIL));
|
|
||||||
Format(z_log_debug_max, sizeof(z_log_debug_max), "Log low level debug messages (%d)", LogCheckFlag(LOG_DEBUG_MAX_DETAIL));
|
|
||||||
Format(z_log_admins, sizeof(z_log_admins), "Also log to admin chat (%d)", LogCheckFlag(LOG_TO_ADMINS));
|
|
||||||
Format(z_log_client, sizeof(z_log_client), "Also log to client console (%d)", LogCheckFlag(LOG_TO_CLIENT));
|
|
||||||
Format(z_log_ignore_console, sizeof(z_log_ignore_console), "Don't log messages from the console (%d)", LogCheckFlag(LOG_IGNORE_CONSOLE));
|
|
||||||
Format(z_log_modules_enabled, sizeof(z_log_modules_enabled), "Module based log control (%d)", LogCheckFlag(LOG_MODULES_ENABLED));
|
|
||||||
Format(z_log_module_zombie, sizeof(z_log_module_zombie), "Zombie (%d)", LogCheckFlag(LOG_MODULE_ZOMBIE));
|
|
||||||
Format(z_log_module_ambientsounds, sizeof(z_log_module_ambientsounds), "Ambient Sounds (%d)", LogCheckFlag(LOG_MODULE_AMBIENTSOUNDS));
|
|
||||||
Format(z_log_module_overlays, sizeof(z_log_module_overlays), "Overlays (%d)", LogCheckFlag(LOG_MODULE_OVERLAYS));
|
|
||||||
Format(z_log_module_saytriggers, sizeof(z_log_module_saytriggers), "Chat commands (%d)", LogCheckFlag(LOG_MODULE_SAYTRIGGERS));
|
|
||||||
Format(z_log_module_teleport, sizeof(z_log_module_teleport), "Teleporter (%d)", LogCheckFlag(LOG_MODULE_TELEPORT));
|
|
||||||
Format(z_log_module_classes, sizeof(z_log_module_classes), "Classes (%d)", LogCheckFlag(LOG_MODULE_CLASSES));
|
|
||||||
Format(z_log_module_weapons, sizeof(z_log_module_weapons), "Weapons (%d)", LogCheckFlag(LOG_MODULE_WEAPONS));
|
|
||||||
Format(z_log_module_hitgroups, sizeof(z_log_module_hitgroups), "Hitgroups (%d)", LogCheckFlag(LOG_MODULE_HITGROUPS));
|
|
||||||
Format(z_log_module_commands, sizeof(z_log_module_commands), "Admin commands (%d)", LogCheckFlag(LOG_MODULE_COMMANDS));
|
|
||||||
Format(z_log_module_anticamp, sizeof(z_log_module_anticamp), "Anticamp (%d)", LogCheckFlag(LOG_MODULE_ANTICAMP));
|
|
||||||
Format(z_log_module_damage, sizeof(z_log_module_damage), "Damage (Suicide Intercept) (%d)", LogCheckFlag(LOG_MODULE_DAMAGE));
|
|
||||||
Format(z_log_module_offsets, sizeof(z_log_module_offsets), "Offsets (properties) (%d)", LogCheckFlag(LOG_MODULE_OFFSETS));
|
|
||||||
|
|
||||||
AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_state);
|
//AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_state);
|
||||||
AddMenuItem(menu_log_flags, z_log_game, z_log_game, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_player, z_log_player, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_debug, z_log_debug, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_debug_detail, z_log_debug_detail, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_debug_max, z_log_debug_max, item_state);
|
|
||||||
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_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_modules_enabled, z_log_modules_enabled, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_zombie, z_log_module_zombie, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_ambientsounds, z_log_module_ambientsounds, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_overlays, z_log_module_overlays, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_saytriggers, z_log_module_saytriggers, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_teleport, z_log_module_teleport, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_classes, z_log_module_classes, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_weapons, z_log_module_weapons, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_commands, z_log_module_commands, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_anticamp, z_log_module_anticamp, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_damage, z_log_module_damage, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_offsets, z_log_module_offsets, item_state);
|
|
||||||
|
|
||||||
SetMenuExitBackButton(menu_log_flags, true);
|
SetMenuExitBackButton(menu_log_flags, true);
|
||||||
DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
|
DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
|
||||||
@ -585,116 +523,6 @@ public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, sl
|
|||||||
{
|
{
|
||||||
switch(slot)
|
switch(slot)
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_CORE_EVENTS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_GAME_EVENTS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_PLAYER_COMMANDS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_DEBUG);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_DEBUG_DETAIL);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_DEBUG_MAX_DETAIL);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 6:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_TO_ADMINS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 7:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_TO_CLIENT);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 8:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_IGNORE_CONSOLE);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 9:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULES_ENABLED);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 10:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_ZOMBIE);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 11:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_AMBIENTSOUNDS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 12:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_OVERLAYS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 13:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_SAYTRIGGERS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 14:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_TELEPORT);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 15:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_CLASSES);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 16:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_WEAPONS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 17:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_HITGROUPS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 18:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_COMMANDS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 19:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_ANTICAMP);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 20:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_DAMAGE);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 21:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_OFFSETS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (action == MenuAction_Cancel)
|
if (action == MenuAction_Cancel)
|
||||||
|
@ -72,7 +72,7 @@ ZHPOnClientDeath(client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player has been infected.
|
* Client has been infected.
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
@ -132,7 +132,7 @@ bool:ZHPToggle(client)
|
|||||||
if (!zhp)
|
if (!zhp)
|
||||||
{
|
{
|
||||||
// Tell client feature is disabled.
|
// Tell client feature is disabled.
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
|
|
||||||
// Stop.
|
// Stop.
|
||||||
return false;
|
return false;
|
||||||
@ -141,12 +141,12 @@ bool:ZHPToggle(client)
|
|||||||
// If ZHP is enabled, then tell client it's being disabled.
|
// If ZHP is enabled, then tell client it's being disabled.
|
||||||
if (pZHP[client])
|
if (pZHP[client])
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "ZHP disable");
|
TranslationPrintToChat(client, "ZHP disable");
|
||||||
}
|
}
|
||||||
// If ZHP is disabled, then tell client it's being enabled.
|
// If ZHP is disabled, then tell client it's being enabled.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "ZHP enable");
|
TranslationPrintToChat(client, "ZHP enable");
|
||||||
|
|
||||||
// Update HP display.
|
// Update HP display.
|
||||||
ZHPUpdateHUD(client);
|
ZHPUpdateHUD(client);
|
||||||
@ -186,7 +186,7 @@ ZHPUpdateHUD(client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display HP
|
// Display HP
|
||||||
ZR_HudHint(client, "Display HP", health);
|
TranslationPrintHUDText(client, "Display HP", health);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,42 +1,3 @@
|
|||||||
/**
|
|
||||||
* ====================
|
|
||||||
* Zombie:Reloaded
|
|
||||||
* File: zombie.inc
|
|
||||||
* Author: Greyscale
|
|
||||||
* ====================
|
|
||||||
*/
|
|
||||||
|
|
||||||
HookCommands()
|
|
||||||
{
|
|
||||||
RegConsoleCmd("nightvision", Command_NightVision);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action:Command_NightVision(client, argc)
|
|
||||||
{
|
|
||||||
new bool:allow_disable = GetConVarBool(g_hCvarsList[CVAR_ZVISION_ALLOW_DISABLE]);
|
|
||||||
if (!allow_disable)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bClientOverlayOn[client] = !bClientOverlayOn[client];
|
|
||||||
|
|
||||||
decl String:overlay[PLATFORM_MAX_PATH];
|
|
||||||
ClassGetOverlayPath(client, overlay, sizeof(overlay));
|
|
||||||
|
|
||||||
if (strlen(overlay) > 0)
|
|
||||||
{
|
|
||||||
if (bClientOverlayOn[client])
|
|
||||||
{
|
|
||||||
ClassOverlayInitialize(client, overlay);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClassOverlayStop(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoveObjectives()
|
RemoveObjectives()
|
||||||
{
|
{
|
||||||
decl String:classname[64];
|
decl String:classname[64];
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum dx level required to see overlays.
|
* Index of server console.
|
||||||
*/
|
*/
|
||||||
#define GENERAL_DXLEVEL_MIN 90
|
#define ZR_CONSOLE_INDEX 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @section Conversion factors.
|
* @section Conversion factors.
|
||||||
@ -24,11 +24,6 @@
|
|||||||
* @endsection
|
* @endsection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* The DirectX level of a client.
|
|
||||||
*/
|
|
||||||
new dxLevel[MAXPLAYERS + 1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global variable set to true when the first zombie(s) is/are spawned.
|
* Global variable set to true when the first zombie(s) is/are spawned.
|
||||||
*/
|
*/
|
||||||
@ -53,7 +48,7 @@ Float:ZRConvertUnitsFloat(Float:number, Float:conversion)
|
|||||||
* on it when finished!
|
* on it when finished!
|
||||||
* @param immunity True to ignore clients immune from mother infect, false to count them.
|
* @param immunity True to ignore clients immune from mother infect, false to count them.
|
||||||
*/
|
*/
|
||||||
ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool:alive = false, bool:human = false)
|
stock ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool:alive = false, bool:human = false)
|
||||||
{
|
{
|
||||||
// Create array.
|
// Create array.
|
||||||
arrayEligibleClients = CreateArray();
|
arrayEligibleClients = CreateArray();
|
||||||
@ -100,7 +95,7 @@ ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool
|
|||||||
* @param console True to include console (index 0), false if not.
|
* @param console True to include console (index 0), false if not.
|
||||||
* @return True if client is valid, false otherwise.
|
* @return True if client is valid, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRIsClientValid(client, bool:console = false)
|
stock bool:ZRIsClientValid(client, bool:console = false)
|
||||||
{
|
{
|
||||||
// If index is greater than max number of clients, then return false.
|
// If index is greater than max number of clients, then return false.
|
||||||
if (client > MaxClients)
|
if (client > MaxClients)
|
||||||
@ -112,6 +107,19 @@ bool:ZRIsClientValid(client, bool:console = false)
|
|||||||
return console ? (client >= 0) : (client > 0);
|
return console ? (client >= 0) : (client > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a given index is console.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param console True to include console (index 0), false if not.
|
||||||
|
* @return True if client is valid, false otherwise.
|
||||||
|
*/
|
||||||
|
stock bool:ZRIsConsole(index)
|
||||||
|
{
|
||||||
|
// Return true if index is = to console's index.
|
||||||
|
return (index == ZR_CONSOLE_INDEX);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count clients on each team.
|
* Count clients on each team.
|
||||||
*
|
*
|
||||||
@ -120,7 +128,7 @@ bool:ZRIsClientValid(client, bool:console = false)
|
|||||||
* @param alive If true it will only count live players, false will count alive and dead.
|
* @param alive If true it will only count live players, false will count alive and dead.
|
||||||
* @return True if successful (zombie has spawned), false otherwise.
|
* @return True if successful (zombie has spawned), false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, bool:ignorezombiespawned = false)
|
stock bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, bool:ignorezombiespawned = false)
|
||||||
{
|
{
|
||||||
// If zombie hasn't spawned and were not only counting humans, then stop.
|
// If zombie hasn't spawned and were not only counting humans, then stop.
|
||||||
if (!g_bZombieSpawned && !ignorezombiespawned)
|
if (!g_bZombieSpawned && !ignorezombiespawned)
|
||||||
@ -171,7 +179,7 @@ bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, b
|
|||||||
* @param team Team to check if player is on, -1 to check both.
|
* @param team Team to check if player is on, -1 to check both.
|
||||||
* @return True if client is on a team, false otherwise.
|
* @return True if client is on a team, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRIsClientOnTeam(client, team = -1)
|
stock bool:ZRIsClientOnTeam(client, team = -1)
|
||||||
{
|
{
|
||||||
// If index is invalid, then stop.
|
// If index is invalid, then stop.
|
||||||
if (!ZRIsClientValid(client))
|
if (!ZRIsClientValid(client))
|
||||||
@ -195,7 +203,7 @@ bool:ZRIsClientOnTeam(client, team = -1)
|
|||||||
*
|
*
|
||||||
* @param team (Optional) Team to check if there are clients on.
|
* @param team (Optional) Team to check if there are clients on.
|
||||||
*/
|
*/
|
||||||
bool:ZRTeamHasClients(team = -1)
|
stock bool:ZRTeamHasClients(team = -1)
|
||||||
{
|
{
|
||||||
// If team is
|
// If team is
|
||||||
if (team == -1)
|
if (team == -1)
|
||||||
@ -214,7 +222,7 @@ bool:ZRTeamHasClients(team = -1)
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @return True if generic admin, false otherwise.
|
* @return True if generic admin, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRIsClientAdmin(client)
|
stock bool:ZRIsClientAdmin(client)
|
||||||
{
|
{
|
||||||
// If index is invalid, then stop.
|
// If index is invalid, then stop.
|
||||||
if (!ZRIsClientValid(client))
|
if (!ZRIsClientValid(client))
|
||||||
|
@ -132,7 +132,7 @@ bool:ZSpawnClient(client)
|
|||||||
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
||||||
if (!zspawn)
|
if (!zspawn)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ bool:ZSpawnClient(client)
|
|||||||
if (!ZRIsClientOnTeam(client))
|
if (!ZRIsClientOnTeam(client))
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when on a team.
|
// Tell client the command may only be used when on a team.
|
||||||
ZR_PrintToChat(client, "Must be on team");
|
TranslationPrintToChat(client, "Must be on team");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ bool:ZSpawnClient(client)
|
|||||||
if (IsPlayerAlive(client))
|
if (IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when dead.
|
// Tell client the command may only be used when dead.
|
||||||
ZR_PrintToChat(client, "Must be dead");
|
TranslationPrintToChat(client, "Must be dead");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ bool:ZSpawnClient(client)
|
|||||||
if (SerialClientExists(client))
|
if (SerialClientExists(client))
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when joining late.
|
// Tell client the command may only be used when joining late.
|
||||||
ZR_PrintToChat(client, "ZSpawn double spawn");
|
TranslationPrintToChat(client, "ZSpawn double spawn");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ bool:ZSpawnClient(client)
|
|||||||
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
||||||
|
|
||||||
// Tell client the timelimit for this command has expired.
|
// Tell client the timelimit for this command has expired.
|
||||||
ZR_PrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
TranslationPrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ bool:ZTeleClient(client)
|
|||||||
if (infected && !ztelezombie)
|
if (infected && !ztelezombie)
|
||||||
{
|
{
|
||||||
// Tell client they must be human to use this feature.
|
// Tell client they must be human to use this feature.
|
||||||
ZR_PrintToChat(client, "Must be human");
|
TranslationPrintToChat(client, "Must be human");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ bool:ZTeleClient(client)
|
|||||||
if (!infected && !ztelehuman)
|
if (!infected && !ztelehuman)
|
||||||
{
|
{
|
||||||
// Tell client that feature is restricted at this time.
|
// Tell client that feature is restricted at this time.
|
||||||
ZR_PrintToChat(client, "ZTele restricted human");
|
TranslationPrintToChat(client, "ZTele restricted human");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,14 +143,14 @@ bool:ZTeleClient(client)
|
|||||||
if (g_iZTeleCount[client] >= ztelemax)
|
if (g_iZTeleCount[client] >= ztelemax)
|
||||||
{
|
{
|
||||||
// Tell client that they have already reached their limit.
|
// Tell client that they have already reached their limit.
|
||||||
ZR_PrintToChat(client, "ZTele max", ztelemax);
|
TranslationPrintToChat(client, "ZTele max", ztelemax);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If teleport is already in progress, then stop.
|
// If teleport is already in progress, then stop.
|
||||||
if (tZTele[client] != INVALID_HANDLE)
|
if (tZTele[client] != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "ZTele in progress");
|
TranslationPrintToChat(client, "ZTele in progress");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,9 +168,9 @@ bool:ZTeleClient(client)
|
|||||||
if (g_iZTeleTimeLeft[client] > 0)
|
if (g_iZTeleTimeLeft[client] > 0)
|
||||||
{
|
{
|
||||||
// Tell client how much time is left until teleport.
|
// Tell client how much time is left until teleport.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
||||||
|
|
||||||
// Start repeating timer.
|
// Start timer.
|
||||||
tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -178,11 +178,11 @@ bool:ZTeleClient(client)
|
|||||||
// Reset timer handle.
|
// Reset timer handle.
|
||||||
tZTele[client] = INVALID_HANDLE;
|
tZTele[client] = INVALID_HANDLE;
|
||||||
|
|
||||||
// Teleport client.
|
// Teleport client to spawn.
|
||||||
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR);
|
ZTeleTeleportClient(client);
|
||||||
|
|
||||||
// Tell client they've been teleported.
|
// Tell client they've been teleported.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
||||||
|
|
||||||
// Increment teleport count.
|
// Increment teleport count.
|
||||||
g_iZTeleCount[client]++;
|
g_iZTeleCount[client]++;
|
||||||
@ -191,6 +191,17 @@ bool:ZTeleClient(client)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teleport client to their spawn location.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
ZTeleTeleportClient(client)
|
||||||
|
{
|
||||||
|
// Teleport client.
|
||||||
|
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer callback, counts down teleport to the client.
|
* Timer callback, counts down teleport to the client.
|
||||||
*
|
*
|
||||||
@ -225,8 +236,8 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
|||||||
tZTele[client] = INVALID_HANDLE;
|
tZTele[client] = INVALID_HANDLE;
|
||||||
|
|
||||||
// Tell client teleport has been cancelled.
|
// Tell client teleport has been cancelled.
|
||||||
ZR_PrintCenterText(client, "ZTele autocancel centertext");
|
TranslationPrintCenterText(client, "ZTele autocancel centertext");
|
||||||
ZR_PrintToChat(client, "ZTele autocancel text", RoundToNearest(autocanceldistance));
|
TranslationPrintToChat(client, "ZTele autocancel text", RoundToNearest(autocanceldistance));
|
||||||
|
|
||||||
// Stop timer.
|
// Stop timer.
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
@ -237,7 +248,7 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
|||||||
g_iZTeleTimeLeft[client]--;
|
g_iZTeleTimeLeft[client]--;
|
||||||
|
|
||||||
// Tell client how much time is left until teleport.
|
// Tell client how much time is left until teleport.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
||||||
|
|
||||||
// Time has expired.
|
// Time has expired.
|
||||||
if (g_iZTeleTimeLeft[client] <= 0)
|
if (g_iZTeleTimeLeft[client] <= 0)
|
||||||
@ -252,7 +263,7 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
|||||||
new ztelemax = InfectIsClientInfected(client) ? GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_ZOMBIE]) : GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_HUMAN]);
|
new ztelemax = InfectIsClientInfected(client) ? GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_ZOMBIE]) : GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_HUMAN]);
|
||||||
|
|
||||||
// Tell client spawn protection is over.
|
// Tell client spawn protection is over.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
||||||
|
|
||||||
// Clear timer handle.
|
// Clear timer handle.
|
||||||
tZTele[client] = INVALID_HANDLE;
|
tZTele[client] = INVALID_HANDLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user