diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 59f7211..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -sudo: false -language: sourcepawn - -addons: - apt_packages: - - lib32stdc++6 - -matrix: - allow_failures: - - env: SMVERSION=1.10 - -env: - - SMVERSION=1.9 - - SMVERSION=1.10 - -before_script: - - mkdir temp - - wget "http://www.sourcemod.net/latest.php?version=$SMVERSION&os=linux" -O temp/sourcemod-$SMVERSION-linux.tar.gz - - tar -xzf temp/sourcemod-$SMVERSION-linux.tar.gz -C temp/ - - cp -r temp/addons/sourcemod/scripting/* scripting/ - - cd scripting/ - - chmod +x spcomp - -script: -- ./compile.sh deathmatch.sp -- ./compile.sh deathmatch_loader.sp diff --git a/README.md b/README.md index defcbe1..99854bd 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,10 @@

- - csgo deathmatch plugin - -
- - Version - - - Stars - - - Forks - - - Downloads - - - Issues - - - Build Status - + CS:GO Deathmatch Sourcemod Plugin
+ Version + Stars + Forks + License + Issues

#### **[CS:GO] Deathmatch** - Enables deathmatch style gameplay (respawning, gun selection, spawn protection, etc). @@ -78,11 +62,9 @@ dm_spawn_menu - Opens the Spawn Editor Menu. dm_respawn_all - Respawns all players. dm_settings - Opens the Deathmatch Settings Menu. - dm_stats - Displays spawn statistics. - dm_stats_reset - Resets spawn statistics. - - Deathmatch Loader: - dm_reload - Reloads the loader configuration file. + dm_spawn_stats - Displays spawn statistics. + dm_spawn_reset - Resets spawn statistics. + dm_weapon_stats - Displays weapon statistics. ### ConVars @@ -131,7 +113,7 @@ dm_replenish_ammo_reload - (Default) "0" - Replenish ammo on reload action. dm_replenish_ammo_kill - (Default) "1" - Replenish ammo on kill. dm_replenish_ammo_type - (Default) "2" - Replenish type. 1) Clip only. 2) Reserve only. 3) Both. - dm_replenish_ammo_hs_kill - (Default) "0" - Replenish ammo on headshot kill. + dm_replenish_ammo_hs_kill - (Default) "0" - Replenish ammo on headshot kill. dm_replenish_ammo_hs_type - (Default) "1" - Replenish type. 1) Clip only. 2) Reserve only. 3) Both. dm_replenish_grenade - (Default) "0" - Unlimited player grenades. dm_replenish_grenade_kill - (Default) "0" - Give players their grenade back on successful kill. @@ -173,11 +155,6 @@ dm_nades_tactical - (Default) "0" - Number of tactical grenades to give each player. dm_armor - (Default) "2" - Give players armor. 0) Disable. 1) Chest. 2) Chest + Helmet. - Deathmatch Loader: - dm_loader_enabled - (Default) 1 - Enable/disable executing configs - dm_loader_include_bots - (Default) 1 - Enable/disable including bots when counting number of clients - dm_loader_include_spec - (Default) 1 - Enable/disable including spectators when counting number of clients - ### Compatibility This plugin is tested on the following Sourcemod & Metamod Versions. @@ -187,7 +164,7 @@ This plugin is tested on the following Sourcemod & Metamod Versions. ### Requirements -None. +- ColorLib (necessary only for compiling) ### Instructions @@ -197,9 +174,7 @@ None. - /configs/deathmatch/config_loader.ini (necessary only for deathmatch loader) - /configs/deathmatch/spawns/*.txt - /plugins/deathmatch.smx -- /plugins/deathmatch_loader.smx - /scripting/deathmatch.sp (necessary only for compiling) -- /scripting/deathmatch_loader.sp (necessary only for compiling) ### Changelog @@ -208,7 +183,7 @@ To view the most recent changelog visit the my releases. +Please download the latest **deathmatch.zip** file from releases. ### Bugs @@ -232,6 +207,8 @@ A thank you to those who helped: - k4tyxd (Japanese Translation) - b3none (Improvements) - Drixevel (Improvements) +- HugoJF (Improvements) +- UntitledSoldier (Debugging and Testing) ### Donate @@ -239,3 +216,9 @@ If you think I am doing a good job or you want to buy me a beer or feed my cat, Thanks! csgo deathmatch plugin donate + +### Donators + +People who have shown how much they have enjoyed this plugin: + +- UntitledSoldier $80 diff --git a/configs/deathmatch/config_loader.ini b/configs/deathmatch/config_loader.ini index 28b8b56..8e0e53c 100644 --- a/configs/deathmatch/config_loader.ini +++ b/configs/deathmatch/config_loader.ini @@ -5,7 +5,7 @@ * "*" * { * // FIRST: "[event type](clients|round|timeleft):" -* // SECOND: "[time](seconds):[config](filename):[option](respawn|restart|nextround)" +* // SECOND: "[countdown time](seconds):[config](filename):[option](respawn|restart|nextround)" * //-------------------------------------------------------------------------------- * // FIRST SECOND * "clients:0" "0:deathmatch_default.ini:respawn" @@ -27,8 +27,12 @@ { "*" { - "timeleft:15" "5:deathmatch_rifles.ini:respawn" - "timeleft:30" "5:deathmatch_shotguns.ini:respawn" - "timeleft:45" "5:deathmatch_smgs.ini:respawn" + "clients:0" "0:deathmatch.ini:respawn" + "timeleft:30" "5:deathmatch.ini:respawn" + "timeleft:35" "5:deathmatch_snipers.ini:respawn" + "timeleft:40" "5:deathmatch_rifles.ini:respawn" + "timeleft:45" "5:deathmatch_shotguns.ini:respawn" + "timeleft:50" "5:deathmatch_smgs.ini:respawn" + "timeleft:55" "5:deathmatch_pistols.ini:respawn" } } \ No newline at end of file diff --git a/configs/deathmatch/deathmatch.ini b/configs/deathmatch/deathmatch.ini index 2321ff5..970da71 100644 --- a/configs/deathmatch/deathmatch.ini +++ b/configs/deathmatch/deathmatch.ini @@ -24,15 +24,25 @@ // Default: yes "dm_welcomemsg" "yes" + // Display a message informing the players of current settings and options. + // -- + // Default: yes + "dm_infomsg" "yes" + // Free for all mode. // -- // Default: no - "dm_free_for_all" "no" + "dm_free_for_all" "yes" // Hides the radar from players. // -- // Default: no - "dm_hide_radar" "no" + "dm_hide_radar" "yes" + + // Allow clients the ability to reset their score. + // -- + // Default: yes + "dm_reset_score" "yes" // Enable kill feed to be displayed to all players. // -- @@ -44,30 +54,115 @@ // Default: no "dm_display_killfeed_player" "no" + // Enable clients to have their own kill feed. + // -- + // Default: yes + "dm_display_killfeed_player_allow_client" "yes" + // Display a panel showing enemies health and the damage done to a player. // -- // Default: "no" "dm_display_damage_panel" "no" + // Enable clients to have their own damage panel. + // -- + // Default: yes + "dm_display_damage_panel_allow_client" "no" + // Display text above the enemy showing damage done to an enemy. // -- // Default: no "dm_display_damage_popup" "no" + // Enable clients to have their own damage popup. + // -- + // Default: yes + "dm_display_damage_popup_allow_client" "no" + // Display text in chat showing damage done to an enemy. // -- // Default: no "dm_display_damage_text" "no" - // Enable the sounds of bodyshots. + // Enable clients to have their own damage text. + // -- + // Default: yes + "dm_display_damage_text_allow_client" "yes" + + // Play bell sound when a player hits another player. + // -- + // Default: no + "dm_sounds_bell_hit" "no" + + // Enable clients to have their bell sound for hits. + // -- + // Default: yes + "dm_sounds_bell_hit_allow_client" "yes" + + // Play bell sound when a player kills another player. + // -- + // Default: no + "dm_sounds_bell_kill" "no" + + // Enable clients to have their bell sound for kills. + // -- + // Default: yes + "dm_sounds_bell_kill_allow_client" "yes" + + // Play bell sound when a player kills another player. + // -- + // Default: no + "dm_sounds_bell_headshot" "no" + + // Enable clients to have their bell sound for kills. + // -- + // Default: yes + "dm_sounds_bell_headshot_allow_client" "yes" + + // Filter the sounds of player deaths. // -- // Default: yes - "dm_sounds_bodyshots" "yes" + "dm_sounds_deaths" "no" - // Enable the sounds of headshots. + // Enable clients to toggle the sounds of player deaths. // -- // Default: yes - "dm_sounds_headshots" "yes" + "dm_sounds_deaths_allow_client" "no" + + // Filter the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_bodyshots" "no" + + // Enable clients to toggle the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "no" + + // Filter the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots" "no" + + // Enable clients to toggle the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots_allow_client" "no" + + // Filter the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots" "yes" + + // Enable clients to toggle the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_allow_client" "yes" + + // Minimum distance from enemies at which a player can hear gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_distance" "1250.0" // Headshot only mode. // -- @@ -127,23 +222,23 @@ // Maximum number of attempts to find a suitable line of sight spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_los_attempts" "64" // Minimum distance from enemies at which a player can spawn. // -- - // Default: 500000.0 - "dm_spawn_distance" "500000.0" + // Default: 100000.0 + "dm_spawn_distance" "100000.0" // Maximum number of attempts to find a suitable distance spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_distance_attempts" "64" // Spawn protection time. // -- // Default: 1.0 - "dm_spawn_protection_time" "1.0" + "dm_spawn_protection_time" "0.0" // Remove damage from knife attacks. // -- @@ -223,17 +318,17 @@ // Replenish type. 1) Clip only. 2) Reserve only. 3) Both. // -- // Default: 2 - "dm_replenish_ammo_type" "2" + "dm_replenish_ammo_type" "3" // Replenish ammo on kill. // -- // Default: no - "dm_replenish_ammo_hs_kill" "no" + "dm_replenish_ammo_hs_kill" "yes" // Replenish type. 1) Clip only. 2) Reserve only. 3) Both. // -- // Default: 1 - "dm_replenish_ammo_hs_type" "1" + "dm_replenish_ammo_hs_type" "3" // Unlimited player grenades. // -- @@ -255,6 +350,11 @@ // Default: yes "dm_cash_messages" "yes" + // Enable players to earn HP for every kill. + // -- + // Default: yes + "dm_hp_enable" "yes" + // Spawn Health Points (HP). // -- // Default: 100 @@ -267,13 +367,13 @@ // Health Points (HP) per kill. // -- - // Default: 5 - "dm_hp_kill" "5" + // Default: 15 + "dm_hp_kill" "15" // Health Points (HP) per headshot kill. // -- - // Default: 10 - "dm_hp_headshot" "10" + // Default: 25 + "dm_hp_headshot" "25" // Health Points (HP) per knife kill. // -- @@ -290,6 +390,11 @@ // Default: yes "dm_hp_messages" "yes" + // Enable players to earn AP for every kill. + // -- + // Default: yes + "dm_ap_enable" "yes" + // Maximum Armor Points (AP). // -- // Default: 100 @@ -320,6 +425,29 @@ // Default: yes "dm_ap_messages" "yes" } + "Preferences" + { + // WARNING - BE CAREFUL! + // Once the client has join, these are the default cookie settings to be applied. + // The clients preferences will have to be changed by them via the settings menu. + // If not, you will need to delete data/sqlite/clientprefs-sqlite.sq3 + // -- + // Default: no + // -- + // Cookie Preference // Preference + "dm_cookie_damage_panel" "no" + "dm_cookie_damage_popup" "no" + "dm_cookie_damage_text" "yes" + "dm_cookie_killfeed" "no" + "dm_cookie_sounds_death" "no" + "dm_cookie_sounds_gunshots" "no" + "dm_cookie_sounds_bodyshots" "no" + "dm_cookie_sounds_headshots" "no" + "dm_cookie_headshot_only" "no" + "dm_cookie_bell_hit" "no" + "dm_cookie_bell_kill" "no" + "dm_cookie_bell_headshot" "no" + } "Equipment" { "Loadout" @@ -340,21 +468,21 @@ "weapon_famas" "-1" "weapon_awp" "-1" "weapon_ssg08" "-1" - "weapon_g3sg1" "-1" - "weapon_scar20" "-1" - "weapon_m249" "-1" - "weapon_negev" "-1" - "weapon_nova" "-1" - "weapon_xm1014" "-1" - "weapon_sawedoff" "-1" - "weapon_mag7" "-1" - "weapon_mac10" "-1" - "weapon_mp9" "-1" - "weapon_mp7" "-1" - "weapon_mp5sd" "-1" - "weapon_ump45" "-1" - "weapon_p90" "-1" - "weapon_bizon" "-1" + "weapon_g3sg1" "0" + "weapon_scar20" "0" + "weapon_m249" "0" + "weapon_negev" "0" + "weapon_nova" "0" + "weapon_xm1014" "0" + "weapon_sawedoff" "0" + "weapon_mag7" "0" + "weapon_mac10" "0" + "weapon_mp9" "0" + "weapon_mp7" "0" + "weapon_mp5sd" "0" + "weapon_ump45" "0" + "weapon_p90" "0" + "weapon_bizon" "0" } "Secondary" { @@ -366,7 +494,7 @@ "weapon_fiveseven" "-1" "weapon_deagle" "-1" "weapon_revolver" "-1" - "weapon_elite" "-1" + "weapon_elite" "0" "weapon_tec9" "-1" "weapon_hkp2000" "-1" } diff --git a/configs/deathmatch/deathmatch_pistols.ini b/configs/deathmatch/deathmatch_pistols.ini index 8b40916..dcce09f 100644 --- a/configs/deathmatch/deathmatch_pistols.ini +++ b/configs/deathmatch/deathmatch_pistols.ini @@ -24,6 +24,11 @@ // Default: yes "dm_welcomemsg" "yes" + // Display a message informing the players of current settings and options. + // -- + // Default: yes + "dm_infomsg" "yes" + // Free for all mode. // -- // Default: no @@ -34,6 +39,11 @@ // Default: no "dm_hide_radar" "no" + // Allow clients the ability to reset their score. + // -- + // Default: yes + "dm_reset_score" "yes" + // Enable kill feed to be displayed to all players. // -- // Default: yes @@ -44,31 +54,86 @@ // Default: no "dm_display_killfeed_player" "no" + // Enable clients to have their own kill feed. + // -- + // Default: yes + "dm_display_killfeed_player_allow_client" "yes" + // Display a panel showing enemies health and the damage done to a player. // -- // Default: "no" "dm_display_damage_panel" "no" + // Enable clients to have their own damage panel. + // -- + // Default: yes + "dm_display_damage_panel_allow_client" "yes" + // Display text above the enemy showing damage done to an enemy. // -- // Default: no "dm_display_damage_popup" "no" + // Enable clients to have their own damage popup. + // -- + // Default: yes + "dm_display_damage_popup_allow_client" "yes" + // Display text in chat showing damage done to an enemy. // -- // Default: no "dm_display_damage_text" "no" - // Enable the sounds of bodyshots. + // Enable clients to have their own damage text. + // -- + // Default: yes + "dm_display_damage_text_allow_client" "yes" + + // Filter the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths" "yes" + + // Enable clients to toggle the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of bodyshots. // -- // Default: yes "dm_sounds_bodyshots" "yes" - // Enable the sounds of headshots. + // Enable clients to toggle the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of headshots. // -- // Default: yes "dm_sounds_headshots" "yes" + // Enable clients to toggle the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots_allow_client" "yes" + + // Filter the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots" "yes" + + // Enable clients to toggle the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_allow_client" "yes" + + // Minimum distance from enemies at which a player can hear gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_distance" "1250.0" + // Headshot only mode. // -- // Default: no @@ -127,17 +192,17 @@ // Maximum number of attempts to find a suitable line of sight spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_los_attempts" "64" // Minimum distance from enemies at which a player can spawn. // -- - // Default: 500000.0 - "dm_spawn_distance" "500000.0" + // Default: 100000.0 + "dm_spawn_distance" "100000.0" // Maximum number of attempts to find a suitable distance spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_distance_attempts" "64" // Spawn protection time. @@ -255,6 +320,11 @@ // Default: yes "dm_cash_messages" "yes" + // Enable players to earn HP for every kill. + // -- + // Default: yes + "dm_hp_enable" "yes" + // Spawn Health Points (HP). // -- // Default: 100 @@ -267,13 +337,13 @@ // Health Points (HP) per kill. // -- - // Default: 5 - "dm_hp_kill" "5" + // Default: 15 + "dm_hp_kill" "15" // Health Points (HP) per headshot kill. // -- - // Default: 10 - "dm_hp_headshot" "10" + // Default: 25 + "dm_hp_headshot" "25" // Health Points (HP) per knife kill. // -- @@ -290,6 +360,11 @@ // Default: yes "dm_hp_messages" "yes" + // Enable players to earn AP for every kill. + // -- + // Default: yes + "dm_ap_enable" "yes" + // Maximum Armor Points (AP). // -- // Default: 100 @@ -320,6 +395,26 @@ // Default: yes "dm_ap_messages" "yes" } + "Preferences" + { + // WARNING - BE CAREFUL! + // Once the client has join, these are the default cookie settings to be applied. + // The clients preferences will have to be changed by them via the settings menu. + // If not, you will need to delete data/sqlite/clientprefs-sqlite.sq3 + // -- + // Default: no + // -- + // Cookie Preference // Preference + "dm_cookie_damage_panel" "no" + "dm_cookie_damage_popup" "no" + "dm_cookie_damage_text" "no" + "dm_cookie_killfeed" "no" + "dm_cookie_sounds_death" "no" + "dm_cookie_sounds_gunshots" "no" + "dm_cookie_sounds_bodyshots" "no" + "dm_cookie_sounds_headshots" "no" + "dm_cookie_headshot_only" "no" + } "Equipment" { "Loadout" diff --git a/configs/deathmatch/deathmatch_rifles.ini b/configs/deathmatch/deathmatch_rifles.ini index 1779520..8f2888c 100644 --- a/configs/deathmatch/deathmatch_rifles.ini +++ b/configs/deathmatch/deathmatch_rifles.ini @@ -24,6 +24,11 @@ // Default: yes "dm_welcomemsg" "yes" + // Display a message informing the players of current settings and options. + // -- + // Default: yes + "dm_infomsg" "yes" + // Free for all mode. // -- // Default: no @@ -34,6 +39,11 @@ // Default: no "dm_hide_radar" "no" + // Allow clients the ability to reset their score. + // -- + // Default: yes + "dm_reset_score" "yes" + // Enable kill feed to be displayed to all players. // -- // Default: yes @@ -44,31 +54,86 @@ // Default: no "dm_display_killfeed_player" "no" + // Enable clients to have their own kill feed. + // -- + // Default: yes + "dm_display_killfeed_player_allow_client" "yes" + // Display a panel showing enemies health and the damage done to a player. // -- // Default: "no" "dm_display_damage_panel" "no" + // Enable clients to have their own damage panel. + // -- + // Default: yes + "dm_display_damage_panel_allow_client" "yes" + // Display text above the enemy showing damage done to an enemy. // -- // Default: no "dm_display_damage_popup" "no" + // Enable clients to have their own damage popup. + // -- + // Default: yes + "dm_display_damage_popup_allow_client" "yes" + // Display text in chat showing damage done to an enemy. // -- // Default: no "dm_display_damage_text" "no" - // Enable the sounds of bodyshots. + // Enable clients to have their own damage text. + // -- + // Default: yes + "dm_display_damage_text_allow_client" "yes" + + // Filter the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths" "yes" + + // Enable clients to toggle the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of bodyshots. // -- // Default: yes "dm_sounds_bodyshots" "yes" - // Enable the sounds of headshots. + // Enable clients to toggle the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of headshots. // -- // Default: yes "dm_sounds_headshots" "yes" + // Enable clients to toggle the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots_allow_client" "yes" + + // Filter the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots" "yes" + + // Enable clients to toggle the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_allow_client" "yes" + + // Minimum distance from enemies at which a player can hear gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_distance" "1250.0" + // Headshot only mode. // -- // Default: no @@ -127,17 +192,17 @@ // Maximum number of attempts to find a suitable line of sight spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_los_attempts" "64" // Minimum distance from enemies at which a player can spawn. // -- - // Default: 500000.0 - "dm_spawn_distance" "500000.0" + // Default: 100000.0 + "dm_spawn_distance" "100000.0" // Maximum number of attempts to find a suitable distance spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_distance_attempts" "64" // Spawn protection time. @@ -255,6 +320,11 @@ // Default: yes "dm_cash_messages" "yes" + // Enable players to earn HP for every kill. + // -- + // Default: yes + "dm_hp_enable" "yes" + // Spawn Health Points (HP). // -- // Default: 100 @@ -267,13 +337,13 @@ // Health Points (HP) per kill. // -- - // Default: 5 - "dm_hp_kill" "5" + // Default: 15 + "dm_hp_kill" "15" // Health Points (HP) per headshot kill. // -- - // Default: 10 - "dm_hp_headshot" "10" + // Default: 25 + "dm_hp_headshot" "25" // Health Points (HP) per knife kill. // -- @@ -290,6 +360,11 @@ // Default: yes "dm_hp_messages" "yes" + // Enable players to earn AP for every kill. + // -- + // Default: yes + "dm_ap_enable" "yes" + // Maximum Armor Points (AP). // -- // Default: 100 @@ -320,6 +395,26 @@ // Default: yes "dm_ap_messages" "yes" } + "Preferences" + { + // WARNING - BE CAREFUL! + // Once the client has join, these are the default cookie settings to be applied. + // The clients preferences will have to be changed by them via the settings menu. + // If not, you will need to delete data/sqlite/clientprefs-sqlite.sq3 + // -- + // Default: no + // -- + // Cookie Preference // Preference + "dm_cookie_damage_panel" "no" + "dm_cookie_damage_popup" "no" + "dm_cookie_damage_text" "no" + "dm_cookie_killfeed" "no" + "dm_cookie_sounds_death" "no" + "dm_cookie_sounds_gunshots" "no" + "dm_cookie_sounds_bodyshots" "no" + "dm_cookie_sounds_headshots" "no" + "dm_cookie_headshot_only" "no" + } "Equipment" { "Loadout" diff --git a/configs/deathmatch/deathmatch_shotguns.ini b/configs/deathmatch/deathmatch_shotguns.ini index 537fefc..b90d218 100644 --- a/configs/deathmatch/deathmatch_shotguns.ini +++ b/configs/deathmatch/deathmatch_shotguns.ini @@ -24,6 +24,11 @@ // Default: yes "dm_welcomemsg" "yes" + // Display a message informing the players of current settings and options. + // -- + // Default: yes + "dm_infomsg" "yes" + // Free for all mode. // -- // Default: no @@ -34,6 +39,11 @@ // Default: no "dm_hide_radar" "no" + // Allow clients the ability to reset their score. + // -- + // Default: yes + "dm_reset_score" "yes" + // Enable kill feed to be displayed to all players. // -- // Default: yes @@ -44,31 +54,86 @@ // Default: no "dm_display_killfeed_player" "no" + // Enable clients to have their own kill feed. + // -- + // Default: yes + "dm_display_killfeed_player_allow_client" "yes" + // Display a panel showing enemies health and the damage done to a player. // -- // Default: "no" "dm_display_damage_panel" "no" + // Enable clients to have their own damage panel. + // -- + // Default: yes + "dm_display_damage_panel_allow_client" "yes" + // Display text above the enemy showing damage done to an enemy. // -- // Default: no "dm_display_damage_popup" "no" + // Enable clients to have their own damage popup. + // -- + // Default: yes + "dm_display_damage_popup_allow_client" "yes" + // Display text in chat showing damage done to an enemy. // -- // Default: no "dm_display_damage_text" "no" - // Enable the sounds of bodyshots. + // Enable clients to have their own damage text. + // -- + // Default: yes + "dm_display_damage_text_allow_client" "yes" + + // Filter the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths" "yes" + + // Enable clients to toggle the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of bodyshots. // -- // Default: yes "dm_sounds_bodyshots" "yes" - // Enable the sounds of headshots. + // Enable clients to toggle the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of headshots. // -- // Default: yes "dm_sounds_headshots" "yes" + // Enable clients to toggle the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots_allow_client" "yes" + + // Filter the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots" "yes" + + // Enable clients to toggle the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_allow_client" "yes" + + // Minimum distance from enemies at which a player can hear gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_distance" "1250.0" + // Headshot only mode. // -- // Default: no @@ -127,17 +192,17 @@ // Maximum number of attempts to find a suitable line of sight spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_los_attempts" "64" // Minimum distance from enemies at which a player can spawn. // -- - // Default: 500000.0 - "dm_spawn_distance" "500000.0" + // Default: 100000.0 + "dm_spawn_distance" "100000.0" // Maximum number of attempts to find a suitable distance spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_distance_attempts" "64" // Spawn protection time. @@ -255,6 +320,11 @@ // Default: yes "dm_cash_messages" "yes" + // Enable players to earn HP for every kill. + // -- + // Default: yes + "dm_hp_enable" "yes" + // Spawn Health Points (HP). // -- // Default: 100 @@ -267,13 +337,13 @@ // Health Points (HP) per kill. // -- - // Default: 5 - "dm_hp_kill" "5" + // Default: 15 + "dm_hp_kill" "15" // Health Points (HP) per headshot kill. // -- - // Default: 10 - "dm_hp_headshot" "10" + // Default: 25 + "dm_hp_headshot" "25" // Health Points (HP) per knife kill. // -- @@ -290,6 +360,11 @@ // Default: yes "dm_hp_messages" "yes" + // Enable players to earn AP for every kill. + // -- + // Default: yes + "dm_ap_enable" "yes" + // Maximum Armor Points (AP). // -- // Default: 100 @@ -320,6 +395,26 @@ // Default: yes "dm_ap_messages" "yes" } + "Preferences" + { + // WARNING - BE CAREFUL! + // Once the client has join, these are the default cookie settings to be applied. + // The clients preferences will have to be changed by them via the settings menu. + // If not, you will need to delete data/sqlite/clientprefs-sqlite.sq3 + // -- + // Default: no + // -- + // Cookie Preference // Preference + "dm_cookie_damage_panel" "no" + "dm_cookie_damage_popup" "no" + "dm_cookie_damage_text" "no" + "dm_cookie_killfeed" "no" + "dm_cookie_sounds_death" "no" + "dm_cookie_sounds_gunshots" "no" + "dm_cookie_sounds_bodyshots" "no" + "dm_cookie_sounds_headshots" "no" + "dm_cookie_headshot_only" "no" + } "Equipment" { "Loadout" diff --git a/configs/deathmatch/deathmatch_smgs.ini b/configs/deathmatch/deathmatch_smgs.ini index 4ceaf3e..6beeb32 100644 --- a/configs/deathmatch/deathmatch_smgs.ini +++ b/configs/deathmatch/deathmatch_smgs.ini @@ -24,6 +24,11 @@ // Default: yes "dm_welcomemsg" "yes" + // Display a message informing the players of current settings and options. + // -- + // Default: yes + "dm_infomsg" "yes" + // Free for all mode. // -- // Default: no @@ -34,6 +39,11 @@ // Default: no "dm_hide_radar" "no" + // Allow clients the ability to reset their score. + // -- + // Default: yes + "dm_reset_score" "yes" + // Enable kill feed to be displayed to all players. // -- // Default: yes @@ -44,31 +54,86 @@ // Default: no "dm_display_killfeed_player" "no" + // Enable clients to have their own kill feed. + // -- + // Default: yes + "dm_display_killfeed_player_allow_client" "yes" + // Display a panel showing enemies health and the damage done to a player. // -- // Default: "no" "dm_display_damage_panel" "no" + // Enable clients to have their own damage panel. + // -- + // Default: yes + "dm_display_damage_panel_allow_client" "yes" + // Display text above the enemy showing damage done to an enemy. // -- // Default: no "dm_display_damage_popup" "no" + // Enable clients to have their own damage popup. + // -- + // Default: yes + "dm_display_damage_popup_allow_client" "yes" + // Display text in chat showing damage done to an enemy. // -- // Default: no "dm_display_damage_text" "no" - // Enable the sounds of bodyshots. + // Enable clients to have their own damage text. + // -- + // Default: yes + "dm_display_damage_text_allow_client" "yes" + + // Filter the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths" "yes" + + // Enable clients to toggle the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of bodyshots. // -- // Default: yes "dm_sounds_bodyshots" "yes" - // Enable the sounds of headshots. + // Enable clients to toggle the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of headshots. // -- // Default: yes "dm_sounds_headshots" "yes" + // Enable clients to toggle the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots_allow_client" "yes" + + // Filter the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots" "yes" + + // Enable clients to toggle the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_allow_client" "yes" + + // Minimum distance from enemies at which a player can hear gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_distance" "1250.0" + // Headshot only mode. // -- // Default: no @@ -127,17 +192,17 @@ // Maximum number of attempts to find a suitable line of sight spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_los_attempts" "64" // Minimum distance from enemies at which a player can spawn. // -- - // Default: 500000.0 - "dm_spawn_distance" "500000.0" + // Default: 100000.0 + "dm_spawn_distance" "100000.0" // Maximum number of attempts to find a suitable distance spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_distance_attempts" "64" // Spawn protection time. @@ -255,6 +320,11 @@ // Default: yes "dm_cash_messages" "yes" + // Enable players to earn HP for every kill. + // -- + // Default: yes + "dm_hp_enable" "yes" + // Spawn Health Points (HP). // -- // Default: 100 @@ -267,13 +337,13 @@ // Health Points (HP) per kill. // -- - // Default: 5 - "dm_hp_kill" "5" + // Default: 15 + "dm_hp_kill" "15" // Health Points (HP) per headshot kill. // -- - // Default: 10 - "dm_hp_headshot" "10" + // Default: 25 + "dm_hp_headshot" "25" // Health Points (HP) per knife kill. // -- @@ -290,6 +360,11 @@ // Default: yes "dm_hp_messages" "yes" + // Enable players to earn AP for every kill. + // -- + // Default: yes + "dm_ap_enable" "yes" + // Maximum Armor Points (AP). // -- // Default: 100 @@ -320,6 +395,26 @@ // Default: yes "dm_ap_messages" "yes" } + "Preferences" + { + // WARNING - BE CAREFUL! + // Once the client has join, these are the default cookie settings to be applied. + // The clients preferences will have to be changed by them via the settings menu. + // If not, you will need to delete data/sqlite/clientprefs-sqlite.sq3 + // -- + // Default: no + // -- + // Cookie Preference // Preference + "dm_cookie_damage_panel" "no" + "dm_cookie_damage_popup" "no" + "dm_cookie_damage_text" "no" + "dm_cookie_killfeed" "no" + "dm_cookie_sounds_death" "no" + "dm_cookie_sounds_gunshots" "no" + "dm_cookie_sounds_bodyshots" "no" + "dm_cookie_sounds_headshots" "no" + "dm_cookie_headshot_only" "no" + } "Equipment" { "Loadout" diff --git a/configs/deathmatch/deathmatch_snipers.ini b/configs/deathmatch/deathmatch_snipers.ini index 7fab819..8f5f117 100644 --- a/configs/deathmatch/deathmatch_snipers.ini +++ b/configs/deathmatch/deathmatch_snipers.ini @@ -24,6 +24,11 @@ // Default: yes "dm_welcomemsg" "yes" + // Display a message informing the players of current settings and options. + // -- + // Default: yes + "dm_infomsg" "yes" + // Free for all mode. // -- // Default: no @@ -34,6 +39,11 @@ // Default: no "dm_hide_radar" "no" + // Allow clients the ability to reset their score. + // -- + // Default: yes + "dm_reset_score" "yes" + // Enable kill feed to be displayed to all players. // -- // Default: yes @@ -44,31 +54,86 @@ // Default: no "dm_display_killfeed_player" "no" + // Enable clients to have their own kill feed. + // -- + // Default: yes + "dm_display_killfeed_player_allow_client" "yes" + // Display a panel showing enemies health and the damage done to a player. // -- // Default: "no" "dm_display_damage_panel" "no" + // Enable clients to have their own damage panel. + // -- + // Default: yes + "dm_display_damage_panel_allow_client" "yes" + // Display text above the enemy showing damage done to an enemy. // -- // Default: no "dm_display_damage_popup" "no" + // Enable clients to have their own damage popup. + // -- + // Default: yes + "dm_display_damage_popup_allow_client" "yes" + // Display text in chat showing damage done to an enemy. // -- // Default: no "dm_display_damage_text" "no" - // Enable the sounds of bodyshots. + // Enable clients to have their own damage text. + // -- + // Default: yes + "dm_display_damage_text_allow_client" "yes" + + // Filter the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths" "yes" + + // Enable clients to toggle the sounds of player deaths. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of bodyshots. // -- // Default: yes "dm_sounds_bodyshots" "yes" - // Enable the sounds of headshots. + // Enable clients to toggle the sounds of bodyshots. + // -- + // Default: yes + "dm_sounds_deaths_allow_client" "yes" + + // Filter the sounds of headshots. // -- // Default: yes "dm_sounds_headshots" "yes" + // Enable clients to toggle the sounds of headshots. + // -- + // Default: yes + "dm_sounds_headshots_allow_client" "yes" + + // Filter the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots" "yes" + + // Enable clients to toggle the sounds of gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_allow_client" "yes" + + // Minimum distance from enemies at which a player can hear gunshots. + // -- + // Default: yes + "dm_sounds_gunshots_distance" "1250.0" + // Headshot only mode. // -- // Default: no @@ -127,17 +192,17 @@ // Maximum number of attempts to find a suitable line of sight spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_los_attempts" "64" // Minimum distance from enemies at which a player can spawn. // -- - // Default: 500000.0 - "dm_spawn_distance" "500000.0" + // Default: 100000.0 + "dm_spawn_distance" "100000.0" // Maximum number of attempts to find a suitable distance spawn point. // -- - // Default: 10 + // Default: 64 "dm_spawn_distance_attempts" "64" // Spawn protection time. @@ -255,6 +320,11 @@ // Default: yes "dm_cash_messages" "yes" + // Enable players to earn HP for every kill. + // -- + // Default: yes + "dm_hp_enable" "yes" + // Spawn Health Points (HP). // -- // Default: 100 @@ -267,13 +337,13 @@ // Health Points (HP) per kill. // -- - // Default: 5 - "dm_hp_kill" "5" + // Default: 15 + "dm_hp_kill" "15" // Health Points (HP) per headshot kill. // -- - // Default: 10 - "dm_hp_headshot" "10" + // Default: 25 + "dm_hp_headshot" "25" // Health Points (HP) per knife kill. // -- @@ -290,6 +360,11 @@ // Default: yes "dm_hp_messages" "yes" + // Enable players to earn AP for every kill. + // -- + // Default: yes + "dm_ap_enable" "yes" + // Maximum Armor Points (AP). // -- // Default: 100 @@ -320,6 +395,26 @@ // Default: yes "dm_ap_messages" "yes" } + "Preferences" + { + // WARNING - BE CAREFUL! + // Once the client has join, these are the default cookie settings to be applied. + // The clients preferences will have to be changed by them via the settings menu. + // If not, you will need to delete data/sqlite/clientprefs-sqlite.sq3 + // -- + // Default: no + // -- + // Cookie Preference // Preference + "dm_cookie_damage_panel" "no" + "dm_cookie_damage_popup" "no" + "dm_cookie_damage_text" "no" + "dm_cookie_killfeed" "no" + "dm_cookie_sounds_death" "no" + "dm_cookie_sounds_gunshots" "no" + "dm_cookie_sounds_bodyshots" "no" + "dm_cookie_sounds_headshots" "no" + "dm_cookie_headshot_only" "no" + } "Equipment" { "Loadout" diff --git a/configs/deathmatch/spawns/cs_italy.txt b/configs/deathmatch/spawns/cs_italy.txt index 99758fa..1a6c80d 100644 --- a/configs/deathmatch/spawns/cs_italy.txt +++ b/configs/deathmatch/spawns/cs_italy.txt @@ -1,28 +1,62 @@ -1007.975585 1972.031250 0.031250 0.000000 148.740081 0.000000 -995.968750 2296.031250 0.031250 0.000000 140.512557 0.000000 -995.968750 2543.968750 128.031250 0.000000 -169.595031 0.000000 -544.031250 2144.031250 128.031250 0.000000 42.766841 0.000000 -1007.968750 1932.169555 128.031250 0.000000 150.292922 0.000000 -495.968750 2384.031250 0.031250 0.000000 167.233123 0.000000 --4.031250 1420.031250 -151.968750 0.000000 139.625579 0.000000 --911.968750 1995.849365 9.022192 0.000000 -42.618049 0.000000 --968.031250 1391.968750 0.031250 0.000000 -134.074035 0.000000 --1519.968750 49.031250 8.031250 0.000000 41.711322 0.000000 --1327.968750 1311.968750 -151.968750 0.000000 -22.959175 0.000000 --751.716613 864.031250 -151.968750 0.000000 45.807220 0.000000 --191.968750 608.031250 -150.968750 0.000000 72.975700 0.000000 -144.002685 431.968750 -151.968750 0.000000 -52.436130 0.000000 -1071.968750 -175.968750 -151.968750 0.000000 151.340652 0.000000 -1043.968750 -743.148742 -151.968750 0.000000 160.862945 0.000000 -150.682968 -85.447441 -151.968750 0.000000 -43.735095 0.000000 --423.968750 -80.031250 -151.968750 0.000000 -65.279182 0.000000 --224.031250 -1103.070068 -151.968750 0.000000 137.902130 0.000000 --448.031250 -2029.968750 -237.968750 0.000000 126.637100 0.000000 --1111.990478 -1600.387084 -151.968750 0.000000 -15.482912 0.000000 --464.031250 479.968750 8.031250 0.000000 -118.432418 0.000000 --603.208984 2159.993164 8.031250 0.000000 -89.411659 0.000000 -927.968750 978.031250 -102.799842 0.000000 146.645675 0.000000 --655.968750 1168.031250 -55.968750 0.000000 40.129432 0.000000 --1139.968750 -200.591140 -151.968750 0.000000 -0.963881 0.000000 --727.968750 767.968750 8.031250 0.000000 -47.835002 0.000000 --319.968750 2527.968750 8.031250 0.000000 -37.774539 0.000000 +-1111.999511 -2031.968750 -151.968750 0.000000 57.771606 0.000000 +-1111.999511 -2031.968750 -151.968750 0.000000 57.771606 0.000000 +-1111.999511 -2031.968750 -151.968750 0.000000 57.771606 0.000000 +-1101.313110 -1497.028198 -121.062774 0.000000 320.251464 0.000000 +-640.777832 -2158.448974 -237.968750 0.000000 93.773803 0.000000 +-448.031250 -2000.244506 -231.968750 0.000000 132.802734 0.000000 +-224.031250 -1103.097045 -151.968750 0.000000 158.773193 0.000000 +-228.031250 -665.099975 -150.968750 0.000000 180.823974 0.000000 +-408.981597 -84.722694 -151.968750 0.000000 282.595825 0.000000 +149.377761 -763.968750 -151.968750 0.000000 23.790893 0.000000 +503.968750 -795.968750 -151.968750 0.000000 119.196166 0.000000 +988.585083 -799.968750 -151.968750 0.000000 101.442260 0.000000 +1071.968750 -656.006042 -151.968750 0.000000 191.343383 0.000000 +1071.998413 -49.031250 -151.968750 0.000000 219.649658 0.000000 +1071.315185 -171.757461 -151.968750 0.000000 168.755493 0.000000 +1007.995605 2095.968750 0.031250 0.000000 193.562622 0.000000 +1007.968750 2247.968750 0.031250 0.000000 222.956542 0.000000 +544.031250 2144.006835 0.031250 0.000000 30.009155 0.000000 +547.475219 2247.968750 0.031250 0.000000 344.447631 0.000000 +995.968750 2543.977294 0.031250 0.000000 219.490356 0.000000 +989.615295 2296.031250 0.031250 0.000000 147.348632 0.000000 +556.031250 2543.968750 0.031250 0.000000 305.546264 0.000000 +995.968750 2543.968750 128.031250 0.000000 200.544433 0.000000 +1007.968750 2247.968750 128.031250 0.000000 235.722656 0.000000 +1007.999633 2095.995361 128.031250 0.000000 182.636718 0.000000 +935.306945 1881.187500 128.031250 0.000000 143.887939 0.000000 +489.083160 2573.993652 8.031250 0.000000 221.698608 0.000000 +495.999481 2398.010009 0.031250 0.000000 171.293334 0.000000 +-311.968750 2543.999755 8.031250 0.000000 314.560546 0.000000 +-304.882141 2337.231689 8.031250 0.000000 49.350585 0.000000 +-615.968750 2159.997314 8.031250 0.000000 266.709594 0.000000 +-559.820739 1583.968750 -7.968751 0.000000 251.893310 0.000000 +-655.968750 1183.519042 -55.968750 0.000000 17.941894 0.000000 +-433.351623 1187.718505 -55.968750 0.000000 107.875976 0.000000 +-480.121582 1606.696899 -151.968750 0.000000 314.015502 0.000000 +-314.329254 1358.473388 -151.968750 0.000000 114.603881 0.000000 +-373.594024 1790.750732 -151.968750 0.000000 303.469848 0.000000 +-5.579178 1439.861083 -151.968750 0.000000 137.037963 0.000000 +-170.961044 608.011840 -150.972610 0.000000 84.325561 0.000000 +-958.946777 852.252319 -151.502838 0.000000 120.536499 0.000000 +-751.716613 871.169494 -151.968750 0.000000 16.018066 0.000000 +-1285.116699 1311.968750 -153.968750 0.000000 306.514282 0.000000 +-1461.771728 152.166015 -151.600311 0.000000 50.465698 0.000000 +-1268.413574 -35.968750 -151.968750 0.000000 24.439086 0.000000 +-901.129699 81.139785 -151.968750 0.000000 233.173828 0.000000 +-1126.098999 -202.208190 -151.968750 0.000000 325.614013 0.000000 +-1135.792968 -399.566711 -151.968750 0.000000 358.555297 0.000000 +-1126.827026 -635.997863 -151.968750 0.000000 53.107910 0.000000 +-1055.968750 -1023.892150 -151.968750 0.000000 29.642333 0.000000 +-991.968750 -1177.189575 -151.968750 0.000000 62.852783 0.000000 +-1519.803588 49.031250 8.031250 0.000000 44.093627 0.000000 +-1391.968750 -35.972961 8.031250 0.000000 70.405883 0.000000 +-1504.150390 1326.678710 8.031250 0.000000 323.580322 0.000000 +-1095.968750 1389.529541 0.031250 0.000000 280.722656 0.000000 +-968.031250 1372.114868 0.031250 0.000000 246.191406 0.000000 +-1095.968750 1112.031250 0.031250 0.000000 52.498168 0.000000 +-720.281066 739.732482 8.031250 0.000000 307.342529 0.000000 +-464.737915 610.916320 8.031250 0.000000 17.941894 0.000000 +-272.031250 592.031250 8.031250 0.000000 157.186889 0.000000 +-709.027770 152.031250 8.031250 0.000000 3.901367 0.000000 +-468.774017 152.031250 8.031250 0.000000 114.993896 0.000000 +-282.944213 -91.716178 -31.968750 0.000000 256.492309 0.000000 diff --git a/configs/deathmatch/spawns/de_overpass.txt b/configs/deathmatch/spawns/de_overpass.txt index 4d6b0ee..67a888e 100644 --- a/configs/deathmatch/spawns/de_overpass.txt +++ b/configs/deathmatch/spawns/de_overpass.txt @@ -1,7 +1,4 @@ -1670.940917 654.104614 480.031250 0.000000 151.122863 0.000000 --2162.031250 33.068061 405.377563 0.000000 -164.121643 0.000000 --3228.000244 -358.968750 536.031250 0.000000 152.976104 0.000000 --3402.031250 -1040.025390 510.073516 0.000000 -148.620666 0.000000 -441.828460 -317.021759 26.044109 0.000000 120.994895 0.000000 -1303.033081 -117.065338 15.466524 0.000000 123.215713 0.000000 -1765.281860 345.961639 256.031250 0.000000 6.874679 0.000000 @@ -20,7 +17,7 @@ -1807.494750 -1349.611572 240.031250 0.000000 154.447433 0.000000 -2008.085815 -820.497314 128.031250 0.000000 -122.950698 0.000000 -1638.045898 -1079.905883 96.031250 0.000000 45.484020 0.000000 --1251.968750 3.549708 98.031250 0.000000 39.900188 0.000000 +-1251.968750 3.549707 98.031250 0.000000 39.900188 0.000000 -784.031250 495.968750 96.031250 0.000000 -121.727218 0.000000 -1738.765625 78.920875 117.601066 0.000000 28.970577 0.000000 -2213.968750 191.019287 128.031250 0.000000 34.376159 0.000000 @@ -29,15 +26,13 @@ -2322.809814 1267.450439 480.031250 0.000000 -156.272460 0.000000 -2123.046875 418.361022 480.031250 0.000000 132.803924 0.000000 -2857.488281 -40.495090 447.349365 0.000000 41.625011 0.000000 --3092.283935 731.249389 480.031250 0.000000 12.578291 0.000000 --3959.968750 -267.019287 539.552978 0.000000 16.914621 0.000000 +-3092.283935 731.249389 480.031250 0.000000 12.578290 0.000000 -1999.294921 -953.378540 394.271453 0.000000 -166.655136 0.000000 -2563.074707 -473.851501 432.031250 0.000000 -24.629438 0.000000 -3241.393310 -661.867309 488.031250 0.000000 -138.915100 0.000000 -3939.187988 -1300.926269 513.412597 0.000000 71.480094 0.000000 -3556.512939 -2517.221679 476.404388 0.000000 56.332931 0.000000 -2850.881103 -2970.808593 480.113098 0.000000 79.548118 0.000000 --2347.681640 -1630.362670 484.837615 0.000000 -98.738616 0.000000 -1855.335449 -2592.364746 420.843414 0.000000 134.250350 0.000000 -1703.955810 -3208.000000 312.031250 0.000000 -0.119873 0.000000 -2449.712646 -2312.623535 489.031250 0.000000 -124.072799 0.000000 @@ -50,6 +45,11 @@ -897.185791 -607.427368 96.031250 0.000000 116.306823 0.000000 -1808.031250 -735.968750 128.031250 0.000000 121.260406 0.000000 -2069.968750 501.519287 256.031250 0.000000 33.274520 0.000000 --1744.009643 1311.968750 355.446899 0.000000 -99.283172 0.000000 -3171.968750 -1040.001708 527.555480 0.000000 -36.858249 0.000000 -1547.597290 -383.622894 29.015329 0.000000 -59.315921 0.000000 +-3418.043701 -1061.510620 507.531585 0.000000 233.162841 0.000000 +-3234.484619 -336.882141 531.553833 0.000000 145.750122 0.000000 +-3952.026367 -263.048248 538.769653 0.000000 333.012084 0.000000 +-1756.638793 1278.336181 354.732940 0.000000 230.712890 0.000000 +-2355.062744 -1636.532470 484.641723 0.000000 292.324218 0.000000 +-2209.156005 44.362949 413.109039 0.000000 219.105834 0.000000 diff --git a/scripting/deathmatch.sp b/scripting/deathmatch.sp index bd9b715..f806728 100644 --- a/scripting/deathmatch.sp +++ b/scripting/deathmatch.sp @@ -1,15 +1,32 @@ -#include -#include -#include +/** + * [CS:GO] Deathmatch + * + * Copyright (C) 2024 Maxximou5 + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see http://www.gnu.org/licenses/. + */ + #include -#include +#include #include +#include +#include #undef REQUIRE_PLUGIN #include #pragma newdecls required -#define PLUGIN_VERSION "3.0.0 BETA" +#define PLUGIN_VERSION "3.0.0" #define PLUGIN_NAME "[CS:GO] Deathmatch" #define PLUGIN_AUTHOR "Maxximou5" #define PLUGIN_DESCRIPTION "Enables deathmatch style gameplay (respawning, gun selection, spawn protection, etc)." @@ -25,24 +42,44 @@ public Plugin myinfo = } /* Defined Variables */ +//#define DEBUG #define MAX_SPAWNS 200 #define HIDEHUD_RADAR 1 << 12 #define DMG_HEADSHOT (1 << 30) /* Console variables */ -ConVar g_cvDM_enabled; ConVar g_cvDM_config_name; +ConVar g_cvDM_enabled; ConVar g_cvDM_enable_valve_deathmatch; ConVar g_cvDM_welcomemsg; +ConVar g_cvDM_infomsg; ConVar g_cvDM_free_for_all; ConVar g_cvDM_hide_radar; +ConVar g_cvDM_reset_score; ConVar g_cvDM_display_killfeed; ConVar g_cvDM_display_killfeed_player; +ConVar g_cvDM_display_killfeed_player_allow_client; ConVar g_cvDM_display_damage_panel; +ConVar g_cvDM_display_damage_panel_allow_client; ConVar g_cvDM_display_damage_popup; +ConVar g_cvDM_display_damage_popup_allow_client; ConVar g_cvDM_display_damage_text; +ConVar g_cvDM_display_damage_text_allow_client; +ConVar g_cvDM_sounds_bell_hit; +ConVar g_cvDM_sounds_bell_hit_allow_client; +ConVar g_cvDM_sounds_bell_kill; +ConVar g_cvDM_sounds_bell_kill_allow_client; +ConVar g_cvDM_sounds_bell_headshot; +ConVar g_cvDM_sounds_bell_headshot_allow_client; +ConVar g_cvDM_sounds_deaths; +ConVar g_cvDM_sounds_deaths_allow_client; ConVar g_cvDM_sounds_bodyshots; +ConVar g_cvDM_sounds_bodyshots_allow_client; ConVar g_cvDM_sounds_headshots; +ConVar g_cvDM_sounds_headshots_allow_client; +ConVar g_cvDM_sounds_gunshots; +ConVar g_cvDM_sounds_gunshots_allow_client; +ConVar g_cvDM_sounds_gunshots_distance; ConVar g_cvDM_headshot_only; ConVar g_cvDM_headshot_only_allow_client; ConVar g_cvDM_headshot_only_allow_world; @@ -80,6 +117,7 @@ ConVar g_cvDM_replenish_grenade; ConVar g_cvDM_replenish_grenade_kill; ConVar g_cvDM_nade_messages; ConVar g_cvDM_cash_messages; +ConVar g_cvDM_hp_enable; ConVar g_cvDM_hp_start; ConVar g_cvDM_hp_max; ConVar g_cvDM_hp_kill; @@ -87,6 +125,7 @@ ConVar g_cvDM_hp_headshot; ConVar g_cvDM_hp_knife; ConVar g_cvDM_hp_nade; ConVar g_cvDM_hp_messages; +ConVar g_cvDM_ap_enable; ConVar g_cvDM_ap_max; ConVar g_cvDM_ap_kill; ConVar g_cvDM_ap_headshot; @@ -116,6 +155,20 @@ ConVar g_cvDM_nades_smoke; ConVar g_cvDM_nades_tactical; ConVar g_cvDM_armor; +/* Cookie Preferences */ +ConVar g_cvDM_cookie_damage_panel; +ConVar g_cvDM_cookie_damage_popup; +ConVar g_cvDM_cookie_damage_text; +ConVar g_cvDM_cookie_killfeed; +ConVar g_cvDM_cookie_sounds_death; +ConVar g_cvDM_cookie_sounds_gunshots; +ConVar g_cvDM_cookie_sounds_bodyshots; +ConVar g_cvDM_cookie_sounds_headshots; +ConVar g_cvDM_cookie_headshot_only; +ConVar g_cvDM_cookie_bell_hit; +ConVar g_cvDM_cookie_bell_kill; +ConVar g_cvDM_cookie_bell_headshot; + /* Native Console Variables */ ConVar g_cvMP_ct_default_primary; ConVar g_cvMP_t_default_primary; @@ -151,11 +204,11 @@ ConVar g_cvAmmo_item_limit_healthshot; ConVar g_cvHealthshot_health; /* Native Backup Variables */ -char g_cBackup_mp_ct_default_primary[255]; -char g_cBackup_mp_t_default_primary[255]; -char g_cBackup_mp_ct_default_secondary[255]; -char g_cBackup_mp_t_default_secondary[255]; -char g_cBackup_mp_items_prohibited[255]; +char g_sBackup_mp_ct_default_primary[255]; +char g_sBackup_mp_t_default_primary[255]; +char g_sBackup_mp_ct_default_secondary[255]; +char g_sBackup_mp_t_default_secondary[255]; +char g_sBackup_mp_items_prohibited[255]; int g_iBackup_free_armor; int g_iBackup_max_armor; int g_iBackup_mp_randomspawn; @@ -185,6 +238,7 @@ float g_fBackup_ff_damage_reduction_grenade; float g_fBackup_ff_damage_reduction_other; /* Weapon Info */ +ArrayList g_aWeaponsList; ArrayList g_aPrimaryWeaponsAvailable; ArrayList g_aSecondaryWeaponsAvailable; ArrayList g_aConfigNames; @@ -197,22 +251,34 @@ StringMap g_smWeaponSkinsTeam; int g_iAmmoOffset; /* Player Variables */ -char g_cPrimaryWeapon[MAXPLAYERS+1][24]; -char g_cSecondaryWeapon[MAXPLAYERS+1][24]; +char g_sPrimaryWeapon[MAXPLAYERS+1][32]; +char g_sSecondaryWeapon[MAXPLAYERS+1][32]; +char g_sPrimaryWeaponPrevious[MAXPLAYERS+1][32]; +char g_sSecondaryWeaponPrevious[MAXPLAYERS+1][32]; bool g_bInEditMode = false; bool g_bInEditModeClient[MAXPLAYERS+1] = {false, ...}; bool g_bWeaponsGivenThisRound[MAXPLAYERS+1] = {false, ...}; bool g_bGiveFullLoadout[MAXPLAYERS+1] = {false, ...}; bool g_bRememberChoice[MAXPLAYERS+1] = {false, ...}; +bool g_bWelcomeMessage[MAXPLAYERS+1] = {false, ... }; bool g_bInfoMessage[MAXPLAYERS+1] = {false, ... }; bool g_bPlayerMoved[MAXPLAYERS+1] = {false, ...}; bool g_bPlayerHasZeus[MAXPLAYERS+1] = {false, ...}; -bool g_bDamagePanel[MAXPLAYERS+1] = {true, ...}; -bool g_bDamagePopup[MAXPLAYERS+1] = {true, ...}; -bool g_bDamageText[MAXPLAYERS+1] = {true, ...}; -bool g_bKillFeed[MAXPLAYERS+1] = {true, ...}; +bool g_bDamagePanel[MAXPLAYERS+1] = {false, ...}; +bool g_bDamagePopup[MAXPLAYERS+1] = {false, ...}; +bool g_bDamageText[MAXPLAYERS+1] = {false, ...}; +bool g_bKillFeed[MAXPLAYERS+1] = {false, ...}; +bool g_bSoundDeaths[96] = {false, ...}; +bool g_bSoundGunShots[96] = {false, ...}; +bool g_bSoundBodyShots[96] = {false, ...}; +bool g_bSoundHSShots[96] = {false, ...}; bool g_bHSOnlyClient[MAXPLAYERS+1] = {false, ...}; +bool g_bBellHit[MAXPLAYERS+1] = {false, ...}; +bool g_bBellKill[MAXPLAYERS+1] = {false, ...}; +bool g_bBellHeadshot[MAXPLAYERS+1] = {false, ...}; int g_iHealthshotCount[MAXPLAYERS+1] = 0; +int g_iDamageDone[MAXPLAYERS + 1][MAXPLAYERS + 1]; +int g_iDamageDoneHits[MAXPLAYERS + 1][MAXPLAYERS + 1]; /* Player Color Variables */ int g_iDefaultColor[4] = {255, 255, 255, 255}; @@ -233,9 +299,6 @@ int g_iHaloSprite = 0; /* Spawn Variables */ int g_iNumberOfPlayerSpawns = 0; -int g_iLosDisSearchAttempts = 0; -int g_iLosDisSearchSuccesses = 0; -int g_iLosDisSearchFailures = 0; int g_iLosSearchAttempts = 0; int g_iLosSearchSuccesses = 0; int g_iLosSearchFailures = 0; @@ -249,28 +312,30 @@ int g_iLastEditorSpawnPoint[MAXPLAYERS+1] = {-1, ...}; bool g_bRoundEnded = false; bool g_bLoadConfig = false; bool g_bLoadedConfig = false; -char g_cLoadConfig[PLATFORM_MAX_PATH] = ""; -char g_cLoadConfigMenu[32] = ""; -char g_cLoadConfigName[32] = ""; +char g_sLoadConfig[PLATFORM_MAX_PATH] = ""; +char g_sLoadConfigMenu[32] = ""; +char g_sLoadConfigName[32] = ""; /* Menus */ TopMenu g_tmAdminMenu = null; TopMenuObject g_tmoDMCommands; -Handle g_hCookieMenus[MAXPLAYERS+1]; -Handle g_hWeaponsMenus[MAXPLAYERS+1]; -Handle g_hPrimaryMenus[MAXPLAYERS+1]; -Handle g_hSecondaryMenus[MAXPLAYERS+1]; /* Baked Cookies */ Handle g_hWeapon_Primary_Cookie; Handle g_hWeapon_Secondary_Cookie; Handle g_hWeapon_Remember_Cookie; -Handle g_hWeapon_First_Cookie; Handle g_hDamage_Panel_Cookie; Handle g_hDamage_Popup_Cookie; Handle g_hDamage_Text_Cookie; Handle g_hKillFeed_Cookie; +Handle g_hSoundDeath_Cookie; +Handle g_hSoundGunShots_Cookie; +Handle g_hSoundBodyShots_Cookie; +Handle g_hSoundHSShots_Cookie; Handle g_hHSOnly_Cookie; +Handle g_hBellKill_Cookie; +Handle g_hBellHit_Cookie; +Handle g_hBellHeadshot_Cookie; #include "deathmatch/commands.sp" #include "deathmatch/configs.sp" @@ -295,6 +360,10 @@ public void OnPluginStart() LoadTranslations("common.phrases"); /* Load & Hook */ + HookMessages(); + HookEvents(); + HookTempEnts(); + HookSounds(); LoadWeapons(); LoadCvars(); LoadConfig("deathmatch.ini"); @@ -303,16 +372,12 @@ public void OnPluginStart() LoadCommands(); LoadChangeHooks(); LoadCookies(); - HookMessages(); - HookEvents(); - HookTempEnts(); - HookSounds(); /* SDK Hooks For Clients */ for (int i = 1; i <= MaxClients; i++) { - if (IsClientInGame(i)) - OnClientPutInServer(i); + if (!IsClientInGame(i)) continue; + OnClientPutInServer(i); } /* Update and Retrieve */ @@ -322,26 +387,7 @@ public void OnPluginStart() public void OnPluginEnd() { - for (int i = 1; i <= MaxClients; i++) - { - Timer_DisableSpawnProtection(INVALID_HANDLE, i); - OnClientDisconnect(i); - if (g_hCookieMenus[i] != INVALID_HANDLE) - CancelMenu(g_hCookieMenus[i]) - if (g_hWeaponsMenus[i] != INVALID_HANDLE) - CancelMenu(g_hWeaponsMenus[i]); - if (g_hPrimaryMenus[i] != INVALID_HANDLE) - CancelMenu(g_hPrimaryMenus[i]); - if (g_hSecondaryMenus[i] != INVALID_HANDLE) - CancelMenu(g_hSecondaryMenus[i]); - } - State_SetBuyZones("Enable"); - State_SetObjectives("Enable"); - State_RestoreSpawnPoints(); - State_RestoreSpawnWeapons(); - State_RestoreCash(); - State_RestoreGrenade(); - State_DisableFFA(); + State_DisableDM() } public void OnConfigsExecuted() @@ -357,11 +403,14 @@ public void OnMapStart() g_iBeamSprite = PrecacheModel("sprites/laserbeam.vmt", true); g_iHaloSprite = PrecacheModel("sprites/halo.vmt", true); - InitialiseWeaponCounts(); + InitializeWeaponCounts(); for (int i = 1; i <= MaxClients; i++) { - if (IsClientConnected(i)) - Client_ResetClientSettings(i); + if (!IsClientInGame(i)) + continue; + Client_ResetClientSettings(i); + g_bInfoMessage[i] = false; + g_bWelcomeMessage[i] = false; } if (LoadMapConfig()) { @@ -373,7 +422,7 @@ public void OnMapStart() } else if (!g_cvDM_spawn_default.BoolValue) State_SetSpawnPoints(); - + State_Update(); } @@ -393,6 +442,12 @@ public void OnClientPostAdminCheck(int client) public void OnClientDisconnect(int client) { + if (!IsFakeClient(client)) + { + DecrementWeaponCount(g_sPrimaryWeapon[client]); + DecrementWeaponCount(g_sSecondaryWeapon[client]); + } + SDKUnhook(client, SDKHook_TraceAttack, Hook_OnTraceAttack); SDKUnhook(client, SDKHook_OnTakeDamage, Hook_OnTakeDamage); SDKUnhook(client, SDKHook_WeaponEquip, Hook_OnWeaponEquip); @@ -402,35 +457,60 @@ public void OnClientDisconnect(int client) public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) { static char menuTriggers[][] = {"gun", "!gun", "/gun", "guns", "!guns", "/guns", "menu", "!menu", "/menu", "weapon", "!weapon", "/weapon", "weapons", "!weapons", "/weapons"}; - static char hsOnlyTriggers[][] = {"hs", "!hs", "/hs", "headshot", "!headshot", "/headshot"}; + static char settingsTriggers[][] = {"settings", "!settings", "/settings"}; + static char headshotTriggers[][] = {"hs", "!hs", "/hs", "headshot", "!headshot", "/headshot"}; + static char resetTriggers[][] = {"reset", "!reset", "/reset"}; - if (g_cvDM_enabled.BoolValue && client && IsClientInGame(client) && (GetClientTeam(client) > CS_TEAM_SPECTATOR)) + if (g_cvDM_enabled.BoolValue && IsValidClient(client, false) && GetClientTeam(client) > CS_TEAM_SPECTATOR) { - if (StrEqual(sArgs, "settings", false)) - { - ShowCookieMenu(client); - return Plugin_Stop; - } for (int i = 0; i < sizeof(menuTriggers); i++) { - if (StrEqual(sArgs, menuTriggers[i], false)) + if (strcmp(sArgs, menuTriggers[i], false) == 0) { if (g_cvDM_gun_menu_mode.IntValue == 1 || g_cvDM_gun_menu_mode.IntValue == 2 || g_cvDM_gun_menu_mode.IntValue == 3) BuildWeaponsMenu(client); else - CPrintToChat(client, "%t %t", "Chat Tag", "Guns Disabled"); + CPrintToChat(client, "%t %t", "Chat Tag", "Guns Menu Disabled"); + return Plugin_Stop; + } + } + + for (int i = 0; i < sizeof(settingsTriggers); i++) + { + if (strcmp(sArgs, settingsTriggers[i], false) == 0) + { + ShowCookieMenu(client); return Plugin_Stop; } } - if (g_cvDM_headshot_only_allow_client.BoolValue) + + for (int i = 0; i < sizeof(headshotTriggers); i++) { - for (int i = 0; i < sizeof(hsOnlyTriggers); i++) + if (strcmp(sArgs, headshotTriggers[i], false) == 0) { - if (StrEqual(sArgs, hsOnlyTriggers[i], false)) + if (g_cvDM_headshot_only_allow_client.BoolValue) { Client_ToggleHSOnly(client); return Plugin_Stop; } + else + CPrintToChat(client, "%t %t", "Chat Tag", "Headshot Only Disabled"); + + } + } + + for (int i = 0; i < sizeof(resetTriggers); i++) + { + if (strcmp(sArgs, resetTriggers[i], false) == 0) + { + if (g_cvDM_reset_score.BoolValue && CheckCommandAccess(client, "dm_access_reset", ADMFLAG_RESERVATION)) + { + Client_ResetScoreboard(client); + return Plugin_Stop; + } + else + CPrintToChat(client, "%t %t", "Chat Tag", "Reset Score Disabled"); + } } } @@ -439,104 +519,172 @@ public Action OnClientSayCommand(int client, const char[] command, const char[] public void OnClientCookiesCached(int client) { - char cPrimary[24]; - char cSecondary[24]; - char cRemember[24]; - char cFirst[24]; - char cDPanel[24]; - char cDPopup[24]; - char cDText[24]; - char cKillFeed[24]; - char cHSOnly[24]; - - GetClientCookie(client, g_hWeapon_Primary_Cookie, cPrimary, sizeof(cPrimary)); - GetClientCookie(client, g_hWeapon_Secondary_Cookie, cSecondary, sizeof(cSecondary)); - GetClientCookie(client, g_hWeapon_Remember_Cookie, cRemember, sizeof(cRemember)); - GetClientCookie(client, g_hWeapon_First_Cookie, cFirst, sizeof(cFirst)); - GetClientCookie(client, g_hDamage_Panel_Cookie, cDPanel, sizeof(cDPanel)); - GetClientCookie(client, g_hDamage_Popup_Cookie, cDPopup, sizeof(cDPopup)); - GetClientCookie(client, g_hDamage_Text_Cookie, cDText, sizeof(cDText)); - GetClientCookie(client, g_hKillFeed_Cookie, cKillFeed, sizeof(cKillFeed)); - GetClientCookie(client, g_hHSOnly_Cookie, cHSOnly, sizeof(cHSOnly)); - - if (!StrEqual(cPrimary, "")) - { - g_cPrimaryWeapon[client] = cPrimary; - } - else + if (!IsFakeClient(client)) { - g_cPrimaryWeapon[client] = "none"; - SetClientCookie(client, g_hWeapon_Primary_Cookie, "none"); - } + char sBuffer[24]; + char sPrimary[32]; + char sSecondary[32]; + char sRemember[24]; + char sDPanel[24]; + char sDPopup[24]; + char sDText[24]; + char sKillFeed[24]; + char sHSOnly[24]; + char sSoundDeath[24]; + char sSoundGunShots[24]; + char sSoundBodyShots[24]; + char sSoundHSShots[24]; + char sBellKill[24]; + char sBellHit[24]; + char sBellHeadshot[24]; + + GetClientCookie(client, g_hWeapon_Primary_Cookie, sPrimary, sizeof(sPrimary)); + GetClientCookie(client, g_hWeapon_Secondary_Cookie, sSecondary, sizeof(sSecondary)); + GetClientCookie(client, g_hWeapon_Remember_Cookie, sRemember, sizeof(sRemember)); + GetClientCookie(client, g_hDamage_Panel_Cookie, sDPanel, sizeof(sDPanel)); + GetClientCookie(client, g_hDamage_Popup_Cookie, sDPopup, sizeof(sDPopup)); + GetClientCookie(client, g_hDamage_Text_Cookie, sDText, sizeof(sDText)); + GetClientCookie(client, g_hKillFeed_Cookie, sKillFeed, sizeof(sKillFeed)); + GetClientCookie(client, g_hSoundDeath_Cookie, sSoundDeath, sizeof(sSoundDeath)); + GetClientCookie(client, g_hSoundGunShots_Cookie, sSoundGunShots, sizeof(sSoundGunShots)); + GetClientCookie(client, g_hSoundBodyShots_Cookie, sSoundBodyShots, sizeof(sSoundBodyShots)); + GetClientCookie(client, g_hSoundHSShots_Cookie, sSoundHSShots, sizeof(sSoundHSShots)); + GetClientCookie(client, g_hHSOnly_Cookie, sHSOnly, sizeof(sHSOnly)); + GetClientCookie(client, g_hBellHit_Cookie, sBellHit, sizeof(sBellHit)); + GetClientCookie(client, g_hBellKill_Cookie, sBellKill, sizeof(sBellKill)); + GetClientCookie(client, g_hBellHeadshot_Cookie, sBellHeadshot, sizeof(sBellHeadshot)); + + if (strcmp(sPrimary, "") == 0) + { + g_sPrimaryWeapon[client] = "none"; + SetClientCookie(client, g_hWeapon_Primary_Cookie, "none"); + } + else + g_sPrimaryWeapon[client] = sPrimary; - if (!StrEqual(cSecondary, "")) - { - g_cSecondaryWeapon[client] = cSecondary; - } - else - { - g_cSecondaryWeapon[client] = "none"; - SetClientCookie(client, g_hWeapon_Secondary_Cookie, "none"); - } + if (strcmp(sSecondary, "") == 0) + { + g_sSecondaryWeapon[client] = "none"; + SetClientCookie(client, g_hWeapon_Secondary_Cookie, "none"); + } + else + g_sSecondaryWeapon[client] = sSecondary; - if (!StrEqual(cRemember, "")) - { - g_bRememberChoice[client] = view_as(StringToInt(cRemember)); - } - else - { - g_bRememberChoice[client] = false; - SetClientCookie(client, g_hWeapon_Remember_Cookie, "0"); - } + if (strcmp(sRemember, "") == 0) + { + g_bRememberChoice[client] = false; + SetClientCookie(client, g_hWeapon_Remember_Cookie, "0"); + } + else + g_bRememberChoice[client] = view_as(StringToInt(sRemember)); - if (!StrEqual(cDPanel, "")) - { - g_bDamagePanel[client] = view_as(StringToInt(cDPanel)); - } - else - { - g_bDamagePanel[client] = true; - SetClientCookie(client, g_hDamage_Panel_Cookie, "1"); - } + if (strcmp(sDPanel, "") == 0) + { + g_bDamagePanel[client] = g_cvDM_cookie_damage_panel.BoolValue; + IntToString(g_cvDM_cookie_damage_panel.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hDamage_Panel_Cookie, sBuffer); + } + else + g_bDamagePanel[client] = view_as(StringToInt(sDPanel)); - if (!StrEqual(cDPopup, "")) - { - g_bDamagePopup[client] = view_as(StringToInt(cDPopup)); - } - else - { - g_bDamagePopup[client] = true; - SetClientCookie(client, g_hDamage_Popup_Cookie, "1"); - } + if (strcmp(sDPopup, "") == 0) + { + g_bDamagePopup[client] = g_cvDM_cookie_damage_popup.BoolValue; + IntToString(g_cvDM_cookie_damage_popup.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hDamage_Popup_Cookie, sBuffer); + } + else + g_bDamagePopup[client] = view_as(StringToInt(sDPopup)); - if (!StrEqual(cDText, "")) - { - g_bDamageText[client] = view_as(StringToInt(cDText)); - } - else - { - g_bDamageText[client] = true; - SetClientCookie(client, g_hDamage_Text_Cookie, "1"); - } + if (strcmp(sDText, "") == 0) + { + g_bDamageText[client] = g_cvDM_cookie_damage_text.BoolValue; + IntToString(g_cvDM_cookie_damage_text.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hDamage_Text_Cookie, sBuffer); + } + else + g_bDamageText[client] = view_as(StringToInt(sDText)); - if (!StrEqual(cKillFeed, "")) - { - g_bKillFeed[client] = view_as(StringToInt(cKillFeed)); - } - else - { - g_bKillFeed[client] = true; - SetClientCookie(client, g_hKillFeed_Cookie, "1"); - } + if (strcmp(sKillFeed, "") == 0) + { + g_bKillFeed[client] = g_cvDM_cookie_killfeed.BoolValue; + IntToString(g_cvDM_cookie_killfeed.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hKillFeed_Cookie, sBuffer); + } + else + g_bKillFeed[client] = view_as(StringToInt(sKillFeed)); - if (!StrEqual(cHSOnly, "")) - { - g_bHSOnlyClient[client] = view_as(StringToInt(cHSOnly)); - } - else - { - g_bHSOnlyClient[client] = false; - SetClientCookie(client, g_hHSOnly_Cookie, "0"); + if (strcmp(sSoundDeath, "") == 0) + { + g_bSoundDeaths[client] = g_cvDM_cookie_sounds_death.BoolValue; + IntToString(g_cvDM_cookie_sounds_death.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundDeath_Cookie, sBuffer); + } + else + g_bSoundDeaths[client] = view_as(StringToInt(sSoundDeath)); + + if (strcmp(sSoundGunShots, "") == 0) + { + g_bSoundGunShots[client] = g_cvDM_cookie_sounds_gunshots.BoolValue; + IntToString(g_cvDM_cookie_sounds_gunshots.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundGunShots_Cookie, sBuffer); + } + else + g_bSoundGunShots[client] = view_as(StringToInt(sSoundGunShots)); + + if (strcmp(sSoundBodyShots, "") == 0) + { + g_bSoundBodyShots[client] = g_cvDM_cookie_sounds_bodyshots.BoolValue; + IntToString(g_cvDM_cookie_sounds_bodyshots.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundBodyShots_Cookie, sBuffer); + } + else + g_bSoundBodyShots[client] = view_as(StringToInt(sSoundBodyShots)); + + if (strcmp(sSoundHSShots, "") == 0) + { + g_bSoundHSShots[client] = g_cvDM_cookie_sounds_headshots.BoolValue; + IntToString(g_cvDM_cookie_sounds_headshots.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundHSShots_Cookie, sBuffer); + } + else + g_bSoundHSShots[client] = view_as(StringToInt(sSoundHSShots)); + + if (strcmp(sHSOnly, "") == 0) + { + g_bHSOnlyClient[client] = g_cvDM_cookie_headshot_only.BoolValue; + IntToString(g_cvDM_cookie_headshot_only.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hHSOnly_Cookie, sBuffer); + } + else + g_bHSOnlyClient[client] = view_as(StringToInt(sHSOnly)); + + if (strcmp(sBellHit, "") == 0) + { + g_bBellHit[client] = g_cvDM_cookie_bell_hit.BoolValue; + IntToString(g_cvDM_cookie_bell_hit.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hBellHit_Cookie, sBuffer); + } + else + g_bBellHit[client] = view_as(StringToInt(sBellHit)); + + if (strcmp(sBellKill, "") == 0) + { + g_bBellKill[client] = g_cvDM_cookie_bell_kill.BoolValue; + IntToString(g_cvDM_cookie_bell_kill.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hBellKill_Cookie, sBuffer); + } + else + g_bBellKill[client] = view_as(StringToInt(sBellKill)); + + if (strcmp(sBellHeadshot, "") == 0) + { + g_bBellHeadshot[client] = g_cvDM_cookie_bell_headshot.BoolValue; + IntToString(g_cvDM_cookie_bell_headshot.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hBellHeadshot_Cookie, sBuffer); + } + else + g_bBellHeadshot[client] = view_as(StringToInt(sBellHeadshot)); } } diff --git a/scripting/deathmatch/commands.sp b/scripting/deathmatch/commands.sp index 21f36ce..59c9b43 100644 --- a/scripting/deathmatch/commands.sp +++ b/scripting/deathmatch/commands.sp @@ -4,10 +4,12 @@ void LoadCommands() RegAdminCmd("dm_load", Command_ConfigLoad, ADMFLAG_CHANGEMAP, "Loads the configuration file specified (configs/deathmatch/filename.ini)."); RegAdminCmd("dm_load_menu", Command_ConfigLoadMenu, ADMFLAG_CHANGEMAP, "Opens the Config Loader Menu."); RegAdminCmd("dm_spawn_menu", Command_SpawnMenu, ADMFLAG_CHANGEMAP, "Opens the Spawn Editor Menu."); + RegAdminCmd("dm_spawn_list", Command_SpawnList, ADMFLAG_CHANGEMAP, "Displays the entire spawn list for the map."); + RegAdminCmd("dm_spawn_stats", Command_SpawnStats, ADMFLAG_CHANGEMAP, "Displays spawn statistics."); + RegAdminCmd("dm_spawn_reset", Command_SpawnReset, ADMFLAG_CHANGEMAP, "Resets spawn statistics."); RegAdminCmd("dm_respawn_all", Command_RespawnAll, ADMFLAG_CHANGEMAP, "Respawns all players."); RegAdminCmd("dm_settings", Command_SettingsMenu, ADMFLAG_CHANGEMAP, "Opens the Deathmatch Settings Menu."); - RegAdminCmd("dm_stats", Command_Stats, ADMFLAG_CHANGEMAP, "Displays spawn statistics."); - RegAdminCmd("dm_stats_reset", Command_StatsReset, ADMFLAG_CHANGEMAP, "Resets spawn statistics."); + RegAdminCmd("dm_weapon_stats", Command_WeaponStats, ADMFLAG_CHANGEMAP, "Displays weapon statistics."); } public Action Command_ConfigLoad(int client, int args) @@ -28,11 +30,11 @@ public Action Command_ConfigLoad(int client, int args) StripQuotes(config); StripQuotes(option); - if (StrEqual(option, "respawn", false)) + if (strcmp(option, "respawn", false) == 0) LoadTimeConfig(client, config, option); - else if (StrEqual(option, "restart", false)) + else if (strcmp(option, "restart", false) == 0) LoadTimeConfig(client, config, option); - else if (StrEqual(option, "nextround", false)) + else if (strcmp(option, "nextround", false) == 0) LoadTimeConfig(client, config, option); else { @@ -67,17 +69,22 @@ public Action Command_SpawnMenu(int client, int args) return Plugin_Handled; } +public Action Command_SpawnList(int client, int args) +{ + for (int i = 0; i < g_iSpawnPointCount; i++) + { + PrintToServer("#%i | Location = %f %f %f | Direction = %f %f %f | Occupied = %s", i, g_fSpawnPositions[i][0], g_fSpawnPositions[i][1], g_fSpawnPositions[i][2], g_fSpawnAngles[i][0], g_fSpawnAngles[i][1], g_fSpawnAngles[i][2], g_bSpawnPointOccupied[i] ? "TRUE" : "FALSE"); + } +} + public Action Command_RespawnAll(int client, int args) { if (client == 0) - { - RespawnAll(); CReplyToCommand(client, "%t %t", "Chat Tag", "All Player Respawn"); - return Plugin_Handled; - } + else + CPrintToChat(client, "%t %t", "Chat Tag", "All Player Respawn"); - RespawnAll(); - CPrintToChat(client, "%t %t", "Chat Tag", "All Player Respawn"); + Spawns_RespawnAll(); return Plugin_Handled; } @@ -93,8 +100,7 @@ public Action Command_SettingsMenu(int client, int args) return Plugin_Handled; } - -public Action Command_Stats(int client, int args) +public Action Command_SpawnStats(int client, int args) { if (client == 0) { @@ -106,16 +112,29 @@ public Action Command_Stats(int client, int args) return Plugin_Handled; } -public Action Command_StatsReset(int client, int args) +public Action Command_SpawnReset(int client, int args) { if (client == 0) { - ResetSpawnStats(); + Spawns_ResetSpawnStats(); CReplyToCommand(client, "%t %t", "Chat Tag", "Spawn Stats Reset"); return Plugin_Handled; } - ResetSpawnStats(); + Spawns_ResetSpawnStats(); CPrintToChat(client, "%t %t", "Chat Tag", "Spawn Stats Reset"); return Plugin_Handled; +} + +public Action Command_WeaponStats(int client, int args) +{ + + if (client == 0) + { + DisplayWeaponStats(client, true); + return Plugin_Handled; + } + + DisplayWeaponStats(client, false); + return Plugin_Handled; } \ No newline at end of file diff --git a/scripting/deathmatch/configs.sp b/scripting/deathmatch/configs.sp index 4d2c362..845d239 100644 --- a/scripting/deathmatch/configs.sp +++ b/scripting/deathmatch/configs.sp @@ -5,32 +5,41 @@ void LoadConfigArray() void LoadTimeConfig(int client, char[] config, char[] option) { - if (StrEqual(option, "respawn", false)) + if (strcmp(option, "respawn", false) == 0) { if (LoadConfig(config)) - RespawnAll(); + { + State_ResetDM(); + Spawns_RespawnAll(); + } else CReplyToCommand(client, "%t The configuration file: %s could not be read.", "Chat Tag", config); } - else if (StrEqual(option, "restart", false)) + else if (strcmp(option, "restart", false) == 0) { if (LoadConfig(config)) + { + State_ResetDM(); ServerCommand("mp_restartgame 1"); + } else CReplyToCommand(client, "%t The configuration file: %s could not be read.", "Chat Tag", config); } - else if (StrEqual(option, "nextround", false)) + else if (strcmp(option, "nextround", false) == 0) { g_bLoadConfig = true; - strcopy(g_cLoadConfig, sizeof(g_cLoadConfig), config); + strcopy(g_sLoadConfig, sizeof(g_sLoadConfig), config); } } -bool LoadConfig(char[] config) +public bool LoadConfig(char[] config) { KeyValues kv = new KeyValues("Deathmatch Config"); char path[PLATFORM_MAX_PATH]; char buffer[PLATFORM_MAX_PATH]; + char key[25]; + char value[25]; + Format(buffer, sizeof(buffer), "configs/deathmatch/%s", config); BuildPath(Path_SM, path, sizeof(path), buffer); @@ -47,9 +56,6 @@ bool LoadConfig(char[] config) return false; } - char key[25]; - char value[25]; - kv.GetString("dm_config_name", value, sizeof(value), "Default"); g_cvDM_config_name.SetString(value); @@ -63,104 +69,179 @@ bool LoadConfig(char[] config) } kv.GetString("dm_enabled", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_enabled.SetString(value); kv.GetString("dm_enable_valve_deathmatch", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_enable_valve_deathmatch.SetString(value); kv.GetString("dm_welcomemsg", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_welcomemsg.SetString(value); + kv.GetString("dm_infomsg", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_infomsg.SetString(value); + kv.GetString("dm_free_for_all", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_free_for_all.SetString(value); kv.GetString("dm_hide_radar", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_hide_radar.SetString(value); + kv.GetString("dm_reset_score", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_reset_score.SetString(value); + kv.GetString("dm_display_killfeed", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_display_killfeed.SetString(value); kv.GetString("dm_display_killfeed_player", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_display_killfeed_player.SetString(value); + kv.GetString("dm_display_killfeed_player_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_display_killfeed_player_allow_client.SetString(value); + kv.GetString("dm_display_damage_panel", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_display_damage_panel.SetString(value); + kv.GetString("dm_display_damage_panel_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_display_damage_panel_allow_client.SetString(value); + kv.GetString("dm_display_damage_popup", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_display_damage_popup.SetString(value); + kv.GetString("dm_display_damage_popup_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_display_damage_popup_allow_client.SetString(value); + kv.GetString("dm_display_damage_text", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_display_damage_text.SetString(value); - kv.GetString("dm_sounds_bodyshots", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + kv.GetString("dm_display_damage_text_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_display_damage_text_allow_client.SetString(value); + + kv.GetString("dm_sounds_bell_hit", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bell_hit.SetString(value); + + kv.GetString("dm_sounds_bell_hit_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bell_hit_allow_client.SetString(value); + + kv.GetString("dm_sounds_bell_kill", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bell_kill.SetString(value); + + kv.GetString("dm_sounds_bell_kill_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bell_kill_allow_client.SetString(value); + + kv.GetString("dm_sounds_bell_headshot", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bell_headshot.SetString(value); + + kv.GetString("dm_sounds_bell_headshot_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bell_headshot_allow_client.SetString(value); + + kv.GetString("dm_sounds_deaths", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_deaths.SetString(value); + + kv.GetString("dm_sounds_deaths_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_deaths_allow_client.SetString(value); + + kv.GetString("dm_sounds_bodyshots", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_sounds_bodyshots.SetString(value); - kv.GetString("dm_sounds_headshots", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + kv.GetString("dm_sounds_bodyshots_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_bodyshots_allow_client.SetString(value) + + kv.GetString("dm_sounds_headshots", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_sounds_headshots.SetString(value); + kv.GetString("dm_sounds_headshots_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_headshots_allow_client.SetString(value); + + kv.GetString("dm_sounds_gunshots", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_gunshots.SetString(value); + + kv.GetString("dm_sounds_gunshots_allow_client", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_sounds_gunshots_allow_client.SetString(value); + + kv.GetString("dm_sounds_gunshots_distance", value, sizeof(value), "1200.0"); + g_cvDM_sounds_gunshots_distance.SetString(value); + kv.GetString("dm_headshot_only", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_headshot_only.SetString(value); kv.GetString("dm_headshot_only_allow_client", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_headshot_only_allow_client.SetString(value); kv.GetString("dm_headshot_only_allow_world", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_headshot_only_allow_world.SetString(value); kv.GetString("dm_headshot_only_allow_knife", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_headshot_only_allow_knife.SetString(value); kv.GetString("dm_headshot_only_allow_taser", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_headshot_only_allow_taser.SetString(value); kv.GetString("dm_headshot_only_allow_nade", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_headshot_only_allow_nade.SetString(value); kv.GetString("dm_remove_objectives", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_objectives.SetString(value); kv.GetString("dm_respawn", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_respawn.SetString(value); kv.GetString("dm_respawn_time", value, sizeof(value), "2.0"); g_cvDM_respawn_time.SetString(value); kv.GetString("dm_respawn_valve", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_respawn_valve.SetString(value); kv.GetString("dm_spawn_default", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_spawn_default.SetString(value); kv.GetString("dm_spawn_los", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_spawn_los.SetString(value); kv.GetString("dm_spawn_los_attempts", value, sizeof(value), "10"); g_cvDM_spawn_los_attempts.SetString(value); - kv.GetString("dm_spawn_distance", value, sizeof(value), "0.0"); + kv.GetString("dm_spawn_distance", value, sizeof(value), "100000.0"); g_cvDM_spawn_distance.SetString(value); kv.GetString("dm_spawn_distance_attempts", value, sizeof(value), "10"); @@ -170,82 +251,86 @@ bool LoadConfig(char[] config) g_cvDM_spawn_protection_time.SetString(value); kv.GetString("dm_remove_blood_player", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_blood_player.SetString(value); kv.GetString("dm_remove_blood_walls", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_blood_walls.SetString(value); kv.GetString("dm_remove_cash", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_cash.SetString(value); kv.GetString("dm_remove_chickens", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_chickens.SetString(value); kv.GetString("dm_remove_ragdoll", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_ragdoll.SetString(value); kv.GetString("dm_remove_ragdoll_time", value, sizeof(value), "1.0"); g_cvDM_remove_ragdoll_time.SetString(value); kv.GetString("dm_remove_knife_damage", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_knife_damage.SetString(value); kv.GetString("dm_remove_spawn_weapons", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_spawn_weapons.SetString(value); kv.GetString("dm_remove_ground_weapons", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_ground_weapons.SetString(value); kv.GetString("dm_remove_dropped_weapons", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_remove_dropped_weapons.SetString(value); kv.GetString("dm_replenish_ammo_empty", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_replenish_ammo_empty.SetString(value); kv.GetString("dm_replenish_ammo_reload", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_replenish_ammo_reload.SetString(value); kv.GetString("dm_replenish_ammo_kill", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_replenish_ammo_kill.SetString(value); kv.GetString("dm_replenish_ammo_type", value, sizeof(value), "2"); g_cvDM_replenish_ammo_type.SetString(value); kv.GetString("dm_replenish_ammo_hs_kill", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_replenish_ammo_hs_kill.SetString(value); kv.GetString("dm_replenish_ammo_hs_type", value, sizeof(value), "1"); g_cvDM_replenish_ammo_hs_type.SetString(value); kv.GetString("dm_replenish_grenade", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_replenish_grenade.SetString(value); kv.GetString("dm_replenish_grenade_kill", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_replenish_grenade_kill.SetString(value); kv.GetString("dm_nade_messages", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_nade_messages.SetString(value); kv.GetString("dm_cash_messages", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_cash_messages.SetString(value); + kv.GetString("dm_hp_enable", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_hp_enable.SetString(value); + kv.GetString("dm_hp_start", value, sizeof(value), "100"); g_cvDM_hp_start.SetString(value); @@ -265,9 +350,13 @@ bool LoadConfig(char[] config) g_cvDM_hp_nade.SetString(value); kv.GetString("dm_hp_messages", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_hp_messages.SetString(value); + kv.GetString("dm_ap_enable", value, sizeof(value), "yes"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_ap_enable.SetString(value); + kv.GetString("dm_ap_max", value, sizeof(value), "100"); g_cvDM_ap_max.SetString(value); @@ -284,15 +373,72 @@ bool LoadConfig(char[] config) g_cvDM_ap_nade.SetString(value); kv.GetString("dm_ap_messages", value, sizeof(value), "yes"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_ap_messages.SetString(value); kv.GoBack(); + if (!kv.JumpToKey("Preferences")) + { + LogError("[DM] The configuration file: %s has the following error:", path); + LogError("[DM] The configuration file is corrupt \"Preferences\" section could not be found)."); + return false; + } + + kv.GetString("dm_cookie_damage_panel", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_damage_panel.SetString(value); + + kv.GetString("dm_cookie_damage_popup", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_damage_popup.SetString(value); + + kv.GetString("dm_cookie_damage_text", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_damage_text.SetString(value); + + kv.GetString("dm_cookie_killfeed", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_killfeed.SetString(value); + + kv.GetString("dm_cookie_sounds_death", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_sounds_death.SetString(value); + + kv.GetString("dm_cookie_sounds_gunshots", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_sounds_gunshots.SetString(value); + + kv.GetString("dm_cookie_sounds_bodyshots", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_sounds_bodyshots.SetString(value); + + kv.GetString("dm_cookie_sounds_headshots", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_sounds_headshots.SetString(value); + + kv.GetString("dm_cookie_headshot_only", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_headshot_only.SetString(value); + + kv.GetString("dm_cookie_bell_hit", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_bell_hit.SetString(value); + + kv.GetString("dm_cookie_bell_kill", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_bell_kill.SetString(value); + + kv.GetString("dm_cookie_bell_headshot", value, sizeof(value), "no"); + value = (strcmp(value, "yes") == 0) ? "1" : "0"; + g_cvDM_cookie_bell_headshot.SetString(value); + + kv.GoBack(); + if (!kv.JumpToKey("Equipment")) { LogError("[DM] The configuration file: %s has the following error:", path); - LogError("[DM] The configuration file is corrupt \"Weapons\" section could not be found)."); + LogError("[DM] The configuration file is corrupt \"Equipment\" section could not be found)."); return false; } @@ -310,7 +456,7 @@ bool LoadConfig(char[] config) g_cvDM_loadout_style.SetString(value); kv.GetString("dm_fast_equip", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_fast_equip.SetString(value); kv.GoBack(); @@ -333,8 +479,6 @@ bool LoadConfig(char[] config) g_aPrimaryWeaponsAvailable.PushString(key); g_smWeaponLimits.SetValue(key, limit); } while (kv.GotoNextKey(false)); - g_aPrimaryWeaponsAvailable.PushString("random"); - g_smWeaponLimits.SetValue("random", -1); } kv.GoBack(); @@ -357,8 +501,6 @@ bool LoadConfig(char[] config) g_aSecondaryWeaponsAvailable.PushString(key); g_smWeaponLimits.SetValue(key, limit); } while (kv.GotoNextKey(false)); - g_aSecondaryWeaponsAvailable.PushString("random"); - g_smWeaponLimits.SetValue("random", -1); } kv.GoBack(); @@ -372,23 +514,23 @@ bool LoadConfig(char[] config) } kv.GetString("dm_zeus", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_zeus.SetString(value); kv.GetString("dm_zeus_spawn", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_zeus_spawn.SetString(value); kv.GetString("dm_zeus_kill", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_zeus_kill.SetString(value); kv.GetString("dm_zeus_kill_taser", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_zeus_kill_taser.SetString(value); kv.GetString("dm_zeus_kill_knife", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_zeus_kill_knife.SetString(value); kv.GoBack(); @@ -431,7 +573,7 @@ bool LoadConfig(char[] config) } kv.GetString("dm_healthshot", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_healthshot.SetString(value); kv.GetString("dm_healthshot_health", value, sizeof(value), "50"); @@ -441,15 +583,15 @@ bool LoadConfig(char[] config) g_cvDM_healthshot_total.SetString(value); kv.GetString("dm_healthshot_spawn", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_healthshot_spawn.SetString(value); kv.GetString("dm_healthshot_kill", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_healthshot_kill.SetString(value); kv.GetString("dm_healthshot_kill_knife", value, sizeof(value), "no"); - value = (StrEqual(value, "yes")) ? "1" : "0"; + value = (strcmp(value, "yes") == 0) ? "1" : "0"; g_cvDM_healthshot_kill_knife.SetString(value); kv.GoBack(); @@ -479,24 +621,24 @@ bool LoadConfig(char[] config) kv.GetSectionName(key, sizeof(key)); kv.GetString(NULL_STRING, value, sizeof(value), ""); int team = 0; - if (StrEqual(value, "CT", false)) + if (strcmp(value, "CT", false) == 0) team = CS_TEAM_CT; - else if (StrEqual(value, "T", false)) + else if (strcmp(value, "T", false) == 0) team = CS_TEAM_T; g_smWeaponSkinsTeam.SetValue(key, team); } while (kv.GotoNextKey(false)); kv.GoBack(); } - InitialiseWeaponCounts(); + InitializeWeaponCounts(); g_cvDM_config_name.GetString(buffer, sizeof(buffer)); - CPrintToChatAll("%t Successfully loaded {purple}%s", "Chat Tag", buffer); + CPrintToChatAll("%t Loaded {purple}%s{default} mode.", "Chat Tag", buffer); delete kv; return true; } -bool LoadConfigName(char[] config) +public bool LoadConfigName(char[] config) { KeyValues kv = new KeyValues("Deathmatch Config"); char path[PLATFORM_MAX_PATH]; @@ -519,14 +661,14 @@ bool LoadConfigName(char[] config) char value[25]; kv.GetString("dm_config_name", value, sizeof(value), "FAILURE"); - strcopy(g_cLoadConfigName, sizeof(g_cLoadConfigName), value); + strcopy(g_sLoadConfigName, sizeof(g_sLoadConfigName), value); delete kv; return true; } -bool LoadMapConfig() +public bool LoadMapConfig() { char path[PLATFORM_MAX_PATH]; char workshopID[PLATFORM_MAX_PATH]; @@ -535,39 +677,20 @@ bool LoadMapConfig() GetCurrentMap(map, PLATFORM_MAX_PATH); BuildPath(Path_SM, path, sizeof(path), "configs/deathmatch/spawns"); - - if (!DirExists(path)) - { - if (!CreateDirectory(path, 511)) - { - LogError("[DM] Failed to create directory %s", path); - return false; - } - } + if (!CheckDirectory(path)) + return false; BuildPath(Path_SM, path, sizeof(path), "configs/deathmatch/spawns/workshop"); - - if (!DirExists(path)) - { - if (!CreateDirectory(path, 511)) - { - LogError("[DM] Failed to create directory %s", path); - return false; - } - } + if (!CheckDirectory(path)) + return false; if (StrContains(map, "workshop", false) != -1) { GetCurrentWorkshopMap(workshop, PLATFORM_MAX_PATH, workshopID, sizeof(workshopID) - 1); BuildPath(Path_SM, path, sizeof(path), "configs/deathmatch/spawns/workshop/%s", workshopID); - if (!DirExists(path)) - { - if (!CreateDirectory(path, 511)) - { - LogError("[DM] Failed to create directory %s", path); - return false; - } - } + if (!CheckDirectory(path)) + return false; + BuildPath(Path_SM, path, sizeof(path), "configs/deathmatch/spawns/workshop/%s/%s.txt", workshopID, workshop); } else @@ -608,8 +731,12 @@ bool LoadMapConfig() g_fSpawnAngles[g_iSpawnPointCount][0] = StringToFloat(parts[3]); g_fSpawnAngles[g_iSpawnPointCount][1] = StringToFloat(parts[4]); g_fSpawnAngles[g_iSpawnPointCount][2] = StringToFloat(parts[5]); + PrintToServer("#%i | Location = %f %f %f | Direction = %f %f %f", g_iSpawnPointCount, g_fSpawnPositions[g_iSpawnPointCount][0], g_fSpawnPositions[g_iSpawnPointCount][1], g_fSpawnPositions[g_iSpawnPointCount][2], g_fSpawnAngles[g_iSpawnPointCount][0], g_fSpawnAngles[g_iSpawnPointCount][1], g_fSpawnAngles[g_iSpawnPointCount][2]); g_iSpawnPointCount++; } + PrintToServer("******************************************************"); + PrintToServer("Total Spawn Count = %i", g_iSpawnPointCount); + PrintToServer("******************************************************"); } else { @@ -627,7 +754,7 @@ bool LoadMapConfig() return true; } -bool WriteMapConfig() +public bool WriteMapConfig() { char map[64]; GetCurrentMap(map, sizeof(map)); @@ -691,4 +818,17 @@ void GetDeathmatchConfigs() } else LogError("[DM] Could not open dir \"%s\" for reading.", path); +} + +public bool CheckDirectory(char path[PLATFORM_MAX_PATH]) +{ + if (!DirExists(path)) + { + if (!CreateDirectory(path, 511)) + { + LogError("[DM] Failed to create directory %s", path); + return false; + } + } + return true; } \ No newline at end of file diff --git a/scripting/deathmatch/cookies.sp b/scripting/deathmatch/cookies.sp index b11f9fc..3145d52 100644 --- a/scripting/deathmatch/cookies.sp +++ b/scripting/deathmatch/cookies.sp @@ -3,11 +3,74 @@ typedef CookiemenuCallback = function void(int client, bool selection, char[] title); -void Cookiemenu_DisplayCallback(int client, bool selection, char[] title) {} - -void Cookiemenu_HSOnlyCallback(int client, bool selection, char[] title) +void Cookiemenu_DisplayCallback(int client, bool selection, char[] title) { - Client_SetHSOnly(client); + char buffer[64]; + + if (strcmp(title, "Deathmatch Damage Panel") == 0) + { + g_bDamagePanel[client] = selection; + Format(buffer, sizeof(buffer), "Damage Panel %s", g_bDamagePanel[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Damage Popup") == 0) + { + g_bDamagePopup[client] = selection; + Format(buffer, sizeof(buffer), "Damage Popup %s", g_bDamagePopup[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Damage Text") == 0) + { + g_bDamageText[client] = selection; + Format(buffer, sizeof(buffer), "Damage Text %s", g_bDamageText[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Filter Kill Feed") == 0) + { + g_bKillFeed[client] = selection; + Format(buffer, sizeof(buffer), "Filter Kill Feed %s", g_bKillFeed[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Filter Death Sounds") == 0) + { + g_bSoundDeaths[client] = selection; + Format(buffer, sizeof(buffer), "Filter Death Sounds %s", g_bSoundDeaths[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Filter Gun Shot Sounds") == 0) + { + g_bSoundGunShots[client] = selection; + Format(buffer, sizeof(buffer), "Filter Gun Shot Sounds %s", g_bSoundGunShots[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Filter Body Shot Sounds") == 0) + { + g_bSoundBodyShots[client] = selection; + Format(buffer, sizeof(buffer), "Filter Body Shot Sounds %s", g_bSoundBodyShots[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Filter Headshot Shot Sounds") == 0) + { + g_bSoundHSShots[client] = selection; + Format(buffer, sizeof(buffer), "Filter Headshot Shot Sounds %s", g_bSoundHSShots[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Headshot Only") == 0) + { + g_bHSOnlyClient[client] = selection; + Format(buffer, sizeof(buffer), "Headshot Only %s", g_bHSOnlyClient[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Bell Kill") == 0) + { + g_bBellKill[client] = selection; + Format(buffer, sizeof(buffer), "Bell Kill %s", g_bBellKill[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Bell Hit") == 0) + { + g_bBellHit[client] = selection; + Format(buffer, sizeof(buffer), "Bell Hit %s", g_bBellHit[client] ? "Enabled" : "Disabled"); + } + else if (strcmp(title, "Deathmatch Bell Headshot") == 0) + { + g_bBellHeadshot[client] = selection; + Format(buffer, sizeof(buffer), "Bell Headshot %s", g_bBellHeadshot[client] ? "Enabled" : "Disabled"); + } + + CPrintToChat(client, "%t %t", "Chat Tag", buffer); + + ShowCookieMenu(client); } public void SetCookieMenu(Handle cookie, CookieMenu type, const char[] display, CookiemenuCallback callback) @@ -26,19 +89,23 @@ public void SetCookieMenu(Handle cookie, CookieMenu type, const char[] display, } } -static void CookieHandler_YesNo(int client, CookieMenuAction action, any info, char[] buffer, int maxlen) +static void CookieHandler_YesNo(int client, CookieMenuAction action, DataPack pack, char[] buffer, int maxlen) { Menu menu = new Menu(MenuHandler_CookieMenu); - DataPack pack = view_as(info); - pack.Reset(); - char sTitle[64]; - pack.ReadCell(); + char sCookie[24]; + char sStatus[10]; + + pack.Reset(); + Handle cookie = view_as(pack.ReadCell()); pack.ReadFunction(); pack.ReadString(sTitle, sizeof(sTitle)); - menu.SetTitle(sTitle); + GetClientCookie(client, cookie, sCookie, sizeof(sCookie)); + sStatus = view_as(StringToInt(sCookie)) ? "Enabled" : "Disabled"; + + menu.SetTitle("%s [%s]", sTitle, sStatus); pack.Reset(); char sPack[64]; @@ -46,24 +113,27 @@ static void CookieHandler_YesNo(int client, CookieMenuAction action, any info, c menu.AddItem(sPack, "Yes"); menu.AddItem(sPack, "No"); - - menu.ExitButton = true; + menu.ExitBackButton = true; menu.Display(client, 10); } -static void CookieHandler_OnOff(int client, CookieMenuAction action, any info, char[] buffer, int maxlen) +static void CookieHandler_OnOff(int client, CookieMenuAction action, DataPack pack, char[] buffer, int maxlen) { Menu menu = new Menu(MenuHandler_CookieMenu); - DataPack pack = view_as(info); - pack.Reset(); - char sTitle[64]; - pack.ReadCell(); + char sCookie[24]; + char sStatus[10]; + + pack.Reset(); + Handle cookie = view_as(pack.ReadCell()); pack.ReadFunction(); pack.ReadString(sTitle, sizeof(sTitle)); - menu.SetTitle(sTitle); + GetClientCookie(client, cookie, sCookie, sizeof(sCookie)); + sStatus = view_as(StringToInt(sCookie)) ? "Enabled" : "Disabled"; + + menu.SetTitle("%s [%s]", sTitle, sStatus); pack.Reset(); char sPack[64]; @@ -71,7 +141,7 @@ static void CookieHandler_OnOff(int client, CookieMenuAction action, any info, c menu.AddItem(sPack, "On"); menu.AddItem(sPack, "Off"); - menu.ExitButton = true; + menu.ExitBackButton = true; menu.Display(client, 10); } @@ -84,9 +154,9 @@ static int MenuHandler_CookieMenu(Menu menu, MenuAction action, int param1, int DataPack pack = view_as(StringToInt(info)); pack.Reset(); pack.ReadCell(); - char sTitle[64]; + char title[64]; pack.ReadFunction(); - pack.ReadString(sTitle, sizeof(sTitle)); + pack.ReadString(title, sizeof(title)); pack.Reset(); Handle cookie = view_as(pack.ReadCell()); @@ -101,11 +171,155 @@ static int MenuHandler_CookieMenu(Menu menu, MenuAction action, int param1, int Call_StartFunction(null, pack.ReadFunction()); Call_PushCell(param1); Call_PushCell(view_as(!param2)); - Call_PushString(sTitle); + Call_PushString(title); int result; Call_Finish(result); } + if (action == MenuAction_Cancel && IsValidClient(param1, false)) + ShowCookieMenu(param1); + if (action == MenuAction_End) delete menu; +} + +void ClientCookiesRefresh(int client) +{ + if (!IsFakeClient(client)) + { + char sBuffer[24]; + char sDPanel[24]; + char sDPopup[24]; + char sDText[24]; + char sKillFeed[24]; + char sHSOnly[24]; + char sSoundDeath[24]; + char sSoundGunShots[24]; + char sSoundBodyShots[24]; + char sSoundHSShots[24]; + char sBellHit[24]; + char sBellKill[24]; + char sBellHeadshot[24]; + + GetClientCookie(client, g_hDamage_Panel_Cookie, sDPanel, sizeof(sDPanel)); + GetClientCookie(client, g_hDamage_Popup_Cookie, sDPopup, sizeof(sDPopup)); + GetClientCookie(client, g_hDamage_Text_Cookie, sDText, sizeof(sDText)); + GetClientCookie(client, g_hKillFeed_Cookie, sKillFeed, sizeof(sKillFeed)); + GetClientCookie(client, g_hSoundDeath_Cookie, sSoundDeath, sizeof(sSoundDeath)); + GetClientCookie(client, g_hSoundGunShots_Cookie, sSoundGunShots, sizeof(sSoundGunShots)); + GetClientCookie(client, g_hSoundBodyShots_Cookie, sSoundBodyShots, sizeof(sSoundBodyShots)); + GetClientCookie(client, g_hSoundHSShots_Cookie, sSoundHSShots, sizeof(sSoundHSShots)); + GetClientCookie(client, g_hHSOnly_Cookie, sHSOnly, sizeof(sHSOnly)); + GetClientCookie(client, g_hBellHit_Cookie, sBellKill, sizeof(sBellKill)); + GetClientCookie(client, g_hBellKill_Cookie, sBellHit, sizeof(sBellHit)); + GetClientCookie(client, g_hBellHeadshot_Cookie, sBellHeadshot, sizeof(sBellHeadshot)); + + if (strcmp(sDPanel, "") == 0) + { + g_bDamagePanel[client] = g_cvDM_cookie_damage_panel.BoolValue; + IntToString(g_cvDM_cookie_damage_panel.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hDamage_Panel_Cookie, sBuffer); + } + else + g_bDamagePanel[client] = view_as(StringToInt(sDPanel)); + + if (strcmp(sDPopup, "") == 0) + { + g_bDamagePopup[client] = g_cvDM_cookie_damage_popup.BoolValue; + IntToString(g_cvDM_cookie_damage_popup.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hDamage_Popup_Cookie, sBuffer); + } + else + g_bDamagePopup[client] = view_as(StringToInt(sDPopup)); + + if (strcmp(sDText, "") == 0) + { + g_bDamageText[client] = g_cvDM_cookie_damage_text.BoolValue; + IntToString(g_cvDM_cookie_damage_text.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hDamage_Text_Cookie, sBuffer); + } + else + g_bDamageText[client] = view_as(StringToInt(sDText)); + + if (strcmp(sKillFeed, "") == 0) + { + g_bKillFeed[client] = g_cvDM_cookie_killfeed.BoolValue; + IntToString(g_cvDM_cookie_killfeed.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hKillFeed_Cookie, sBuffer); + } + else + g_bKillFeed[client] = view_as(StringToInt(sKillFeed)); + + if (strcmp(sSoundDeath, "") == 0) + { + g_bSoundDeaths[client] = g_cvDM_cookie_sounds_death.BoolValue; + IntToString(g_cvDM_cookie_sounds_death.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundDeath_Cookie, sBuffer); + } + else + g_bSoundDeaths[client] = view_as(StringToInt(sSoundDeath)); + + if (strcmp(sSoundGunShots, "") == 0) + { + g_bSoundGunShots[client] = g_cvDM_cookie_sounds_gunshots.BoolValue; + IntToString(g_cvDM_cookie_sounds_gunshots.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundGunShots_Cookie, sBuffer); + } + else + g_bSoundGunShots[client] = view_as(StringToInt(sSoundGunShots)); + + if (strcmp(sSoundBodyShots, "") == 0) + { + g_bSoundBodyShots[client] = g_cvDM_cookie_sounds_bodyshots.BoolValue; + IntToString(g_cvDM_cookie_sounds_bodyshots.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundBodyShots_Cookie, sBuffer); + } + else + g_bSoundBodyShots[client] = view_as(StringToInt(sSoundBodyShots)); + + if (strcmp(sSoundHSShots, "") == 0) + { + g_bSoundHSShots[client] = g_cvDM_cookie_sounds_headshots.BoolValue; + IntToString(g_cvDM_cookie_sounds_headshots.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hSoundHSShots_Cookie, sBuffer); + } + else + g_bSoundHSShots[client] = view_as(StringToInt(sSoundHSShots)); + + if (strcmp(sHSOnly, "") == 0) + { + g_bHSOnlyClient[client] = g_cvDM_cookie_headshot_only.BoolValue; + IntToString(g_cvDM_cookie_headshot_only.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hHSOnly_Cookie, sBuffer); + } + else + g_bHSOnlyClient[client] = view_as(StringToInt(sHSOnly)); + + if (strcmp(sBellHit, "") == 0) + { + g_bBellHit[client] = g_cvDM_cookie_bell_hit.BoolValue; + IntToString(g_cvDM_cookie_bell_hit.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hBellHit_Cookie, sBuffer); + } + else + g_bBellHit[client] = view_as(StringToInt(sHSOnly)); + + if (strcmp(sBellKill, "") == 0) + { + g_bBellKill[client] = g_cvDM_cookie_bell_kill.BoolValue; + IntToString(g_cvDM_cookie_bell_kill.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hBellKill_Cookie, sBuffer); + } + else + g_bBellKill[client] = view_as(StringToInt(sHSOnly)); + + if (strcmp(sBellHeadshot, "") == 0) + { + g_bBellHeadshot[client] = g_cvDM_cookie_bell_headshot.BoolValue; + IntToString(g_cvDM_cookie_bell_headshot.IntValue, sBuffer, sizeof(sBuffer)); + SetClientCookie(client, g_hBellHeadshot_Cookie, sBuffer); + } + else + g_bBellHeadshot[client] = view_as(StringToInt(sHSOnly)); + } } \ No newline at end of file diff --git a/scripting/deathmatch/cvars.sp b/scripting/deathmatch/cvars.sp index 813940e..268cbba 100644 --- a/scripting/deathmatch/cvars.sp +++ b/scripting/deathmatch/cvars.sp @@ -6,15 +6,34 @@ void LoadCvars() g_cvDM_enabled = CreateConVar("dm_enabled", "1", "Enable Deathmatch."); g_cvDM_enable_valve_deathmatch = CreateConVar("dm_enable_valve_deathmatch", "0", "Enable compatibility for Valve Deathmatch (game_type 1 & game_mode 2) or Custom (game_type 3 & game_mode 0)."); g_cvDM_welcomemsg = CreateConVar("dm_welcomemsg", "1", "Display a message saying that your server is running Deathmatch."); + g_cvDM_infomsg = CreateConVar("dm_infomsg", "1", "Display a message informing the players of current settings and options."); g_cvDM_free_for_all = CreateConVar("dm_free_for_all", "0", "Free for all mode."); g_cvDM_hide_radar = CreateConVar("dm_hide_radar", "0", "Hides the radar from players."); + g_cvDM_reset_score = CreateConVar("dm_reset_score", "0", "Allow clients the ability to reset their score."); g_cvDM_display_killfeed = CreateConVar("dm_display_killfeed", "1", "Enable kill feed to be displayed to all players."); g_cvDM_display_killfeed_player = CreateConVar("dm_display_killfeed_player", "0", "Enable to show kill feed to only the attacker and victim."); + g_cvDM_display_killfeed_player_allow_client = CreateConVar("dm_display_killfeed_player_allow_client", "1", "Enable clients to have their own kill feed."); g_cvDM_display_damage_panel = CreateConVar("dm_display_damage_panel", "0", "Display a panel showing enemies health and the damage done to a player."); + g_cvDM_display_damage_panel_allow_client = CreateConVar("dm_display_damage_panel_allow_client", "1", "Enable clients to have their own damage panel."); g_cvDM_display_damage_popup = CreateConVar("dm_display_damage_popup", "0", "Display text above the enemy showing damage done to an enemy."); + g_cvDM_display_damage_popup_allow_client = CreateConVar("dm_display_damage_popup_allow_client", "1", "Enable clients to have their own damage popup."); g_cvDM_display_damage_text = CreateConVar("dm_display_damage_text", "0", "Display text in chat showing damage done to an enemy."); - g_cvDM_sounds_bodyshots = CreateConVar("dm_sounds_bodyshots", "1", "Enable the sounds of bodyshots."); - g_cvDM_sounds_headshots = CreateConVar("dm_sounds_headshots", "1", "Enable the sounds of headshots."); + g_cvDM_display_damage_text_allow_client = CreateConVar("dm_display_damage_text_allow_client", "1", "Enable clients to have their own damage text."); + g_cvDM_sounds_bell_hit = CreateConVar("dm_sounds_bell_hit", "0", "Play bell sound when a player hits another player."); + g_cvDM_sounds_bell_hit_allow_client = CreateConVar("dm_sounds_bell_hit_allow_client", "1", "Enable clients to have their bell sound for hits."); + g_cvDM_sounds_bell_kill = CreateConVar("dm_sounds_bell_kill", "0", "Play bell sound when a player kills another player."); + g_cvDM_sounds_bell_kill_allow_client = CreateConVar("dm_sounds_bell_kill_allow_client", "1", "Enable clients to have their bell sound for kills."); + g_cvDM_sounds_bell_headshot = CreateConVar("dm_sounds_bell_headshot", "0", "Play bell sound when a player headshots another player."); + g_cvDM_sounds_bell_headshot_allow_client = CreateConVar("dm_sounds_bell_headshot_allow_client", "1", "Enable clients to have their bell sound for headshots."); + g_cvDM_sounds_deaths = CreateConVar("dm_sounds_deaths", "1", "Filter the sounds of player deaths."); + g_cvDM_sounds_deaths_allow_client = CreateConVar("dm_sounds_deaths_allow_client", "1", "Enable clients to toggle the sounds of player deaths."); + g_cvDM_sounds_bodyshots = CreateConVar("dm_sounds_bodyshots", "1", "Filter the sounds of bodyshots."); + g_cvDM_sounds_bodyshots_allow_client = CreateConVar("dm_sounds_bodyshots_allow_client", "1", "Enable clients to toggle the sounds of bodyshots."); + g_cvDM_sounds_headshots = CreateConVar("dm_sounds_headshots", "1", "Filter the sounds of headshots."); + g_cvDM_sounds_headshots_allow_client = CreateConVar("dm_sounds_headshots_allow_client", "1", "Enable clients to toggle the sounds of headshots."); + g_cvDM_sounds_gunshots = CreateConVar("dm_sounds_gunshots", "1", "Filter the sounds of gunshots."); + g_cvDM_sounds_gunshots_allow_client = CreateConVar("dm_sounds_gunshots_allow_client", "1", "Enable clients to toggle the sounds of gunshots."); + g_cvDM_sounds_gunshots_distance = CreateConVar("dm_sounds_gunshots_distance", "1200.0", "Minimum distance from enemies at which a player can hear gunshots."); g_cvDM_headshot_only = CreateConVar("dm_headshot_only", "0", "Headshot only mode."); g_cvDM_headshot_only_allow_client = CreateConVar("dm_headshot_only_allow_client", "1", "Enable players to have their own personal headshot only mode."); g_cvDM_headshot_only_allow_world = CreateConVar("dm_headshot_only_allow_world", "0", "Enable world damage during headshot only mode."); @@ -27,7 +46,7 @@ void LoadCvars() g_cvDM_spawn_default = CreateConVar("dm_spawn_default", "0", "Enable default map spawn points. Overrides Valve Deathmatch respawning."); g_cvDM_spawn_los = CreateConVar("dm_spawn_los", "1", "Enable line of sight spawning. If enabled, players will be spawned at a point where they cannot see enemies, and enemies cannot see them."); g_cvDM_spawn_los_attempts = CreateConVar("dm_spawn_los_attempts", "64", "Maximum number of attempts to find a suitable line of sight spawn point."); - g_cvDM_spawn_distance = CreateConVar("dm_spawn_distance", "500000.0", "Minimum distance from enemies at which a player can spawn."); + g_cvDM_spawn_distance = CreateConVar("dm_spawn_distance", "100000.0", "Minimum distance from enemies at which a player can spawn."); g_cvDM_spawn_distance_attempts = CreateConVar("dm_spawn_distance_attempts", "64", "Maximum number of attempts to find a suitable distance spawn point."); g_cvDM_spawn_protection_time = CreateConVar("dm_spawn_protection_time", "1.0", "Spawn protection time."); g_cvDM_remove_blood_player = CreateConVar("dm_remove_blood_player", "1", "Remove blood splatter from player."); @@ -46,12 +65,13 @@ void LoadCvars() g_cvDM_replenish_ammo_reload = CreateConVar("dm_replenish_ammo_reload", "0", "Replenish ammo on reload action."); g_cvDM_replenish_ammo_kill = CreateConVar("dm_replenish_ammo_kill", "1", "Replenish ammo on kill."); g_cvDM_replenish_ammo_type = CreateConVar("dm_replenish_ammo_type", "2", "Replenish type. 1) Clip only. 2) Reserve only. 3) Both."); - g_cvDM_replenish_ammo_hs_kill = CreateConVar("dm_replenish_ammo_hs_kill", "0", "Replenish ammo on headshot kill."); + g_cvDM_replenish_ammo_hs_kill = CreateConVar("dm_replenish_ammo_hs_kill", "0", "Replenish ammo on headshot kill."); g_cvDM_replenish_ammo_hs_type = CreateConVar("dm_replenish_ammo_hs_type", "1", "Replenish type. 1) Clip only. 2) Reserve only. 3) Both."); g_cvDM_replenish_grenade = CreateConVar("dm_replenish_grenade", "0", "Unlimited player grenades."); g_cvDM_replenish_grenade_kill = CreateConVar("dm_replenish_grenade_kill", "0", "Give players their grenade back on successful kill."); g_cvDM_nade_messages = CreateConVar("dm_nade_messages", "1", "Disable grenade messages."); g_cvDM_cash_messages = CreateConVar("dm_cash_messages", "1", "Disable cash award messages."); + g_cvDM_hp_enable = CreateConVar("dm_hp_enable", "1", "Enable players to earn HP for every kill."); g_cvDM_hp_start = CreateConVar("dm_hp_start", "100", "Spawn Health Points (HP)."); g_cvDM_hp_max = CreateConVar("dm_hp_max", "100", "Maximum Health Points (HP)."); g_cvDM_hp_kill = CreateConVar("dm_hp_kill", "5", "Health Points (HP) per kill."); @@ -59,6 +79,7 @@ void LoadCvars() g_cvDM_hp_knife = CreateConVar("dm_hp_knife", "50", "Health Points (HP) per knife kill."); g_cvDM_hp_nade = CreateConVar("dm_hp_nade", "30", "Health Points (HP) per nade kill."); g_cvDM_hp_messages = CreateConVar("dm_hp_messages", "1", "Display HP messages."); + g_cvDM_ap_enable = CreateConVar("dm_ap_enable", "1", "Enable players to earn AP for every kill."); g_cvDM_ap_max = CreateConVar("dm_ap_max", "100", "Maximum Armor Points (AP)."); g_cvDM_ap_kill = CreateConVar("dm_ap_kill", "5", "Armor Points (AP) per kill."); g_cvDM_ap_headshot = CreateConVar("dm_ap_headshot", "10", "Armor Points (AP) per headshot kill."); @@ -87,93 +108,36 @@ void LoadCvars() g_cvDM_nades_smoke = CreateConVar("dm_nades_smoke", "0", "Number of smoke grenades to give each player."); g_cvDM_nades_tactical = CreateConVar("dm_nades_tactical", "0", "Number of tactical grenades to give each player."); g_cvDM_armor = CreateConVar("dm_armor", "2", "Give players armor. 0) Disable. 1) Chest. 2) Chest + Helmet."); + /* Cookie Preferences */ + g_cvDM_cookie_damage_panel = CreateConVar("dm_cookie_damage_panel", "0", "Default damage panel cookie preference."); + g_cvDM_cookie_damage_popup = CreateConVar("dm_cookie_damage_popup", "0", "Default damage popup cookie preference."); + g_cvDM_cookie_damage_text = CreateConVar("dm_cookie_damage_text", "0", "Default damage text cookie preference."); + g_cvDM_cookie_killfeed = CreateConVar("dm_cookie_killfeed", "0", "Default kill feed cookie preference."); + g_cvDM_cookie_sounds_death = CreateConVar("dm_cookie_sounds_death", "0", "Default death sounds cookie preference."); + g_cvDM_cookie_sounds_gunshots = CreateConVar("dm_cookie_sounds_gunshots", "0", "Default gunshot sounds cookie preference."); + g_cvDM_cookie_sounds_bodyshots = CreateConVar("dm_cookie_sounds_bodyshots", "0", "Default bodyshot sounds cookie preference."); + g_cvDM_cookie_sounds_headshots = CreateConVar("dm_cookie_sounds_headshots", "0", "Default headshot sounds cookie preference."); + g_cvDM_cookie_headshot_only = CreateConVar("dm_cookie_headshot_only", "0", "Default headshot only cookie preference."); + g_cvDM_cookie_bell_hit = CreateConVar("dm_cookie_bell_hit", "0", "Default cookie preference."); + g_cvDM_cookie_bell_kill = CreateConVar("dm_cookie_bell_kill", "0", "Default cookie preference."); + g_cvDM_cookie_bell_headshot = CreateConVar("dm_cookie_bell_headshot", "0", "Default cookie preference."); } void LoadChangeHooks() { /* Hook Console Variables */ g_cvDM_enabled.AddChangeHook(Event_CvarChange); - g_cvDM_config_name.AddChangeHook(Event_CvarChange); - g_cvDM_enable_valve_deathmatch.AddChangeHook(Event_CvarChange); - g_cvDM_welcomemsg.AddChangeHook(Event_CvarChange); - g_cvDM_free_for_all.AddChangeHook(Event_CvarChange); - g_cvDM_hide_radar.AddChangeHook(Event_CvarChange); - g_cvDM_display_killfeed.AddChangeHook(Event_CvarChange); - g_cvDM_display_killfeed_player.AddChangeHook(Event_CvarChange); - g_cvDM_display_damage_panel.AddChangeHook(Event_CvarChange); - g_cvDM_display_damage_popup.AddChangeHook(Event_CvarChange); - g_cvDM_display_damage_text.AddChangeHook(Event_CvarChange); - g_cvDM_sounds_bodyshots.AddChangeHook(Event_CvarChange); - g_cvDM_sounds_headshots.AddChangeHook(Event_CvarChange); - g_cvDM_headshot_only.AddChangeHook(Event_CvarChange); - g_cvDM_headshot_only_allow_client.AddChangeHook(Event_CvarChange); - g_cvDM_headshot_only_allow_world.AddChangeHook(Event_CvarChange); - g_cvDM_headshot_only_allow_knife.AddChangeHook(Event_CvarChange); - g_cvDM_headshot_only_allow_taser.AddChangeHook(Event_CvarChange); - g_cvDM_headshot_only_allow_nade.AddChangeHook(Event_CvarChange); - g_cvDM_respawn.AddChangeHook(Event_CvarChange); - g_cvDM_respawn_valve.AddChangeHook(Event_CvarChange); - g_cvDM_respawn_time.AddChangeHook(Event_CvarChange); - g_cvDM_spawn_default.AddChangeHook(Event_CvarChange); - g_cvDM_spawn_los.AddChangeHook(Event_CvarChange); - g_cvDM_spawn_los_attempts.AddChangeHook(Event_CvarChange); - g_cvDM_spawn_distance.AddChangeHook(Event_CvarChange); - g_cvDM_spawn_protection_time.AddChangeHook(Event_CvarChange); - g_cvDM_remove_knife_damage.AddChangeHook(Event_CvarChange); + g_cvDM_remove_objectives.AddChangeHook(Event_CvarChange); + g_cvDM_remove_buyzones.AddChangeHook(Event_CvarChange); + g_cvDM_healthshot.AddChangeHook(Event_CvarChange); g_cvDM_remove_cash.AddChangeHook(Event_CvarChange); + g_cvDM_armor.AddChangeHook(Event_CvarChange); g_cvDM_remove_chickens.AddChangeHook(Event_CvarChange); - g_cvDM_remove_buyzones.AddChangeHook(Event_CvarChange); - g_cvDM_remove_objectives.AddChangeHook(Event_CvarChange); - g_cvDM_remove_ragdoll.AddChangeHook(Event_CvarChange); - g_cvDM_remove_ragdoll_time.AddChangeHook(Event_CvarChange); g_cvDM_remove_spawn_weapons.AddChangeHook(Event_CvarChange); - g_cvDM_remove_ground_weapons.AddChangeHook(Event_CvarChange); g_cvDM_remove_dropped_weapons.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_ammo_empty.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_ammo_reload.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_ammo_kill.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_ammo_type.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_ammo_hs_kill.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_ammo_hs_type.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_grenade.AddChangeHook(Event_CvarChange); - g_cvDM_replenish_grenade_kill.AddChangeHook(Event_CvarChange); - g_cvDM_nade_messages.AddChangeHook(Event_CvarChange); - g_cvDM_cash_messages.AddChangeHook(Event_CvarChange); - g_cvDM_hp_start.AddChangeHook(Event_CvarChange); - g_cvDM_hp_max.AddChangeHook(Event_CvarChange); - g_cvDM_hp_kill.AddChangeHook(Event_CvarChange); - g_cvDM_hp_headshot.AddChangeHook(Event_CvarChange); - g_cvDM_hp_knife.AddChangeHook(Event_CvarChange); - g_cvDM_hp_nade.AddChangeHook(Event_CvarChange); - g_cvDM_hp_messages.AddChangeHook(Event_CvarChange); - g_cvDM_ap_max.AddChangeHook(Event_CvarChange); - g_cvDM_ap_kill.AddChangeHook(Event_CvarChange); - g_cvDM_ap_headshot.AddChangeHook(Event_CvarChange); - g_cvDM_ap_knife.AddChangeHook(Event_CvarChange); - g_cvDM_ap_nade.AddChangeHook(Event_CvarChange); - g_cvDM_ap_messages.AddChangeHook(Event_CvarChange); + g_cvDM_remove_objectives.AddChangeHook(Event_CvarChange); + g_cvDM_free_for_all.AddChangeHook(Event_CvarChange); g_cvDM_gun_menu_mode.AddChangeHook(Event_CvarChange); - g_cvDM_loadout_style.AddChangeHook(Event_CvarChange); - g_cvDM_fast_equip.AddChangeHook(Event_CvarChange); - g_cvDM_healthshot.AddChangeHook(Event_CvarChange); - g_cvDM_healthshot_health.AddChangeHook(Event_CvarChange); - g_cvDM_healthshot_spawn.AddChangeHook(Event_CvarChange); - g_cvDM_healthshot_total.AddChangeHook(Event_CvarChange); - g_cvDM_healthshot_kill.AddChangeHook(Event_CvarChange); - g_cvDM_healthshot_kill_knife.AddChangeHook(Event_CvarChange); - g_cvDM_zeus.AddChangeHook(Event_CvarChange); - g_cvDM_zeus_spawn.AddChangeHook(Event_CvarChange); - g_cvDM_zeus_kill.AddChangeHook(Event_CvarChange); - g_cvDM_zeus_kill_taser.AddChangeHook(Event_CvarChange); - g_cvDM_zeus_kill_knife.AddChangeHook(Event_CvarChange); - g_cvDM_nades_incendiary.AddChangeHook(Event_CvarChange); - g_cvDM_nades_molotov.AddChangeHook(Event_CvarChange); - g_cvDM_nades_decoy.AddChangeHook(Event_CvarChange); - g_cvDM_nades_flashbang.AddChangeHook(Event_CvarChange); - g_cvDM_nades_he.AddChangeHook(Event_CvarChange); - g_cvDM_nades_smoke.AddChangeHook(Event_CvarChange); - g_cvDM_nades_tactical.AddChangeHook(Event_CvarChange); - g_cvDM_armor.AddChangeHook(Event_CvarChange); } void RetrieveVariables() @@ -213,11 +177,11 @@ void RetrieveVariables() g_cvHealthshot_health = FindConVar("healthshot_health"); /* Retrieve Native Console Variable Values */ - g_cvMP_ct_default_primary.GetString(g_cBackup_mp_ct_default_primary, sizeof(g_cBackup_mp_ct_default_primary)); - g_cvMP_t_default_primary.GetString(g_cBackup_mp_t_default_primary, sizeof(g_cBackup_mp_t_default_primary)); - g_cvMP_ct_default_secondary.GetString(g_cBackup_mp_ct_default_secondary, sizeof(g_cBackup_mp_ct_default_secondary)); - g_cvMP_t_default_secondary.GetString(g_cBackup_mp_t_default_secondary, sizeof(g_cBackup_mp_t_default_secondary)); - g_cvMP_items_prohibited.GetString(g_cBackup_mp_items_prohibited, sizeof(g_cBackup_mp_items_prohibited)); + g_cvMP_ct_default_primary.GetString(g_sBackup_mp_ct_default_primary, sizeof(g_sBackup_mp_ct_default_primary)); + g_cvMP_t_default_primary.GetString(g_sBackup_mp_t_default_primary, sizeof(g_sBackup_mp_t_default_primary)); + g_cvMP_ct_default_secondary.GetString(g_sBackup_mp_ct_default_secondary, sizeof(g_sBackup_mp_ct_default_secondary)); + g_cvMP_t_default_secondary.GetString(g_sBackup_mp_t_default_secondary, sizeof(g_sBackup_mp_t_default_secondary)); + g_cvMP_items_prohibited.GetString(g_sBackup_mp_items_prohibited, sizeof(g_sBackup_mp_items_prohibited)); g_iBackup_free_armor = g_cvMP_free_armor.IntValue; g_iBackup_max_armor = g_cvMP_max_armor.IntValue; g_iBackup_mp_randomspawn = g_cvMP_randomspawn.IntValue; @@ -253,23 +217,34 @@ void LoadCookies() g_hWeapon_Primary_Cookie = RegClientCookie("dm_weapon_primary", "Primary Weapon Selection", CookieAccess_Private); g_hWeapon_Secondary_Cookie = RegClientCookie("dm_weapon_secondary", "Secondary Weapon Selection", CookieAccess_Private); g_hWeapon_Remember_Cookie = RegClientCookie("dm_weapon_remember", "Remember Weapon Selection", CookieAccess_Private); - g_hWeapon_First_Cookie = RegClientCookie("dm_weapon_first", "First Weapon Selection", CookieAccess_Private); g_hDamage_Panel_Cookie = RegClientCookie("dm_damage_panel", "Damage Panel", CookieAccess_Protected); g_hDamage_Popup_Cookie = RegClientCookie("dm_damage_popup", "Damage Popup", CookieAccess_Protected); g_hDamage_Text_Cookie = RegClientCookie("dm_damage_text", "Damage Text", CookieAccess_Protected); - g_hKillFeed_Cookie = RegClientCookie("dm_killfeed", "Kill Feed", CookieAccess_Protected); - g_hHSOnly_Cookie = RegClientCookie("dm_hsonly", "Headshot Only", CookieAccess_Protected); + g_hKillFeed_Cookie = RegClientCookie("dm_filter_killfeed", "Kill Feed", CookieAccess_Protected); + g_hSoundDeath_Cookie = RegClientCookie("dm_filter_sound_death", "Filter Death Sounds", CookieAccess_Protected); + g_hSoundGunShots_Cookie = RegClientCookie("dm_filter_sound_gunshots", "Filter Gun Shot Sounds", CookieAccess_Protected); + g_hSoundBodyShots_Cookie = RegClientCookie("dm_filter_sound_bodyshots", "Filter Body Shot Sounds", CookieAccess_Protected); + g_hSoundHSShots_Cookie = RegClientCookie("dm_filter_soundhsshots", "Filter Headshot Shot Sounds", CookieAccess_Protected); + g_hHSOnly_Cookie = RegClientCookie("dm_headshot_only", "Headshot Only", CookieAccess_Protected); + g_hBellKill_Cookie = RegClientCookie("dm_bellkill", "Bell Kill", CookieAccess_Protected); + g_hBellHit_Cookie = RegClientCookie("dm_bellhit", "Bell Hit", CookieAccess_Protected); + g_hBellHeadshot_Cookie = RegClientCookie("dm_bellheadshot", "Bell Headshot", CookieAccess_Protected); + /* Cookie Menu */ SetCookieMenu(g_hDamage_Panel_Cookie, CookieMenu_OnOff_Int, "Deathmatch Damage Panel", Cookiemenu_DisplayCallback); SetCookieMenu(g_hDamage_Popup_Cookie, CookieMenu_OnOff_Int, "Deathmatch Damage Popup", Cookiemenu_DisplayCallback); SetCookieMenu(g_hDamage_Text_Cookie, CookieMenu_OnOff_Int, "Deathmatch Damage Text", Cookiemenu_DisplayCallback); - SetCookieMenu(g_hKillFeed_Cookie, CookieMenu_OnOff_Int, "Deathmatch Kill Feed", Cookiemenu_DisplayCallback); - SetCookieMenu(g_hHSOnly_Cookie, CookieMenu_OnOff_Int, "Deathmatch Headshot Only", Cookiemenu_HSOnlyCallback); + SetCookieMenu(g_hKillFeed_Cookie, CookieMenu_YesNo_Int, "Deathmatch Filter Kill Feed", Cookiemenu_DisplayCallback); + SetCookieMenu(g_hSoundDeath_Cookie, CookieMenu_OnOff_Int, "Deathmatch Filter Death Sounds", Cookiemenu_DisplayCallback); + SetCookieMenu(g_hSoundGunShots_Cookie, CookieMenu_OnOff_Int, "Deathmatch Filter Gun Shot Sounds", Cookiemenu_DisplayCallback); + SetCookieMenu(g_hSoundBodyShots_Cookie, CookieMenu_OnOff_Int, "Deathmatch Filter Body Shot Sounds", Cookiemenu_DisplayCallback); + SetCookieMenu(g_hSoundHSShots_Cookie, CookieMenu_OnOff_Int, "Deathmatch Filter Headshot Shot Sounds", Cookiemenu_DisplayCallback); + SetCookieMenu(g_hHSOnly_Cookie, CookieMenu_OnOff_Int, "Deathmatch Headshot Only", Cookiemenu_DisplayCallback); /* Late Load Cookies */ for (int i = 1; i <= MaxClients; i++) { - if (IsClientConnected(i) && !IsFakeClient(i)) - OnClientCookiesCached(i); + if (!IsClientInGame(i) || IsFakeClient(i)) continue; + OnClientCookiesCached(i); } } \ No newline at end of file diff --git a/scripting/deathmatch/events.sp b/scripting/deathmatch/events.sp index ad6d96e..a6f1569 100644 --- a/scripting/deathmatch/events.sp +++ b/scripting/deathmatch/events.sp @@ -31,17 +31,20 @@ void HookEvents() void HookTempEnts() { - AddTempEntHook("Blood Sprite", TE_OnWorldDecal); - AddTempEntHook("Entity Decal", TE_OnWorldDecal); - AddTempEntHook("EffectDispatch", TE_OnEffectDispatch); - AddTempEntHook("World Decal", TE_OnWorldDecal); - AddTempEntHook("Impact", TE_OnWorldDecal); + /* Hook Temporary Entities */ + AddTempEntHook("Blood Sprite", TE_WorldDecal); + AddTempEntHook("Entity Decal", TE_WorldDecal); + AddTempEntHook("EffectDispatch", TE_EffectDispatch); + AddTempEntHook("World Decal", TE_WorldDecal); + AddTempEntHook("Impact", TE_WorldDecal); + AddTempEntHook("Shotgun Shot", TE_ShotgunShot); } void HookSounds() { /* Hook Sound Events */ - AddNormalSoundHook(view_as(Event_Sound)); + AddNormalSoundHook(Event_NormalSound); + AddAmbientSoundHook(Event_AmbientSound); } public void Event_CvarChange(ConVar cvar, const char[] oldValue, const char[] newValue) @@ -56,15 +59,11 @@ public void Event_CvarChange(ConVar cvar, const char[] oldValue, const char[] ne } else if (cvar == g_cvDM_remove_objectives) { - char status[10]; - status = (g_cvDM_remove_objectives.BoolValue) ? "Disable" : "Enable"; - State_SetObjectives(status); + State_SetObjectives(g_cvDM_remove_objectives.BoolValue ? "Disable" : "Enable"); } else if (cvar == g_cvDM_remove_buyzones) { - char status[10]; - status = (g_cvDM_remove_buyzones.BoolValue) ? "Disable" : "Enable"; - State_SetBuyZones(status); + State_SetBuyZones(g_cvDM_remove_buyzones.BoolValue ? "Disable" : "Enable"); } else if (cvar == g_cvDM_healthshot) { @@ -116,9 +115,9 @@ public void Event_CvarChange(ConVar cvar, const char[] oldValue, const char[] ne else if (cvar == g_cvDM_free_for_all) { if (g_cvDM_free_for_all.BoolValue) - State_EnableFFA(); + State_SetFFA(); else - State_DisableFFA(); + State_RestoreFFA(); } else if (cvar == g_cvDM_gun_menu_mode) { @@ -126,34 +125,33 @@ public void Event_CvarChange(ConVar cvar, const char[] oldValue, const char[] ne { for (int i = 1; i <= MaxClients; i++) { - if (g_cvDM_gun_menu_mode.IntValue >= 4) + if (!IsClientInGame(i)) + continue; + if (!IsFakeClient(i)) CancelClientMenu(i); - if (IsClientConnected(i)) + if (g_cvDM_gun_menu_mode.IntValue >= 4) SetClientGunModeSettings(i); } } } } -public void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) +public Action Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue) { - UpdateSpawnPoints(); /* If the player joins spectator, close any open menu, and remove their ragdoll. */ int client = GetClientOfUserId(event.GetInt("userid")); - if (client) + if (!g_bRoundEnded && IsValidClient(client, true)) { - if (event.GetInt("team") > CS_TEAM_SPECTATOR) - { - if (g_cvDM_respawn.BoolValue) - CreateTimer(g_cvDM_respawn_time.FloatValue, Timer_Respawn, GetClientSerial(client)); - } + if (g_cvDM_respawn.BoolValue) + CreateTimer(g_cvDM_respawn_time.FloatValue, Timer_Respawn, GetClientSerial(client)); } if (!event.GetBool("disconnect")) event.SetBool("silent", true); } + return Plugin_Continue; } public Action Event_RoundPrestart(Event event, const char[] name, bool dontBroadcast) @@ -161,7 +159,6 @@ public Action Event_RoundPrestart(Event event, const char[] name, bool dontBroad if (g_cvDM_enabled.BoolValue) { g_bRoundEnded = false; - UpdateSpawnPoints(); } } @@ -169,6 +166,8 @@ public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcas { if (g_cvDM_enabled.BoolValue) { + g_bRoundEnded = false; + if (g_cvDM_remove_objectives.BoolValue) State_SetHostages(); @@ -177,8 +176,6 @@ public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcas if (g_bLoadedConfig) g_bLoadedConfig = false; - - UpdateSpawnPoints(); } } @@ -190,10 +187,9 @@ public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) if (g_bLoadConfig) { g_bLoadedConfig = true; - LoadConfig(g_cLoadConfig); + LoadConfig(g_sLoadConfig); + State_ResetDM(); } - - UpdateSpawnPoints(); } } @@ -202,99 +198,60 @@ public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast if (g_cvDM_enabled.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && GetClientTeam(client) > CS_TEAM_SPECTATOR) + if (IsValidClient(client, true) && GetClientTeam(client) > CS_TEAM_SPECTATOR) { if (!IsFakeClient(client)) { - if (g_cvDM_welcomemsg.BoolValue && !g_bInfoMessage[client]) + /* Freshly Baked */ + ClientCookiesRefresh(client); + /* Hide radar. */ + if (g_cvDM_free_for_all.BoolValue || g_cvDM_hide_radar.BoolValue) + RequestFrame(Frame_RemoveRadar, GetClientSerial(client)); + /* Display welcome message. */ + if (g_cvDM_welcomemsg.BoolValue && !g_bWelcomeMessage[client]) { char config[256]; g_cvDM_config_name.GetString(config, sizeof(config)); - PrintHintText(client, "This server is running:\nDeathmatch v%s\nMode: %s", PLUGIN_VERSION, config); - CPrintToChat(client, "%t This server is running {green}Deathmatch {default}v%s with mode: {purple}%s", "Chat Tag", PLUGIN_VERSION, config); + PrintHintText(client, "Welcome to Tarik.GG:\nDeathmatch\nMode: %s", config); + CPrintToChat(client, "%t Welcome to Tarik.GG {green}Deathmatch {default}with mode: {purple}%s", "Chat Tag", config); + g_bWelcomeMessage[client] = true; } - /* Hide radar. */ - if (g_cvDM_free_for_all.BoolValue || g_cvDM_hide_radar.BoolValue) - RequestFrame(Frame_RemoveRadar, GetClientSerial(client)); /* Display help message. */ - if (!g_bInfoMessage[client]) + if (g_cvDM_infomsg.BoolValue && !g_bInfoMessage[client]) { if (g_cvDM_gun_menu_mode.IntValue <= 3) CPrintToChat(client, "%t %t", "Chat Tag", "Guns Menu"); - CPrintToChat(client, "%t %t", "Chat Tag", "Settings Menu"); - if (g_cvDM_headshot_only.BoolValue) - CPrintToChat(client, "%t %t", "Chat Tag", "HS Only"); - + CPrintToChat(client, "%t %t", "Chat Tag", "Headshot Only Enabled"); g_bInfoMessage[client] = true; } - char cRemember[24]; - GetClientCookie(client, g_hWeapon_Remember_Cookie, cRemember, sizeof(cRemember)); - g_bRememberChoice[client] = view_as(StringToInt(cRemember)); } /* Teleport player to custom spawn point. */ if (g_iSpawnPointCount > 0 && !g_cvDM_spawn_default.BoolValue) { - UpdateSpawnPoints(); - MovePlayer(client); + Spawns_UpdateSpawnPoints(); + Spawns_MovePlayer(client); } /* Enable player spawn protection. */ if (!g_bInEditModeClient[client] && g_cvDM_spawn_protection_time.FloatValue > 0.0) - EnableSpawnProtection(client); + Spawns_EnableSpawnProtection(client); else if (g_bInEditModeClient[client]) - EnableEditorMode(client) + Spawns_EnableEditorMode(client) /* Set health. */ if (g_cvDM_hp_start.IntValue != 100) SetEntityHealth(client, g_cvDM_hp_start.IntValue); + /* Reset Client */ + Client_ResetClientSettings(client); /* Give armor. */ - switch (g_cvDM_armor.IntValue) - { - case 0: - { - SetEntProp(client, Prop_Send, "m_ArmorValue", 0); - SetEntProp(client, Prop_Send, "m_bHasHelmet", 0); - } - case 1: - { - SetEntProp(client, Prop_Send, "m_ArmorValue", 100); - SetEntProp(client, Prop_Send, "m_bHasHelmet", 0); - } - case 2: - { - SetEntProp(client, Prop_Send, "m_ArmorValue", 100); - SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); - } - } - g_bWeaponsGivenThisRound[client] = false; - g_bGiveFullLoadout[client] = false; - /* Remove weapons. */ - RemoveClientWeapons(client); + Client_SetArmor(client); + /* Strip C4 */ if (g_cvDM_remove_objectives.BoolValue) Client_StripC4(client); - /* Give weapons or display menu. */ - if (g_bRememberChoice[client] || IsFakeClient(client)) - { - /* Give normal loadout if remembered. */ - if (g_cvDM_gun_menu_mode.IntValue == 1 || g_cvDM_gun_menu_mode.IntValue == 5) - GiveSavedWeapons(client, true, true); - /* Give only primary weapons if remembered. */ - else if (g_cvDM_gun_menu_mode.IntValue == 2) - GiveSavedWeapons(client, true, false) - /* Give only secondary weapons if remembered. */ - else if (g_cvDM_gun_menu_mode.IntValue == 3) - GiveSavedWeapons(client, false, true); - /* Give only knife weapons if remembered. */ - else if (g_cvDM_gun_menu_mode.IntValue == 4) - GiveSavedWeapons(client, false, false); - } - /* Display the gun menu to new users. */ - else if (!IsFakeClient(client)) - { - /* All weapons menu. */ - if (g_cvDM_gun_menu_mode.IntValue <= 3) - BuildWeaponsMenu(client); - } + /* Give weapons or build menu. */ + Client_GiveWeaponsOrBuildMenu(client); + /* This allows sounds to start being transmitted again (e.g. footsteps). */ + g_bPlayerMoved[client] = true; } } } @@ -303,20 +260,19 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca { if (g_cvDM_enabled.BoolValue) { - int victim = GetClientOfUserId(event.GetInt("userid")); - int attacker = GetClientOfUserId(event.GetInt("attacker")); - char weapon[32]; event.GetString("weapon", weapon, sizeof(weapon)); - - bool tazed = StrEqual(weapon, "taser"); + int victim = GetClientOfUserId(event.GetInt("userid")); + int attacker = GetClientOfUserId(event.GetInt("attacker")); + int assister = GetClientOfUserId(event.GetInt("assister")); bool knifed = (StrContains(weapon, "knife") != -1 || StrContains(weapon, "bayonet") != -1); - bool naded = StrEqual(weapon, "hegrenade"); - bool decoy = StrEqual(weapon, "decoy"); - bool inferno = StrEqual(weapon, "inferno"); - bool tactical = StrEqual(weapon, "tagrenade_projectile"); + bool tazed = strcmp(weapon, "taser") == 0; + bool naded = strcmp(weapon, "hegrenade") == 0; + bool decoy = strcmp(weapon, "decoy") == 0; + bool inferno = strcmp(weapon, "inferno") == 0; + bool tactical = strcmp(weapon, "tagrenade_projectile") == 0; bool headshot = event.GetBool("headshot"); - bool bchanged = false; + bool changed = false; /* Kill feed */ if (g_cvDM_display_killfeed.BoolValue) @@ -325,83 +281,103 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca { event.BroadcastDisabled = true; - if (attacker) - { - char cACookie[24]; - GetClientCookie(attacker, g_hKillFeed_Cookie, cACookie, sizeof(cACookie)); - g_bKillFeed[attacker] = view_as(StringToInt(cACookie)); - } - if (victim) - { - char cVCookie[24]; - GetClientCookie(victim, g_hKillFeed_Cookie, cVCookie, sizeof(cVCookie)); - g_bKillFeed[victim] = view_as(StringToInt(cVCookie)); - } - if (attacker && g_bKillFeed[attacker] && !IsFakeClient(attacker)) + if (IsValidClient(attacker, false)) event.FireToClient(attacker); + if (IsValidClient(victim, false) && attacker != victim) + event.FireToClient(victim); + if (IsValidClient(assister, false) && victim != assister) + event.FireToClient(assister); + } + else if (g_cvDM_display_killfeed_player_allow_client.BoolValue) + { + event.BroadcastDisabled = true; - if (victim && g_bKillFeed[victim] && attacker != victim && !IsFakeClient(victim)) + if (IsValidClient(attacker, false)) + event.FireToClient(attacker); + if (IsValidClient(victim, false) && attacker != victim) event.FireToClient(victim); + if (IsValidClient(assister, false) && victim != assister) + event.FireToClient(assister); + + for (int i = 1; i <= MaxClients; i++) + { + if (!IsValidClient(i, false) || i == victim || i == attacker || i == assister) + continue; + if (!g_bKillFeed[i]) + event.FireToClient(i); + } } } else event.BroadcastDisabled = true; - /* Reward attacker with HP. */ - if (attacker && IsPlayerAlive(attacker)) + /* Check if attacker is alive and well */ + if (IsValidClient(attacker, false) && IsPlayerAlive(attacker)) { + /* Stop respawn sounds from playing. */ + StopSound(attacker, SNDCHAN_ITEM, "buttons/bell1.wav"); + RequestFrame(Frame_StopSound, GetClientSerial(attacker)); + + /* Reward attacker with HP. */ int attackerHP = GetClientHealth(attacker); int attackerAP = GetClientArmor(attacker); - /* Reward the attacker with ammo. */ if (g_cvDM_replenish_ammo_kill.BoolValue) RequestFrame(Frame_GiveAmmo, GetClientSerial(attacker)); if (g_cvDM_replenish_ammo_hs_kill.BoolValue && headshot) RequestFrame(Frame_GiveAmmoHS, GetClientSerial(attacker)); - - if (g_cvDM_hp_messages.BoolValue || g_cvDM_ap_messages.BoolValue) + if (g_cvDM_hp_enable.BoolValue || g_cvDM_ap_enable.BoolValue) { - if ((g_cvDM_hp_messages.BoolValue && g_cvDM_ap_messages.BoolValue) && attackerAP < g_cvDM_ap_max.IntValue && attackerHP < g_cvDM_hp_max.IntValue) + if ((g_cvDM_hp_enable.BoolValue && g_cvDM_ap_enable.BoolValue) && attackerAP < g_cvDM_ap_max.IntValue && attackerHP < g_cvDM_hp_max.IntValue) { - if (knifed) - CPrintToChat(attacker, "%t \x04+%i HP\x01 & \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_hp_knife.IntValue, g_cvDM_ap_knife.IntValue, "Knife Kill"); - else if (headshot) - CPrintToChat(attacker, "%t \x04+%i HP\x01 & \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_hp_headshot.IntValue, g_cvDM_ap_headshot.IntValue, "Headshot Kill"); - else if (naded || decoy || inferno) - CPrintToChat(attacker, "%t \x04+%i HP\x01 & \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_hp_nade.IntValue, g_cvDM_ap_nade.IntValue, "Nade Kill"); - else - CPrintToChat(attacker, "%t \x04+%i HP\x01 & \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_hp_kill.IntValue, g_cvDM_ap_kill.IntValue, "Kill"); + if ((g_cvDM_hp_messages.BoolValue && g_cvDM_ap_messages.BoolValue)) + { + if (knifed) + CPrintToChat(attacker, "%t {green}+%i HP{default} & {green}+%i AP{default} %t", "Chat Tag", g_cvDM_hp_knife.IntValue, g_cvDM_ap_knife.IntValue, "Knife Kill"); + else if (headshot) + CPrintToChat(attacker, "%t {green}+%i HP{default} & {green}+%i AP{default} %t", "Chat Tag", g_cvDM_hp_headshot.IntValue, g_cvDM_ap_headshot.IntValue, "Headshot Kill"); + else if (naded || decoy || inferno) + CPrintToChat(attacker, "%t {green}+%i HP{default} & {green}+%i AP{default} %t", "Chat Tag", g_cvDM_hp_nade.IntValue, g_cvDM_ap_nade.IntValue, "Nade Kill"); + else + CPrintToChat(attacker, "%t {green}+%i HP{default} & {green}+%i AP{default} %t", "Chat Tag", g_cvDM_hp_kill.IntValue, g_cvDM_ap_kill.IntValue, "Kill"); + } SetEntProp(attacker, Prop_Send, "m_iHealth", AddHealthToPlayer(attackerHP, knifed, headshot, naded, decoy, inferno), 1); SetEntProp(attacker, Prop_Send, "m_ArmorValue", AddArmorToPlayer(attackerAP, knifed, headshot, naded, decoy, inferno), 1); - bchanged = true; + changed = true; } - else if (g_cvDM_hp_messages.BoolValue && !bchanged && attackerHP < g_cvDM_hp_max.IntValue) + else if (g_cvDM_hp_enable.BoolValue && !changed && attackerHP < g_cvDM_hp_max.IntValue) { - if (knifed) - CPrintToChat(attacker, "%t \x04+%i HP\x01 %t", "Chat Tag", g_cvDM_hp_knife.IntValue, "Knife Kill"); - else if (headshot) - CPrintToChat(attacker, "%t \x04+%i HP\x01 %t", "Chat Tag", g_cvDM_hp_headshot.IntValue, "Headshot Kill"); - else if (naded || decoy || inferno) - CPrintToChat(attacker, "%t \x04+%i HP\x01 %t", "Chat Tag", g_cvDM_hp_nade.IntValue, "Nade Kill"); - else - CPrintToChat(attacker, "%t \x04+%i HP\x01 %t", "Chat Tag", g_cvDM_hp_kill.IntValue, "Kill"); + if (g_cvDM_hp_messages.BoolValue) + { + if (knifed) + CPrintToChat(attacker, "%t {green}+%i HP{default} %t", "Chat Tag", g_cvDM_hp_knife.IntValue, "Knife Kill"); + else if (headshot) + CPrintToChat(attacker, "%t {green}+%i HP{default} %t", "Chat Tag", g_cvDM_hp_headshot.IntValue, "Headshot Kill"); + else if (naded || decoy || inferno) + CPrintToChat(attacker, "%t {green}+%i HP{default} %t", "Chat Tag", g_cvDM_hp_nade.IntValue, "Nade Kill"); + else + CPrintToChat(attacker, "%t {green}+%i HP{default} %t", "Chat Tag", g_cvDM_hp_kill.IntValue, "Kill"); + } SetEntProp(attacker, Prop_Send, "m_iHealth", AddHealthToPlayer(attackerHP, knifed, headshot, naded, decoy, inferno), 1); - bchanged = true; + changed = true; } - else if (g_cvDM_ap_messages.BoolValue && !bchanged && attackerAP < g_cvDM_ap_max.IntValue) + else if (g_cvDM_ap_enable.BoolValue && !changed && attackerAP < g_cvDM_ap_max.IntValue) { - if (knifed) - CPrintToChat(attacker, "%t \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_ap_knife.IntValue, "Knife Kill"); - else if (headshot) - CPrintToChat(attacker, "%t \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_ap_headshot.IntValue, "Headshot Kill"); - else if (naded || decoy || inferno) - CPrintToChat(attacker, "%t \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_ap_nade.IntValue, "Nade Kill"); - else - CPrintToChat(attacker, "%t \x04+%i AP\x01 %t", "Chat Tag", g_cvDM_ap_kill.IntValue, "Kill"); + if (g_cvDM_ap_messages.BoolValue) + { + if (knifed) + CPrintToChat(attacker, "%t {green}+%i AP{default} %t", "Chat Tag", g_cvDM_ap_knife.IntValue, "Knife Kill"); + else if (headshot) + CPrintToChat(attacker, "%t {green}+%i AP{default} %t", "Chat Tag", g_cvDM_ap_headshot.IntValue, "Headshot Kill"); + else if (naded || decoy || inferno) + CPrintToChat(attacker, "%t {green}+%i AP{default} %t", "Chat Tag", g_cvDM_ap_nade.IntValue, "Nade Kill"); + else + CPrintToChat(attacker, "%t {green}+%i AP{default} %t", "Chat Tag", g_cvDM_ap_kill.IntValue, "Kill"); + } SetEntProp(attacker, Prop_Send, "m_ArmorValue", AddArmorToPlayer(attackerAP, knifed, headshot, naded, decoy, inferno), 1); } @@ -430,9 +406,51 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca if (tactical) GivePlayerItem(attacker, "weapon_tagrenade"); } + + /* We rang the bell, let's not be annoying... */ + bool rung = false; + + /* Display the damage text done to players. */ + if (g_cvDM_display_damage_text.BoolValue || (g_cvDM_display_damage_text_allow_client.BoolValue && g_bDamageText[attacker])) + CPrintToChat(attacker, "{default}[{darkred}KILL{default}] %t {red}%i{default} %t {purple}%N{default} %t.", "Display Damage Giver", g_iDamageDone[attacker][victim], "Display Damage Taker", victim, "Display Damage Hits", g_iDamageDoneHits[attacker][victim]); + + if (g_cvDM_sounds_bell_kill.BoolValue || (g_cvDM_sounds_bell_kill_allow_client.BoolValue && g_bBellKill[attacker])) + { + ClientCommand(attacker, "playgamesound training/bell_normal.wav"); + rung = true; + } + else if (!rung && headshot) + { + /* Yeah Todd, this is Liquid ring-a-ding-dinging. */ + if (g_cvDM_sounds_bell_headshot.BoolValue || (g_cvDM_sounds_bell_headshot_allow_client.BoolValue && g_bBellHeadshot[attacker])) + ClientCommand(attacker, "playgamesound training/bell_normal.wav"); + } + } + + if (IsValidClient(victim, false) && victim != attacker) + { + /* Display the damage text done to players. */ + if (g_cvDM_display_damage_text.BoolValue || (g_cvDM_display_damage_text_allow_client.BoolValue && g_bDamageText[victim])) + { + int health = 0; + if (IsValidClient(attacker, true)) + health = GetClientHealth(attacker); + if (g_iDamageDoneHits[victim][attacker] > 0) + CPrintToChat(victim, "{default}[{darkred}DEATH{default}] %t {red}%i{default} %t {purple}%N{default} %t. %t {green}%i{default}.", "Display Damage Giver", g_iDamageDone[victim][attacker], "Display Damage Taker", attacker, "Display Damage Hits", g_iDamageDoneHits[victim][attacker], "Display Health Remaining", health); + else + CPrintToChat(victim, "{default}[{darkred}DEATH{default}] %t {purple}%N{default}.", "Display Damage None", attacker); + } } + + /* Reset all damage and hits so stats do not overlap. */ + g_iDamageDone[attacker][victim] = 0; + g_iDamageDoneHits[attacker][victim] = 0; + g_iDamageDone[victim][attacker] = 0; + g_iDamageDoneHits[victim][attacker] = 0; + /* Remove and respawn victim. */ - UpdateSpawnPoints(); + Spawns_UpdateSpawnPoints(); + if (g_cvDM_respawn.BoolValue) CreateTimer(g_cvDM_respawn_time.FloatValue, Timer_Respawn, GetClientSerial(victim)); if (g_cvDM_remove_ragdoll.BoolValue) @@ -441,54 +459,13 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca return Plugin_Continue; } -int AddHealthToPlayer(int attackerHP, bool knifed, bool headshot, bool naded, bool decoy, bool inferno) -{ - int addHP; - - if (knifed) - addHP = g_cvDM_hp_knife.IntValue; - else if (headshot) - addHP = g_cvDM_hp_headshot.IntValue; - else if (naded || decoy || inferno) - addHP = g_cvDM_hp_nade.IntValue; - else - addHP = g_cvDM_hp_kill.IntValue; - - int newHP = attackerHP + addHP; - - if (newHP > g_cvDM_hp_max.IntValue) - newHP = g_cvDM_hp_max.IntValue; - - return newHP; -} - -int AddArmorToPlayer(int attackerAP, bool knifed, bool headshot, bool naded, bool decoy, bool inferno) -{ - int addAP; - - if (knifed) - addAP = g_cvDM_ap_knife.IntValue; - else if (headshot) - addAP = g_cvDM_ap_headshot.IntValue; - else if (naded || decoy || inferno) - addAP = g_cvDM_ap_nade.IntValue; - else - addAP = g_cvDM_ap_kill.IntValue; - - int newAP = attackerAP + addAP; - - if (newAP > g_cvDM_ap_max.IntValue) - newAP = g_cvDM_ap_max.IntValue; - - return newAP; -} - public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue) { int victim = GetClientOfUserId(event.GetInt("userid")); int attacker = GetClientOfUserId(event.GetInt("attacker")); + int vhealth = GetClientHealth(victim); int dhealth = event.GetInt("dmg_health"); int darmor = event.GetInt("dmg_armor"); int health = event.GetInt("health"); @@ -496,23 +473,20 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas if (attacker && attacker != victim && victim != 0 && !IsFakeClient(attacker)) { - char cCookie[24]; - GetClientCookie(attacker, g_hDamage_Panel_Cookie, cCookie, sizeof(cCookie)); - g_bDamagePanel[attacker] = view_as(StringToInt(cCookie)); - GetClientCookie(attacker, g_hDamage_Popup_Cookie, cCookie, sizeof(cCookie)); - g_bDamagePopup[attacker] = view_as(StringToInt(cCookie)); - GetClientCookie(attacker, g_hDamage_Text_Cookie, cCookie, sizeof(cCookie)); - g_bDamageText[attacker] = view_as(StringToInt(cCookie)); - - if (g_cvDM_display_damage_panel.BoolValue && g_bDamagePanel[attacker]) + /* Tap the bell on a successful hit. */ + if (g_cvDM_sounds_bell_hit.BoolValue || (g_cvDM_sounds_bell_hit_allow_client.BoolValue && g_bBellHit[attacker])) + ClientCommand(attacker, "playgamesound training/bell_normal.wav"); + + if (g_cvDM_display_damage_text.BoolValue || (g_cvDM_display_damage_text_allow_client.BoolValue && g_bDamageText[attacker])) { - if (health > 0) - PrintHintText(attacker, "%t %i %t %N\n%t %i", "Display Damage Giver", dhealth, "Display Damage Taker", victim, "Display Health Remaining", health); - else if (health <= 0) - PrintHintText(attacker, "%t %i %t %N\n%t %i\n%t", "Display Damage Giver", dhealth, "Display Damage Taker", victim, "Display Health Remaining", health, "Display Kill Confirmed"); + if (health == 0) + dhealth += vhealth; + + g_iDamageDone[attacker][victim] += dhealth; + g_iDamageDoneHits[attacker][victim]++; } - if (g_cvDM_display_damage_popup.BoolValue && g_bDamagePopup[attacker]) + if (g_cvDM_display_damage_popup.BoolValue || (g_cvDM_display_damage_popup_allow_client.BoolValue && g_bDamagePopup[attacker])) { int textsize; char sColor[16]; @@ -521,12 +495,11 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas float position[3]; float clientEye[3]; float clientAngles[3]; + int entity = CreateEntityByName("point_worldtext"); GetClientEyePosition(attacker, clientEye); GetClientEyeAngles(attacker, clientAngles); TR_TraceRayFilter(clientEye, clientAngles, MASK_SOLID, RayType_Infinite, TraceEntityFilterHitSelf, attacker); - if (TR_DidHit(INVALID_HANDLE)) - TR_GetEndPosition(position); - int entity = CreateEntityByName("point_worldtext"); + if (TR_DidHit(INVALID_HANDLE)) TR_GetEndPosition(position); if (entity != -1) { @@ -560,23 +533,23 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas } } - if (g_cvDM_display_damage_text.BoolValue && g_bDamageText[attacker]) + if (g_cvDM_display_damage_text.BoolValue || (g_cvDM_display_damage_text_allow_client.BoolValue && g_bDamageText[attacker])) { if (health > 0) - CPrintToChat(attacker, "%t {red}%i{default} %t {purple}%N{default}. %t {green}%i{default}.", "Display Damage Giver", dhealth, "Display Damage Taker", victim, "Display Health Remaining", health); + CPrintToChat(attacker, "%t %t {red}%i{default} %t {purple}%N{default}. %t {green}%i{default}.", "Chat Tag", "Display Damage Giver", dhealth, "Display Damage Taker", victim, "Display Health Remaining", health); else if (health <= 0) - CPrintToChat(attacker, "%t {red}%i{default} %t {purple}%N{default}. %t {green}%i{default}. %t", "Display Damage Giver", dhealth, "Display Damage Taker", victim, "Display Health Remaining", health, "Display Kill Confirmed"); + CPrintToChat(attacker, "%t %t {red}%i{default} %t {purple}%N{default}. %t {green}%i{default}. %t", "Chat Tag", "Display Damage Giver", dhealth, "Display Damage Taker", victim, "Display Health Remaining", health, "Display Kill Confirmed"); } } - if (g_cvDM_headshot_only.BoolValue || ((attacker && g_bHSOnlyClient[attacker]) && g_cvDM_headshot_only_allow_client.BoolValue)) + if (g_cvDM_headshot_only.BoolValue || (g_cvDM_headshot_only_allow_client.BoolValue && g_bHSOnlyClient[attacker])) { char weapon[32]; event.GetString("weapon", weapon, sizeof(weapon)); if (!g_cvDM_headshot_only_allow_nade.BoolValue) { - if (StrEqual(weapon, "hegrenade", false)) + if (strcmp(weapon, "hegrenade", false) == 0) { if (attacker != victim && victim != 0) { @@ -592,7 +565,7 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas if (!g_cvDM_headshot_only_allow_taser.BoolValue) { - if (StrEqual(weapon, "taser", false)) + if (strcmp(weapon, "taser", false) == 0) { if (attacker != victim && victim != 0) { @@ -607,7 +580,7 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas if (!g_cvDM_headshot_only_allow_knife.BoolValue) { - if (StrEqual(weapon, "knife", false)) + if (strcmp(weapon, "knife", false) == 0) { if (attacker != victim && victim != 0) { @@ -636,7 +609,7 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas return Plugin_Continue; } - +/* Event check for bomb_drop, if enabled will remove bomb. */ public void Event_BombDropped(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_remove_objectives.BoolValue) @@ -644,11 +617,12 @@ public void Event_BombDropped(Event event, const char[] name, bool dontBroadcast char entityName[24]; int entity = GetClientOfUserId(event.GetInt("entindex")); GetEntityClassname(entity, entityName, sizeof(entityName)); - if (StrEqual(entityName, "weapon_c4")) + if (strcmp(entityName, "weapon_c4") == 0) RemoveEntity(entity); } } +/* Event check for bomb_pickup, if enabled will remove bomb. */ public void Event_BombPickup(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_remove_objectives.BoolValue) @@ -658,18 +632,23 @@ public void Event_BombPickup(Event event, const char[] name, bool dontBroadcast) } } +/* Event check for weapon_fire, if enabled will look for weapon_taser. +* This is the best method to check for the use of the taser. +* If the result is true we can make sure to give a new one if requested. */ public Action Event_WeaponFire(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue) { - int client = GetClientOfUserId(event.GetInt("userid")); char weapon[64]; + int client = GetClientOfUserId(event.GetInt("userid")); event.GetString("weapon", weapon, sizeof(weapon)); - if (StrEqual(weapon, "weapon_taser")) + if (strcmp(weapon, "weapon_taser") == 0) g_bPlayerHasZeus[client] = false; } } +/* Event check for weapon_fire_on_empty, +* if enabled we issue a reload if that method is enabled. */ public Action Event_WeaponFireOnEmpty(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_ammo_empty.BoolValue) @@ -679,122 +658,229 @@ public Action Event_WeaponFireOnEmpty(Event event, const char[] name, bool dontB } } +/* Event check for hegrenade_detonate, +* if enabled we issue a reload if that method is enabled. */ public Action Event_HegrenadeDetonate(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_hegrenade"); } return Plugin_Continue; } +/* Event check for smokegrenade_detonate, +* if enabled we issue a reload if that method is enabled. */ public Action Event_SmokegrenadeDetonate(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_smokegrenade"); } return Plugin_Continue; } +/* Event check for tagrenade_detonate, +* if enabled we issue a reload if that method is enabled. */ public Action Event_TagrenadeDetonate(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_tagrenade"); } return Plugin_Continue; } +/* Event check for flashbang_detonate, +* if enabled we issue a reload if that method is enabled. */ public Action Event_FlashbangDetonate(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_flashbang"); } return Plugin_Continue; } +/* Event check for decoy_started, +* if enabled we issue a reload if that method is enabled. */ public Action Event_DecoyStarted(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_decoy"); } return Plugin_Continue; } +/* Event check for molotov_detonate, +* if enabled we issue a reload if that method is enabled. */ public Action Event_MolotovDetonate(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_molotov"); } return Plugin_Continue; } +/* Event check for inferno_startburn, +* if enabled we issue a reload if that method is enabled. */ public Action Event_InfernoStartburn(Event event, const char[] name, bool dontBroadcast) { if (g_cvDM_enabled.BoolValue && g_cvDM_replenish_grenade.BoolValue) { int client = GetClientOfUserId(event.GetInt("userid")); - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) GivePlayerItem(client, "weapon_incgrenade"); } return Plugin_Continue; } -public Action Event_Sound(int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags) +/* Event check for sound, this is important to block unnecessary +* or blocked sounds. This can also supposedly improve FPS... */ +public Action Event_NormalSound(int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH], int &client, int &channel, float &volume, int &level, int &pitch, int &flags, char soundEntry[PLATFORM_MAX_PATH], int &seed) { if (g_cvDM_enabled.BoolValue) { - int client; - if ((entity > 0) && (entity <= MaxClients)) - client = entity; + bool validClient = false; + if (IsValidClient(client, true)) + validClient = true; + /* Block all sounds originating from players not yet moved. */ + if (validClient && !g_bPlayerMoved[client]) + return Plugin_Changed; /* Block ammo pickup sounds. */ if (StrContains(sample, "pickup") != -1) return Plugin_Stop; + if (StrContains(sample, "null") != -1) + return Plugin_Stop; + + if (StrContains(sample, "respawn") != -1) + return Plugin_Stop; + + if (g_cvDM_free_for_all.BoolValue) + { + if (StrContains(sample, "friendlyfire") != -1) + return Plugin_Changed; + } + + if (g_cvDM_sounds_deaths.BoolValue) + { + if (StrContains(sample, "death") != -1) + return Plugin_Changed; + } + else if (validClient) + { + if ((g_cvDM_sounds_deaths_allow_client && g_bSoundDeaths[client]) && StrContains(sample, "death") != -1) + return Plugin_Changed; + } + + if (g_cvDM_sounds_bodyshots.BoolValue) + { + if (StrContains(sample, "physics/body") != -1 || StrContains(sample, "flesh") != -1 || StrContains(sample, "kevlar") != -1) + return Plugin_Changed; + } + else if (validClient) + { + if ((g_cvDM_sounds_bodyshots_allow_client && g_bSoundBodyShots[client]) && StrContains(sample, "physics/body") != -1 || StrContains(sample, "flesh") != -1 || StrContains(sample, "kevlar") != -1) + return Plugin_Changed; + } + + if (g_cvDM_sounds_headshots.BoolValue) + { + if (StrContains(sample, "flesh_bloody") != -1 || StrContains(sample, "bhit_helmet") != -1 || StrContains(sample, "headshot") != -1) + return Plugin_Changed; + } + else if (validClient) + { + if ((g_cvDM_sounds_headshots_allow_client && g_bSoundHSShots[client]) && StrContains(sample, "flesh_bloody") != -1 || StrContains(sample, "bhit_helmet") != -1 || StrContains(sample, "headshot") != -1) + return Plugin_Changed; + } + } + return Plugin_Continue; +} + +/* Event check for sound, this is important to block unnecessary +* or blocked sounds. This can also supposedly improve FPS... */ +public Action Event_AmbientSound(char sample[PLATFORM_MAX_PATH], int& client, float& volume, int& level, int& pitch, float pos[3], int& flags, float& delay) +{ + if (g_cvDM_enabled.BoolValue) + { + bool validClient = false; + if (IsValidClient(client, true)) + validClient = true; /* Block all sounds originating from players not yet moved. */ - if (client && !g_bPlayerMoved[client]) + if (validClient && !g_bPlayerMoved[client]) + return Plugin_Changed; + + /* Block ammo pickup sounds. */ + if (StrContains(sample, "pickup") != -1) + return Plugin_Stop; + + if (StrContains(sample, "null") != -1) + return Plugin_Stop; + + if (StrContains(sample, "respawn") != -1) return Plugin_Stop; if (g_cvDM_free_for_all.BoolValue) { if (StrContains(sample, "friendlyfire") != -1) - return Plugin_Stop; + return Plugin_Changed; + } + + if (g_cvDM_sounds_deaths.BoolValue) + { + if (StrContains(sample, "death") != -1) + return Plugin_Changed; + } + else if (validClient) + { + if ((g_cvDM_sounds_deaths_allow_client && g_bSoundDeaths[client]) && StrContains(sample, "death") != -1) + return Plugin_Changed; } - if (!g_cvDM_sounds_headshots.BoolValue) + if (g_cvDM_sounds_bodyshots.BoolValue) + { + if (StrContains(sample, "physics/body") != -1 || StrContains(sample, "flesh") != -1 || StrContains(sample, "kevlar") != -1) + return Plugin_Changed; + } + else if (validClient) { - if (StrContains(sample, "physics/flesh/flesh_bloody") != -1 || StrContains(sample, "player/bhit_helmet") != -1 || StrContains(sample, "player/headshot") != -1) - return Plugin_Stop; + if ((g_cvDM_sounds_bodyshots_allow_client && g_bSoundBodyShots[client]) && StrContains(sample, "physics/body") != -1 || StrContains(sample, "flesh") != -1 || StrContains(sample, "kevlar") != -1) + return Plugin_Changed; } - if (!g_cvDM_sounds_bodyshots.BoolValue) + if (g_cvDM_sounds_headshots.BoolValue) + { + if (StrContains(sample, "flesh_bloody") != -1 || StrContains(sample, "bhit_helmet") != -1 || StrContains(sample, "headshot") != -1) + return Plugin_Changed; + } + else if (validClient) { - if (StrContains(sample, "physics/body") != -1 || StrContains(sample, "physics/flesh") != -1 || StrContains(sample, "player/kevlar") != -1) - return Plugin_Stop; + if ((g_cvDM_sounds_headshots_allow_client && g_bSoundHSShots[client]) && StrContains(sample, "flesh_bloody") != -1 || StrContains(sample, "bhit_helmet") != -1 || StrContains(sample, "headshot") != -1) + return Plugin_Changed; } } return Plugin_Continue; @@ -803,8 +889,8 @@ public Action Event_Sound(int clients[64], int &numClients, char sample[PLATFORM public void OnEntityCreated(int entity, const char[] classname) { if (g_cvDM_remove_chickens.BoolValue) - if (StrEqual(classname, "chicken")) - AcceptEntityInput(entity, "kill"); + if (strcmp(classname, "chicken") == 0) + RemoveEntity(entity); } public Action Event_TextMsg(UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init) @@ -822,50 +908,48 @@ public Action Event_TextMsg(UserMsg msg_id, BfRead msg, const int[] players, int static char cashTriggers[][] = { - "#Team_Cash_Award_Win_Hostages_Rescue", - "#Team_Cash_Award_Win_Defuse_Bomb", - "#Team_Cash_Award_Win_Time", - "#Team_Cash_Award_Elim_Bomb", - "#Team_Cash_Award_Elim_Hostage", - "#Team_Cash_Award_T_Win_Bomb", - "#Player_Point_Award_Assist_Enemy_Plural", - "#Player_Point_Award_Assist_Enemy", - "#Player_Point_Award_Killed_Enemy_Plural", - "#Player_Point_Award_Killed_Enemy", - "#Player_Cash_Award_Kill_Hostage", - "#Player_Cash_Award_Damage_Hostage", - "#Player_Cash_Award_Get_Killed", - "#Player_Cash_Award_Respawn", - "#Player_Cash_Award_Interact_Hostage", - "#Player_Cash_Award_Killed_Enemy", - "#Player_Cash_Award_Rescued_Hostage", - "#Player_Cash_Award_Bomb_Defused", - "#Player_Cash_Award_Bomb_Planted", - "#Player_Cash_Award_Killed_Enemy", - "#Player_Cash_Award_Killed_Enemy_Generic", - "#Player_Cash_Award_Killed_VIP", - "#Player_Cash_Award_Kill_Teammate", - "#Team_Cash_Award_Win_Hostage_Rescue", - "#Team_Cash_Award_Loser_Bonus", - "#Team_Cash_Award_Loser_Zero", - "#Team_Cash_Award_Rescued_Hostage", - "#Team_Cash_Award_Hostage_Interaction", - "#Team_Cash_Award_Hostage_Alive", - "#Team_Cash_Award_Planted_Bomb_But_Defused", - "#Team_Cash_Award_CT_VIP_Escaped", - "#Team_Cash_Award_T_VIP_Killed", - "#Team_Cash_Award_no_income", - "#Team_Cash_Award_Generic", - "#Team_Cash_Award_Custom", - "#Team_Cash_Award_no_income_suicide", - "#Player_Cash_Award_ExplainSuicide_YouGotCash", - "#Player_Cash_Award_ExplainSuicide_TeammateGotCash", - "#Player_Cash_Award_ExplainSuicide_EnemyGotCash", - "#Player_Cash_Award_ExplainSuicide_Spectators" + "Player_Cash_Award_Bomb_Defused", + "Player_Cash_Award_Bomb_Planted", + "Player_Cash_Award_Damage_Hostage", + "Player_Cash_Award_ExplainSuicide_EnemyGotCash", + "Player_Cash_Award_ExplainSuicide_Spectators", + "Player_Cash_Award_ExplainSuicide_TeammateGotCash", + "Player_Cash_Award_ExplainSuicide_YouGotCash", + "Player_Cash_Award_Get_Killed", + "Player_Cash_Award_Interact_Hostage", + "Player_Cash_Award_Kill_Hostage", + "Player_Cash_Award_Kill_Teammate", + "Player_Cash_Award_Killed_Enemy", + "Player_Cash_Award_Killed_Enemy_Generic", + "Player_Cash_Award_Killed_VIP", + "Player_Cash_Award_Rescued_Hostage", + "Player_Cash_Award_Respawn", + "Team_Cash_Award_Bonus_Shorthanded", + "Team_Cash_Award_CT_VIP_Escaped", + "Team_Cash_Award_Custom", + "Team_Cash_Award_Elim_Bomb", + "Team_Cash_Award_Elim_Hostage", + "Team_Cash_Award_Generic", + "Team_Cash_Award_Hostage_Alive", + "Team_Cash_Award_Hostage_Interaction", + "Team_Cash_Award_Loser_Bonus", + "Team_Cash_Award_Loser_Bonus_Neg", + "Team_Cash_Award_Loser_Zero", + "Team_Cash_Award_no_income", + "Team_Cash_Award_no_income_suicide", + "Team_Cash_Award_Planted_Bomb_But_Defused", + "Team_Cash_Award_Rescued_Hostage", + "Team_Cash_Award_Survive_GuardianMode_Wave", + "Team_Cash_Award_T_VIP_Killed", + "Team_Cash_Award_T_Win_Bomb", + "Team_Cash_Award_Win_Defuse_Bomb", + "Team_Cash_Award_Win_Hostage_Rescue", + "Team_Cash_Award_Win_Hostages_Rescue", + "Team_Cash_Award_Win_Time" }; for (int i = 0; i < sizeof(cashTriggers); i++) { - if (StrEqual(text, cashTriggers[i])) + if (strcmp(text, cashTriggers[i]) == 0) return Plugin_Handled; } } @@ -941,7 +1025,7 @@ public Action Event_RadioText(UserMsg msg_id, BfRead msg, const int[] players, i for (int i = 0; i < sizeof(grenadeTriggers); i++) { - if (StrEqual(text, grenadeTriggers[i])) + if (strcmp(text, grenadeTriggers[i]) == 0) return Plugin_Handled; } } @@ -972,9 +1056,9 @@ public Action Hook_OnTraceAttack(int victim, int &attacker, int &inflictor, floa return Plugin_Continue; else if (g_cvDM_headshot_only_allow_knife.BoolValue && (StrContains(weapon, "knife") != -1 || StrContains(weapon, "bayonet") != -1)) return Plugin_Continue; - else if (g_cvDM_headshot_only_allow_nade.BoolValue && (StrEqual(grenade, "hegrenade_projectile") || StrEqual(grenade, "decoy_projectile") || StrEqual(grenade, "molotov_projectile") || StrEqual(grenade, "tagrenade_projectile"))) + else if (g_cvDM_headshot_only_allow_nade.BoolValue && (strcmp(grenade, "hegrenade_projectile") == 0 || strcmp(grenade, "decoy_projectile") == 0 || strcmp(grenade, "molotov_projectile") == 0 || strcmp(grenade, "tagrenade_projectile") == 0)) return Plugin_Continue; - else if (g_cvDM_headshot_only_allow_taser.BoolValue && StrEqual(weapon, "weapon_taser")) + else if (g_cvDM_headshot_only_allow_taser.BoolValue && strcmp(weapon, "weapon_taser") == 0) return Plugin_Continue; else return Plugin_Handled; @@ -985,7 +1069,7 @@ public Action Hook_OnTraceAttack(int victim, int &attacker, int &inflictor, floa public Action Hook_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) { - if (!g_cvDM_enabled.BoolValue || !(0 < attacker <= MaxClients) || !IsClientInGame(attacker)) + if (!g_cvDM_enabled.BoolValue || !IsValidClient(attacker, true)) return Plugin_Continue; if (g_cvDM_remove_knife_damage.BoolValue) @@ -1010,27 +1094,23 @@ public Action Hook_OnTakeDamage(int victim, int &attacker, int &inflictor, float else return Plugin_Handled; } - if (attacker && IsClientInGame(attacker)) - { - GetEdictClassname(inflictor, grenade, sizeof(grenade)); - GetClientWeapon(attacker, weapon, sizeof(weapon)); - if (damagetype & DMG_HEADSHOT) + GetEdictClassname(inflictor, grenade, sizeof(grenade)); + GetClientWeapon(attacker, weapon, sizeof(weapon)); + + if (damagetype & DMG_HEADSHOT) + return Plugin_Continue; + else + { + if (g_cvDM_headshot_only_allow_knife.BoolValue && (StrContains(weapon, "knife") != -1 || StrContains(weapon, "bayonet") != -1)) + return Plugin_Continue; + else if (g_cvDM_headshot_only_allow_nade.BoolValue && (strcmp(grenade, "hegrenade_projectile") == 0 || strcmp(grenade, "decoy_projectile") == 0 || strcmp(grenade, "molotov_projectile") == 0 || strcmp(grenade, "tagrenade_projectile") == 0)) + return Plugin_Continue; + else if (g_cvDM_headshot_only_allow_taser.BoolValue && strcmp(weapon, "weapon_taser") == 0) return Plugin_Continue; else - { - if (g_cvDM_headshot_only_allow_knife.BoolValue && (StrContains(weapon, "knife") != -1 || StrContains(weapon, "bayonet") != -1)) - return Plugin_Continue; - else if (g_cvDM_headshot_only_allow_nade.BoolValue && (StrEqual(grenade, "hegrenade_projectile") || StrEqual(grenade, "decoy_projectile") || StrEqual(grenade, "molotov_projectile") || StrEqual(grenade, "tagrenade_projectile"))) - return Plugin_Continue; - else if (g_cvDM_headshot_only_allow_taser.BoolValue && StrEqual(weapon, "weapon_taser")) - return Plugin_Continue; - else - return Plugin_Handled; - } + return Plugin_Handled; } - else - return Plugin_Handled; } else return Plugin_Handled; @@ -1053,21 +1133,21 @@ public Action Hook_OnWeaponEquip(int client, int weapon) { char weaponName[64]; GetEntityClassname(weapon, weaponName, sizeof(weaponName)); - if (StrEqual(weaponName, "weapon_healthshot") && !g_cvDM_healthshot.BoolValue) + if (strcmp(weaponName, "weapon_healthshot") == 0 && !g_cvDM_healthshot.BoolValue) { RemovePlayerItem(client, weapon); RemoveEntity(weapon); ClientCommand(client, "lastinv"); return Plugin_Continue } - if (StrEqual(weaponName, "weapon_taser") && !g_cvDM_zeus.BoolValue) + if (strcmp(weaponName, "weapon_taser") == 0 && !g_cvDM_zeus.BoolValue) { RemovePlayerItem(client, weapon); RemoveEntity(weapon); ClientCommand(client, "lastinv"); return Plugin_Continue } - if (StrEqual(weaponName, "weapon_c4") && g_cvDM_remove_objectives.BoolValue) + if (strcmp(weaponName, "weapon_c4") == 0 && g_cvDM_remove_objectives.BoolValue) { RemovePlayerItem(client, weapon); RemoveEntity(weapon); @@ -1082,11 +1162,11 @@ public Action Hook_OnWeaponSwitch(int client, int weapon) bool removeWeapon = false; char weaponName[64]; GetEntityClassname(weapon, weaponName, sizeof(weaponName)); - if (StrEqual(weaponName, "weapon_healthshot") && !g_cvDM_healthshot.BoolValue) + if (strcmp(weaponName, "weapon_healthshot") == 0 && !g_cvDM_healthshot.BoolValue) removeWeapon = true; - else if (StrEqual(weaponName, "weapon_taser") && !g_cvDM_zeus.BoolValue) + else if (strcmp(weaponName, "weapon_taser") == 0 && !g_cvDM_zeus.BoolValue) removeWeapon = true; - else if (StrEqual(weaponName, "weapon_c4") && g_cvDM_remove_objectives.BoolValue) + else if (strcmp(weaponName, "weapon_c4") == 0 && g_cvDM_remove_objectives.BoolValue) removeWeapon = true; if (removeWeapon) { @@ -1112,7 +1192,7 @@ public void SetEntFlags(int entity) SetEdictFlags(entity, (GetEdictFlags(entity) ^ FL_EDICT_ALWAYS)); } -public Action TE_OnEffectDispatch(const char[] te_name, const Players[], int numClients, float delay) +public Action TE_EffectDispatch(const char[] te_name, const Players[], int numClients, float delay) { if (!g_cvDM_remove_blood_player.BoolValue) return Plugin_Continue; @@ -1123,20 +1203,20 @@ public Action TE_OnEffectDispatch(const char[] te_name, const Players[], int num GetEffectName(iEffectIndex, sEffectName, sizeof(sEffectName)); - if (StrEqual(sEffectName, "csblood") || StrEqual(sEffectName, "Impact")) + if (strcmp(sEffectName, "csblood") == 0 || strcmp(sEffectName, "Impact") == 0) return Plugin_Handled; - if (StrEqual(sEffectName, "ParticleEffect")) + if (strcmp(sEffectName, "ParticleEffect") == 0) { char sParticleEffectName[64]; GetParticleEffectName(nHitBox, sParticleEffectName, sizeof(sParticleEffectName)); - if(StrEqual(sParticleEffectName, "impact_helmet_headshot")) + if (strcmp(sParticleEffectName, "impact_helmet_headshot") == 0) return Plugin_Handled; } return Plugin_Continue; } -public Action TE_OnWorldDecal(const char[] te_name, const Players[], int numClients, float delay) +public Action TE_WorldDecal(const char[] te_name, const Players[], int numClients, float delay) { if (!g_cvDM_remove_blood_walls.BoolValue) return Plugin_Continue; @@ -1154,6 +1234,94 @@ public Action TE_OnWorldDecal(const char[] te_name, const Players[], int numClie return Plugin_Continue; } +/* This code was taken from csgo-multi-1v1 by splewis. +If this does not work as it should... Well, you know who +to bla(me)! - https://github.com/splewis/csgo-multi-1v1 */ +public Action TE_ShotgunShot(const char[] te_name, const int[] players, int numClients, float delay) +{ + if (!g_cvDM_sounds_gunshots.BoolValue) + return Plugin_Continue; + + int shooterIndex = TE_ReadNum("m_iPlayer") + 1; + + int[] newClients = new int[MaxClients]; + int newTotal = 0; + + for (int i = 0; i < numClients; i++) + { + int client = players[i]; + bool rebroadcast = true; + + if (!IsValidClient(client, true)) + rebroadcast = true; + else + rebroadcast = CanHear(shooterIndex, client); + + if (rebroadcast) + { + // This Client should be able to hear it. + newClients[newTotal] = client; + newTotal++; + } + } + + // No clients were excluded. + if (newTotal == numClients) + return Plugin_Continue; + + // All clients were excluded and there is no need to broadcast. + if (newTotal == 0) + return Plugin_Stop; + + // Re-broadcast to clients that still need it. + float vTemp[3]; + TE_Start("Shotgun Shot"); + TE_ReadVector("m_vecOrigin", vTemp); + TE_WriteVector("m_vecOrigin", vTemp); + TE_WriteFloat("m_vecAngles[0]", TE_ReadFloat("m_vecAngles[0]")); + TE_WriteFloat("m_vecAngles[1]", TE_ReadFloat("m_vecAngles[1]")); + TE_WriteNum("m_weapon", TE_ReadNum("m_weapon")); + TE_WriteNum("m_iMode", TE_ReadNum("m_iMode")); + TE_WriteNum("m_iSeed", TE_ReadNum("m_iSeed")); + TE_WriteNum("m_iPlayer", TE_ReadNum("m_iPlayer")); + TE_WriteFloat("m_fInaccuracy", TE_ReadFloat("m_fInaccuracy")); + TE_WriteFloat("m_fSpread", TE_ReadFloat("m_fSpread")); + TE_Send(newClients, newTotal, delay); + + return Plugin_Stop; +} + +public bool CanHear(int shooter, int client) +{ + if (!IsValidClient(shooter, true) || !IsValidClient(client, true) || shooter == client) + return true; + + if (!g_cvDM_sounds_gunshots_allow_client.BoolValue || !g_bSoundGunShots[client]) + return true; + + char area1[128]; + char area2[128]; + + GetEntPropString(shooter, Prop_Send, "m_szLastPlaceName", area1, sizeof(area1)); + GetEntPropString(client, Prop_Send, "m_szLastPlaceName", area2, sizeof(area2)); + + // Block the transmisson. + if (!StrEqual(area1, area2)) + { + float shooterPos[3]; + float clientPos[3]; + GetClientAbsOrigin(shooter, shooterPos); + GetClientAbsOrigin(client, clientPos); + float distance = GetVectorDistance(shooterPos, clientPos); + + if (distance >= g_cvDM_sounds_gunshots_distance.FloatValue) + return false; + } + + // Transmit by default. + return true; +} + public bool TraceEntityFilterHitSelf(int entity, int contentsMask, any data) { if (entity == data) return false; @@ -1177,7 +1345,6 @@ public Action Timer_KillText(Handle timer, int ref) stock int GetParticleEffectName(int index, char[] sEffectName, int maxlen) { int table = INVALID_STRING_TABLE; - if (table == INVALID_STRING_TABLE) table = FindStringTable("ParticleEffectNames"); @@ -1187,7 +1354,6 @@ stock int GetParticleEffectName(int index, char[] sEffectName, int maxlen) stock int GetEffectName(int index, char[] sEffectName, int maxlen) { int table = INVALID_STRING_TABLE; - if (table == INVALID_STRING_TABLE) table = FindStringTable("EffectDispatch"); @@ -1202,4 +1368,46 @@ stock int GetDecalName(int index, char[] sDecalName, int maxlen) table = FindStringTable("decalprecache"); return ReadStringTable(table, index, sDecalName, maxlen); +} + +stock int AddHealthToPlayer(int attackerHP, bool knifed, bool headshot, bool naded, bool decoy, bool inferno) +{ + int addHP; + + if (knifed) + addHP = g_cvDM_hp_knife.IntValue; + else if (headshot) + addHP = g_cvDM_hp_headshot.IntValue; + else if (naded || decoy || inferno) + addHP = g_cvDM_hp_nade.IntValue; + else + addHP = g_cvDM_hp_kill.IntValue; + + int newHP = attackerHP + addHP; + + if (newHP > g_cvDM_hp_max.IntValue) + newHP = g_cvDM_hp_max.IntValue; + + return newHP; +} + +stock int AddArmorToPlayer(int attackerAP, bool knifed, bool headshot, bool naded, bool decoy, bool inferno) +{ + int addAP; + + if (knifed) + addAP = g_cvDM_ap_knife.IntValue; + else if (headshot) + addAP = g_cvDM_ap_headshot.IntValue; + else if (naded || decoy || inferno) + addAP = g_cvDM_ap_nade.IntValue; + else + addAP = g_cvDM_ap_kill.IntValue; + + int newAP = attackerAP + addAP; + + if (newAP > g_cvDM_ap_max.IntValue) + newAP = g_cvDM_ap_max.IntValue; + + return newAP; } \ No newline at end of file diff --git a/scripting/deathmatch/frames.sp b/scripting/deathmatch/frames.sp index 1f6fa69..602cbfe 100644 --- a/scripting/deathmatch/frames.sp +++ b/scripting/deathmatch/frames.sp @@ -1,19 +1,7 @@ -public void Frame_RespawnDead(any serial) -{ - int client = GetClientFromSerial(serial); - if (!g_bRoundEnded && client && (GetClientTeam(client) > CS_TEAM_SPECTATOR) && !IsPlayerAlive(client)) - { - UpdateSpawnPoints(); - g_bPlayerMoved[client] = false; - CS_RespawnPlayer(client); - CPrintToChat(client, "%t %t", "Chat Tag", "Player Respawn"); - } -} - public void Frame_RespawnAll(any serial) { int client = GetClientFromSerial(serial); - if (client && IsClientInGame(client) && (GetClientTeam(client) > CS_TEAM_SPECTATOR)) + if (IsValidClient(client, true) && GetClientTeam(client) > CS_TEAM_SPECTATOR) { g_bPlayerMoved[client] = false; CS_RespawnPlayer(client); @@ -24,7 +12,7 @@ public void Frame_RespawnAll(any serial) public void Frame_FastSwitch(any serial) { int client = GetClientFromSerial(serial); - if (client && IsClientInGame(client) && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) { char weapon[64]; GetClientWeapon(client, weapon, sizeof(weapon)); @@ -42,14 +30,14 @@ public void Frame_FastSwitch(any serial) public void Frame_RemoveRadar(any serial) { int client = GetClientFromSerial(serial); - if (client && IsClientInGame(client) && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) SetEntProp(client, Prop_Send, "m_iHideHUD", HIDEHUD_RADAR); } public void Frame_GiveAmmo(any serial) { int client = GetClientFromSerial(serial) - if (client && IsClientInGame(client) && !IsFakeClient(client) && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) { int weaponEntity; switch (g_cvDM_replenish_ammo_type.IntValue) @@ -91,7 +79,7 @@ public void Frame_GiveAmmo(any serial) public void Frame_GiveAmmoHS(any serial) { int client = GetClientFromSerial(serial) - if (client && IsClientInGame(client) && !IsFakeClient(client) && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client)) { int weaponEntity; switch (g_cvDM_replenish_ammo_hs_type.IntValue) @@ -135,7 +123,7 @@ public void Frame_GiveHealthshot(any serial) if (g_cvDM_healthshot.BoolValue) { int client = GetClientFromSerial(serial) - if (client && (g_iHealthshotCount[client] < g_cvDM_healthshot_total.IntValue) && !IsFakeClient(client) && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client) && (g_iHealthshotCount[client] < g_cvDM_healthshot_total.IntValue)) { GivePlayerItem(client, "weapon_healthshot"); g_iHealthshotCount[client] += 1; @@ -148,10 +136,17 @@ public void Frame_GiveTaser(any serial) if (g_cvDM_zeus.BoolValue) { int client = GetClientFromSerial(serial) - if (client && IsClientInGame(client) && !g_bPlayerHasZeus[client] && !IsFakeClient(client) && IsPlayerAlive(client)) + if (IsValidClient(client, false) && IsPlayerAlive(client) && !g_bPlayerHasZeus[client]) { GivePlayerItem(client, "weapon_taser"); g_bPlayerHasZeus[client] = true; } } +} + +public void Frame_StopSound(int serial) +{ + int client = GetClientFromSerial(serial) + if (IsValidClient(client, false) && IsPlayerAlive(client)) + StopSound(client, SNDCHAN_ITEM, "buttons/bell1.wav"); } \ No newline at end of file diff --git a/scripting/deathmatch/functions.sp b/scripting/deathmatch/functions.sp index 7376db5..73e3682 100644 --- a/scripting/deathmatch/functions.sp +++ b/scripting/deathmatch/functions.sp @@ -40,18 +40,38 @@ void State_Validate() void State_EnableDM() { + State_ResetDM(); + for (int i = 1; i <= MaxClients; i++) { - if (IsClientConnected(i)) - Client_ResetClientSettings(i); + if (!IsClientInGame(i)) + continue; + Client_ResetClientSettings(i); + g_bInfoMessage[i] = false; + g_bWelcomeMessage[i] = false; + } + + if (g_cvDM_gun_menu_mode.IntValue != 6) + { + for (int i = 1; i <= MaxClients; i++) + { + if (!IsClientInGame(i)) + continue; + if (!IsFakeClient(i)) + CancelClientMenu(i); + if (g_cvDM_gun_menu_mode.IntValue >= 4) + SetClientGunModeSettings(i); + } } + + Spawns_RespawnAll(); +} + +void State_ResetDM() +{ g_bInEditMode = false; - RespawnDead(); - char status[10]; - status = (g_cvDM_remove_objectives.BoolValue) ? "Disable" : "Enable"; - State_SetObjectives(status); - status = (g_cvDM_remove_buyzones.BoolValue) ? "Disable" : "Enable"; - State_SetBuyZones(status); + State_SetObjectives(g_cvDM_remove_objectives.BoolValue ? "Disable" : "Enable"); + State_SetBuyZones(g_cvDM_remove_buyzones.BoolValue ? "Disable" : "Enable"); State_SetGrenade(); State_SetHealthshot(); State_SetArmor(); @@ -68,49 +88,34 @@ void State_EnableDM() if (g_cvDM_remove_objectives.BoolValue) State_SetNoC4(); if (g_cvDM_free_for_all.BoolValue) - State_EnableFFA(); + State_SetFFA(); else - State_DisableFFA(); + State_RestoreFFA(); if (!g_cvDM_spawn_default.BoolValue && g_cvDM_respawn_valve.BoolValue) State_SetSpawnPoints(); - if (g_cvDM_gun_menu_mode.IntValue != 6) - { - for (int i = 1; i <= MaxClients; i++) - { - if (g_cvDM_gun_menu_mode.IntValue >= 4) - CancelClientMenu(i); - if (IsClientConnected(i)) - SetClientGunModeSettings(i); - } - } } void State_DisableDM() { for (int i = 1; i <= MaxClients; i++) { - Timer_DisableSpawnProtection(INVALID_HANDLE, i); - if (g_hCookieMenus[i] != INVALID_HANDLE) - CancelMenu(g_hCookieMenus[i]) - if (g_hWeaponsMenus[i] != INVALID_HANDLE) - CancelMenu(g_hWeaponsMenus[i]); - if (g_hPrimaryMenus[i] != INVALID_HANDLE) - CancelMenu(g_hPrimaryMenus[i]); - if (g_hSecondaryMenus[i] != INVALID_HANDLE) - CancelMenu(g_hSecondaryMenus[i]); + if (!IsClientInGame(i)) + continue; + Timer_DisableSpawnProtection(null, i); + OnClientDisconnect(i); CancelClientMenu(i); } - State_SetBuyZones("Enable"); - State_SetObjectives("Enable"); - State_RestoreSpawnPoints(); - State_RestoreSpawnWeapons(); - State_RestoreDropWeapons(); State_RestoreC4(); State_RestoreCash(); State_RestoreArmor(); State_RestoreGrenade(); State_RestoreHealthshot(); + State_RestoreDropWeapons(); + State_RestoreSpawnPoints(); + State_RestoreSpawnWeapons(); State_RestoreGrenadeRadio(); + State_SetBuyZones("Enable"); + State_SetObjectives("Enable"); } void State_SetNoCash() @@ -121,8 +126,8 @@ void State_SetNoCash() for (int i = 1; i <= MaxClients; i++) { - if (IsClientInGame(i)) - SetEntProp(i, Prop_Send, "m_iAccount", 0); + if (!IsClientInGame(i)) continue; + SetEntProp(i, Prop_Send, "m_iAccount", 0); } } @@ -134,8 +139,8 @@ void State_RestoreCash() for (int i = 1; i <= MaxClients; i++) { - if (IsClientInGame(i)) - SetEntProp(i, Prop_Send, "m_iAccount", g_iBackup_mp_startmoney); + if (!IsClientInGame(i)) continue; + SetEntProp(i, Prop_Send, "m_iAccount", g_iBackup_mp_startmoney); } } @@ -144,7 +149,7 @@ void State_SetNoChickens() char chicken = -1; while ((chicken = FindEntityByClassname(chicken, "chicken")) != -1) if (IsValidEdict(chicken)) - AcceptEntityInput(chicken, "Kill"); + RemoveEntity(chicken); } void State_SetGrenade() @@ -219,7 +224,7 @@ void State_RestoreDropWeapons() void State_SetArmor() { - g_cvMP_free_armor.SetInt(g_cvDM_armor.IntValue); + g_cvMP_free_armor.SetInt(0); g_cvMP_max_armor.SetInt(g_cvDM_armor.IntValue); } @@ -254,14 +259,14 @@ void State_SetNoSpawnWeapons() void State_RestoreSpawnWeapons() { - g_cvMP_ct_default_primary.SetString(g_cBackup_mp_ct_default_primary); - g_cvMP_t_default_primary.SetString(g_cBackup_mp_t_default_primary); - g_cvMP_ct_default_secondary.SetString(g_cBackup_mp_ct_default_secondary); - g_cvMP_t_default_secondary.SetString(g_cBackup_mp_t_default_secondary); - g_cvMP_items_prohibited.SetString(g_cBackup_mp_items_prohibited); + g_cvMP_ct_default_primary.SetString(g_sBackup_mp_ct_default_primary); + g_cvMP_t_default_primary.SetString(g_sBackup_mp_t_default_primary); + g_cvMP_ct_default_secondary.SetString(g_sBackup_mp_ct_default_secondary); + g_cvMP_t_default_secondary.SetString(g_sBackup_mp_t_default_secondary); + g_cvMP_items_prohibited.SetString(g_sBackup_mp_items_prohibited); } -void State_EnableFFA() +void State_SetFFA() { g_cvMP_teammates_are_enemies.SetInt(1); g_cvMP_friendlyfire.SetInt(1); @@ -272,7 +277,7 @@ void State_EnableFFA() g_cvFF_damage_reduction_other.SetFloat(1.0); } -void State_DisableFFA() +void State_RestoreFFA() { g_cvMP_teammates_are_enemies.SetInt(g_iBackup_mp_teammates_are_enemies); g_cvMP_friendlyfire.SetInt(g_iBackup_mp_friendlyfire); @@ -290,12 +295,10 @@ void State_SetBuyZones(const char[] status) for (int i = MaxClients + 1; i < MaxEntities; i++) { - if (IsValidEdict(i)) - { - GetEdictClassname(i, class, sizeof(class)); - if (StrEqual(class, "func_buyzone")) - AcceptEntityInput(i, status); - } + if (!IsValidEdict(i)) continue; + GetEdictClassname(i, class, sizeof(class)); + if (strcmp(class, "func_buyzone") == 0) + AcceptEntityInput(i, status); } } @@ -306,12 +309,10 @@ void State_SetObjectives(const char[] status) for (int i = MaxClients + 1; i < MaxEntities; i++) { - if (IsValidEdict(i)) - { - GetEdictClassname(i, class, sizeof(class)); - if (StrEqual(class, "func_bomb_target") || StrEqual(class, "func_hostage_rescue")) - AcceptEntityInput(i, status); - } + if (!IsValidEdict(i)) continue; + GetEdictClassname(i, class, sizeof(class)); + if (strcmp(class, "func_bomb_target") == 0 || strcmp(class, "func_hostage_rescue") == 0) + AcceptEntityInput(i, status); } } @@ -322,12 +323,10 @@ void State_SetHostages() for (int i = MaxClients + 1; i < MaxEntities; i++) { - if (IsValidEdict(i)) - { - GetEdictClassname(i, class, sizeof(class)); - if (StrEqual(class, "hostage_entity")) - RemoveEntity(i); - } + if (!IsValidEdict(i)) continue; + GetEdictClassname(i, class, sizeof(class)); + if (strcmp(class, "hostage_entity") == 0) + RemoveEntity(i); } } @@ -341,26 +340,67 @@ void State_RestoreC4() g_cvMP_give_player_c4.SetInt(g_iBackup_mp_give_player_c4); } -bool Client_StripC4(int client) +public bool Client_StripC4(int client) { - if (client && IsPlayerAlive(client)) + int entityIndex; + char entityName[64]; + if ((entityIndex = GetPlayerWeaponSlot(client, CS_SLOT_C4)) != -1) { - int entityIndex; - char entityName[64]; - if ((entityIndex = GetPlayerWeaponSlot(client, CS_SLOT_C4)) != -1) + GetEntityClassname(entityIndex, entityName, sizeof(entityName)); + if (strcmp(entityName, "weapon_c4") == 0) { - GetEntityClassname(entityIndex, entityName, sizeof(entityName)); - if (StrEqual(entityName, "weapon_c4")) - { - RemovePlayerItem(client, entityIndex); - RemoveEntity(entityIndex); - return true; - } + RemovePlayerItem(client, entityIndex); + RemoveEntity(entityIndex); + return true; } } + return false; } +void Client_SetArmor(int client) +{ + switch (g_cvDM_armor.IntValue) + { + case 0: /* Give no armor and no helmet */ + { + SetEntProp(client, Prop_Send, "m_ArmorValue", 0); + SetEntProp(client, Prop_Send, "m_bHasHelmet", 0); + } + case 1: /* Give only armor but no helmet */ + { + SetEntProp(client, Prop_Send, "m_ArmorValue", 100); + SetEntProp(client, Prop_Send, "m_bHasHelmet", 0); + } + case 2: /* Give both armor and helmet */ + { + SetEntProp(client, Prop_Send, "m_ArmorValue", 100); + SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); + } + } +} + +void Client_GiveWeaponsOrBuildMenu(int client) +{ + if (g_bRememberChoice[client] || IsFakeClient(client)) + { + switch (g_cvDM_gun_menu_mode.IntValue) + { + case 1: GiveSavedWeapons(client, true, true); /* Give normal loadout if remembered. */ + case 2: GiveSavedWeapons(client, true, false); /* Give only primary weapons if remembered. */ + case 3: GiveSavedWeapons(client, false, true); /* Give only secondary weapons if remembered. */ + case 4: GiveSavedWeapons(client, false, false); /* Give only knife weapons if remembered. */ + case 5: GiveSavedWeapons(client, true, true); /* Give normal loadout if remembered. */ + } + } + else if (!IsFakeClient(client)) + { + /* Display the gun menu to new users. */ + if (g_cvDM_gun_menu_mode.IntValue <= 3) + BuildWeaponsMenu(client); + } +} + void Client_RemoveRagdoll(int client) { if (IsValidEdict(client)) @@ -371,28 +411,12 @@ void Client_RemoveRagdoll(int client) } } -void Client_SetHSOnly(int client) -{ - char buffer[64]; - char cEnable[32]; - char cHSOnly[16]; - GetClientCookie(client, g_hHSOnly_Cookie, cHSOnly, sizeof(cHSOnly)); - g_bHSOnlyClient[client] = view_as(StringToInt(cHSOnly)); - cEnable = g_bHSOnlyClient[client] ? "Enabled" : "Disabled"; - cHSOnly = g_bHSOnlyClient[client] ? "1" : "0"; - Format(buffer, sizeof(buffer), "HS Only Client %s", cEnable); - CPrintToChat(client, "%t %t", "Chat Tag", buffer); -} - void Client_ToggleHSOnly(int client) { - g_bHSOnlyClient[client] = !g_bHSOnlyClient[client]; char buffer[64]; - char cEnable[32]; char cHSOnly[16]; - cEnable = g_bHSOnlyClient[client] ? "Enabled" : "Disabled"; - cHSOnly = g_bHSOnlyClient[client] ? "1" : "0"; - Format(buffer, sizeof(buffer), "HS Only Client %s", cEnable); + g_bHSOnlyClient[client] = !g_bHSOnlyClient[client]; + Format(buffer, sizeof(buffer), "Headshot Only %s", g_bHSOnlyClient[client] ? "Enabled" : "Disabled"); CPrintToChat(client, "%t %t", "Chat Tag", buffer); SetClientCookie(client, g_hHSOnly_Cookie, cHSOnly); } @@ -400,12 +424,41 @@ void Client_ToggleHSOnly(int client) void Client_ResetClientSettings(int client) { if (g_bInEditModeClient[client]) - DisableEditorMode(client); + Spawns_DisableEditorMode(client); g_iLastEditorSpawnPoint[client] = -1; SetClientGunModeSettings(client); - g_bInfoMessage[client] = false; g_bWeaponsGivenThisRound[client] = false; + g_bGiveFullLoadout[client] = false; g_bPlayerMoved[client] = false; g_bPlayerHasZeus[client] = false; g_iHealthshotCount[client] = 0; + if (!IsFakeClient(client)) + { + g_sPrimaryWeaponPrevious[client] = "none"; + g_sSecondaryWeaponPrevious[client] = "none"; + } + for (int i = 1; i <= MaxClients; i++) + { + g_iDamageDone[client][i] = 0; + g_iDamageDoneHits[client][i] = 0; + } +} + +void Client_ResetScoreboard(int client) +{ + SetEntProp(client, Prop_Data, "m_iFrags", 0); + SetEntProp(client, Prop_Data, "m_iDeaths", 0); + CS_SetMVPCount(client, 0); + CS_SetClientAssists(client, 0); + CS_SetClientContributionScore(client, 0); + CPrintToChat(client, "%t %t", "Chat Tag", "Reset Score"); +} + +bool IsValidClient(int client, bool bots = false) +{ + if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bots) || IsClientSourceTV(client) || IsClientReplay(client)) + { + return false; + } + return true; } \ No newline at end of file diff --git a/scripting/deathmatch/menus.sp b/scripting/deathmatch/menus.sp index e627e8e..fa792f0 100644 --- a/scripting/deathmatch/menus.sp +++ b/scripting/deathmatch/menus.sp @@ -27,11 +27,12 @@ public void OnAdminMenuReady(Handle aTopMenu) if (deathmatch_commands != INVALID_TOPMENUOBJECT) { - g_tmAdminMenu.AddItem("dm_load", AdminMenu_Load, deathmatch_commands, "dm_load", ADMFLAG_SLAY); + g_tmAdminMenu.AddItem("dm_load_menu", AdminMenu_Load, deathmatch_commands, "dm_load_menu", ADMFLAG_SLAY); g_tmAdminMenu.AddItem("dm_spawn_menu", AdminMenu_Spawn, deathmatch_commands, "dm_spawn_menu", ADMFLAG_SLAY); + g_tmAdminMenu.AddItem("dm_spawn_stats", AdminMenu_SpawnStats, deathmatch_commands, "dm_spawn_stats", ADMFLAG_SLAY); + g_tmAdminMenu.AddItem("dm_spawn_reset", AdminMenu_StatsReset, deathmatch_commands, "dm_spawn_reset", ADMFLAG_SLAY); + g_tmAdminMenu.AddItem("dm_weapon_stats", AdminMenu_WeaponStats, deathmatch_commands, "dm_weapon_stats", ADMFLAG_SLAY); g_tmAdminMenu.AddItem("dm_respawn_all", AdminMenu_Respawn, deathmatch_commands, "dm_respawn_all", ADMFLAG_SLAY); - g_tmAdminMenu.AddItem("dm_stats", AdminMenu_Stats, deathmatch_commands, "dm_stats", ADMFLAG_SLAY); - g_tmAdminMenu.AddItem("dm_stats_reset", AdminMenu_Reset, deathmatch_commands, "dm_stats_reset", ADMFLAG_SLAY); } } @@ -74,12 +75,12 @@ public void AdminMenu_Respawn(Handle topmenu, TopMenuAction action, TopMenuObjec Format(buffer, maxlength, "Respawn All"); else if (action == TopMenuAction_SelectOption) { - RespawnAll(); + Spawns_RespawnAll(); CReplyToCommand(param, "%t %t", "Chat Tag", "All Player Respawn"); } } -public void AdminMenu_Stats(Handle topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) +public void AdminMenu_SpawnStats(Handle topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) { if (action == TopMenuAction_DisplayOption) Format(buffer, maxlength, "Display Spawn Statistics"); @@ -87,20 +88,27 @@ public void AdminMenu_Stats(Handle topmenu, TopMenuAction action, TopMenuObject DisplaySpawnStats(param, false); } -public void AdminMenu_Reset(Handle topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) +public void AdminMenu_StatsReset(Handle topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) { if (action == TopMenuAction_DisplayOption) Format(buffer, maxlength, "Reset Spawn Statistics"); else if (action == TopMenuAction_SelectOption) { - ResetSpawnStats(); + Spawns_ResetSpawnStats(); CPrintToChat(param, "%t %t", "Chat Tag", "Spawn Stats Reset"); } } +public void AdminMenu_WeaponStats(Handle topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) +{ + if (action == TopMenuAction_DisplayOption) + Format(buffer, maxlength, "Display Weapon Statistics"); + else if (action == TopMenuAction_SelectOption) + DisplayWeaponStats(param, false); +} + void BuildWeaponsMenu(int client) { - Reset_Handle(g_hWeaponsMenus[client]); int allowSameWeapons = (g_bRememberChoice[client]) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED; Menu menu = new Menu(Menu_Weapons); char title[100]; @@ -114,8 +122,7 @@ void BuildWeaponsMenu(int client) Format(itemtext, sizeof(itemtext), "%T", "Random Weapons", client); menu.AddItem("Random", itemtext); menu.ExitButton = false; - g_hWeaponsMenus[client] = menu; - DisplayMenu(g_hWeaponsMenus[client], client, MENU_TIME_FOREVER); + menu.Display(client, MENU_TIME_FOREVER); } void BuildAvailableWeaponsMenu(int client, bool primary) @@ -123,32 +130,30 @@ void BuildAvailableWeaponsMenu(int client, bool primary) Menu menu; if (primary) { - Reset_Handle(g_hPrimaryMenus[client]); menu = new Menu(Menu_Primary); menu.SetTitle("Primary Weapon:"); menu.ExitButton = true; } else { - Reset_Handle(g_hSecondaryMenus[client]); menu = new Menu(Menu_Secondary); menu.SetTitle("Secondary Weapon:"); menu.ExitBackButton = true; } - ArrayList weapons; - weapons = new ArrayList(); - weapons = (primary) ? g_aPrimaryWeaponsAvailable : g_aSecondaryWeaponsAvailable; + g_aWeaponsList = new ArrayList(); + g_aWeaponsList = (primary) ? g_aPrimaryWeaponsAvailable : g_aSecondaryWeaponsAvailable; - char currentWeapon[24]; - currentWeapon = (primary) ? g_cPrimaryWeapon[client] : g_cSecondaryWeapon[client]; + char currentWeapon[32]; + currentWeapon = (primary) ? g_sPrimaryWeapon[client] : g_sSecondaryWeapon[client]; - for (int i = 0; i < weapons.Length; i++) + for (int i = 0; i < g_aWeaponsList.Length; i++) { - char weapon[24]; - weapons.GetString(i, weapon, sizeof(weapon)); + char text[64]; + char weapon[32]; + g_aWeaponsList.GetString(i, weapon, sizeof(weapon)); - char weaponMenuName[24]; + char weaponMenuName[32]; g_smWeaponMenuNames.GetString(weapon, weaponMenuName, sizeof(weaponMenuName)); int weaponCount; @@ -162,26 +167,23 @@ void BuildAvailableWeaponsMenu(int client, bool primary) menu.AddItem(weapon, weaponMenuName); else { - if ((weaponLimit == -1) || (weaponCount < weaponLimit)) + if (StrEqual(weapon, "weapon_awp") && CheckCommandAccess(client, "dm_weapons_awp_override", ADMFLAG_CUSTOM5)) + { + Format(text, sizeof(text), "%s (VIP)", weaponMenuName); + menu.AddItem(weapon, text); + } + else if ((weaponLimit == -1) || (weaponCount < weaponLimit)) menu.AddItem(weapon, weaponMenuName); else { - char text[64]; Format(text, sizeof(text), "%s (Limited)", weaponMenuName); menu.AddItem(weapon, text, ITEMDRAW_DISABLED); } } } - if (primary) - { - g_hPrimaryMenus[client] = menu; - DisplayMenu(g_hPrimaryMenus[client], client, MENU_TIME_FOREVER); - } - else - { - g_hSecondaryMenus[client] = menu; - DisplayMenu(g_hSecondaryMenus[client], client, MENU_TIME_FOREVER); - } + menu.AddItem("random", "Random"); + + menu.Display(client, MENU_TIME_FOREVER); } public int Menu_Weapons(Menu menu, MenuAction action, int param1, int param2) @@ -230,26 +232,26 @@ public int Menu_Weapons(Menu menu, MenuAction action, int param1, int param2) } if (g_cvDM_gun_menu_mode.IntValue == 1 || g_cvDM_gun_menu_mode.IntValue == 5) { - g_cPrimaryWeapon[param1] = "random"; - g_cSecondaryWeapon[param1] = "random"; + g_sPrimaryWeapon[param1] = "random"; + g_sSecondaryWeapon[param1] = "random"; GiveSavedWeapons(param1, true, true); } else if (g_cvDM_gun_menu_mode.IntValue == 2) { - g_cPrimaryWeapon[param1] = "random"; - g_cSecondaryWeapon[param1] = "none"; + g_sPrimaryWeapon[param1] = "random"; + g_sSecondaryWeapon[param1] = "none"; GiveSavedWeapons(param1, true, false); } else if (g_cvDM_gun_menu_mode.IntValue == 3) { - g_cPrimaryWeapon[param1] = "none"; - g_cSecondaryWeapon[param1] = "random"; + g_sPrimaryWeapon[param1] = "none"; + g_sSecondaryWeapon[param1] = "random"; GiveSavedWeapons(param1, false, true); } else if (g_cvDM_gun_menu_mode.IntValue == 4) { - g_cPrimaryWeapon[param1] = "none"; - g_cSecondaryWeapon[param1] = "none"; + g_sPrimaryWeapon[param1] = "none"; + g_sSecondaryWeapon[param1] = "none"; GiveSavedWeapons(param1, false, false); } } @@ -260,8 +262,8 @@ public int Menu_Primary(Menu menu, MenuAction action, int param1, int param2) { if (action == MenuAction_Select) { - char weaponEntity[24]; - char weaponName[24]; + char weaponEntity[32]; + char weaponName[32]; int weaponCount; int weaponLimit; @@ -269,30 +271,27 @@ public int Menu_Primary(Menu menu, MenuAction action, int param1, int param2) g_smWeaponMenuNames.GetString(weaponEntity, weaponName, sizeof(weaponName)); g_smWeaponCounts.GetValue(weaponEntity, weaponCount); g_smWeaponLimits.GetValue(weaponEntity, weaponLimit); - - if ((weaponLimit == -1) || (weaponCount < weaponLimit)) - IncrementWeaponCount(weaponEntity); - - DecrementWeaponCount(g_cPrimaryWeapon[param1]); - g_cPrimaryWeapon[param1] = weaponEntity; + strcopy(g_sPrimaryWeapon[param1], sizeof(g_sPrimaryWeapon[]), weaponEntity); g_bGiveFullLoadout[param1] = true; + if (g_cvDM_gun_menu_mode.IntValue != 2) BuildAvailableWeaponsMenu(param1, false) else GiveSavedWeapons(param1, true, false); + CPrintToChat(param1, "%t %t %s", "Chat Tag", "Primary Selection", weaponName); } else if (action == MenuAction_Cancel) { if (IsClientInGame(param1) && param2 == MenuCancel_Exit) { - DecrementWeaponCount(g_cPrimaryWeapon[param1]); - g_cPrimaryWeapon[param1] = "none"; + g_sPrimaryWeapon[param1] = "none"; g_bGiveFullLoadout[param1] = true; if (g_cvDM_gun_menu_mode.IntValue != 2) BuildAvailableWeaponsMenu(param1, false) else GiveSavedWeapons(param1, true, false); + CPrintToChat(param1, "%t %t None", "Chat Tag", "Primary Selection"); } } @@ -302,8 +301,8 @@ public int Menu_Secondary(Menu menu, MenuAction action, int param1, int param2) { if (action == MenuAction_Select) { - char weaponEntity[24]; - char weaponName[24]; + char weaponEntity[32]; + char weaponName[32]; int weaponCount; int weaponLimit; @@ -311,12 +310,8 @@ public int Menu_Secondary(Menu menu, MenuAction action, int param1, int param2) g_smWeaponMenuNames.GetString(weaponEntity, weaponName, sizeof(weaponName)); g_smWeaponCounts.GetValue(weaponEntity, weaponCount); g_smWeaponLimits.GetValue(weaponEntity, weaponLimit); + strcopy(g_sSecondaryWeapon[param1], sizeof(g_sSecondaryWeapon[]), weaponEntity); - if ((weaponLimit == -1) || (weaponCount < weaponLimit)) - IncrementWeaponCount(weaponEntity); - - DecrementWeaponCount(g_cSecondaryWeapon[param1]); - g_cSecondaryWeapon[param1] = weaponEntity; if (g_cvDM_gun_menu_mode.IntValue == 2) BuildAvailableWeaponsMenu(param1, true) else @@ -325,6 +320,7 @@ public int Menu_Secondary(Menu menu, MenuAction action, int param1, int param2) GiveSavedWeapons(param1, true, true); else GiveSavedWeapons(param1, false, true); + CPrintToChat(param1, "%t %t %s", "Chat Tag", "Secondary Selection", weaponName); } } @@ -335,8 +331,7 @@ public int Menu_Secondary(Menu menu, MenuAction action, int param1, int param2) if (IsClientInGame(param1) && param2 == MenuCancel_Exit) { - DecrementWeaponCount(g_cSecondaryWeapon[param1]); - g_cSecondaryWeapon[param1] = "none"; + g_sSecondaryWeapon[param1] = "none"; if (g_cvDM_gun_menu_mode.IntValue == 2) BuildAvailableWeaponsMenu(param1, true) else @@ -345,6 +340,7 @@ public int Menu_Secondary(Menu menu, MenuAction action, int param1, int param2) GiveSavedWeapons(param1, true, true); else GiveSavedWeapons(param1, false, true); + CPrintToChat(param1, "%t %t None", "Chat Tag", "Secondary Selection"); } } @@ -364,7 +360,7 @@ void BuildConfigMenu(int client) if (StrContains(config, "config_loader.ini", false) == -1) { if (LoadConfigName(config)) - menu.AddItem(config, g_cLoadConfigName); + menu.AddItem(config, g_sLoadConfigName); else menu.AddItem(config, config, ITEMDRAW_DISABLED); } @@ -428,7 +424,7 @@ public int Menu_ConfigMenu(Menu menu, MenuAction action, int param1, int param2) char info[PLATFORM_MAX_PATH]; menu.GetItem(param2, info, sizeof(info)); BuildConfigTimeMenu(param1); - strcopy(g_cLoadConfigMenu, sizeof(g_cLoadConfigMenu), info); + strcopy(g_sLoadConfigMenu, sizeof(g_sLoadConfigMenu), info); } } @@ -451,15 +447,15 @@ public int Menu_SpawnEditor(Menu menu, MenuAction action, int param1, int param2 g_bInEditMode = !g_bInEditMode; if (g_bInEditMode) { - EnableEditorMode(param1); - CreateTimer(1.0, RenderSpawnPoints, GetClientSerial(param1), TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); + Spawns_EnableEditorMode(param1); + CreateTimer(1.0, Timer_RenderSpawnPoints, GetClientSerial(param1), TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); } else - DisableEditorMode(param1); + Spawns_DisableEditorMode(param1); } else if (StrEqual(info, "Nearest")) { - int spawnPoint = GetNearestSpawn(param1); + int spawnPoint = Spawns_GetNearestSpawn(param1); if (spawnPoint != -1) { TeleportEntity(param1, g_fSpawnPositions[spawnPoint], g_fSpawnAngles[spawnPoint], NULL_VECTOR); @@ -499,18 +495,18 @@ public int Menu_SpawnEditor(Menu menu, MenuAction action, int param1, int param2 } else if (StrEqual(info, "Add")) { - AddSpawn(param1); + Spawns_AddSpawn(param1); } else if (StrEqual(info, "Insert")) { - InsertSpawn(param1); + Spawns_InsertSpawn(param1); } else if (StrEqual(info, "Delete")) { - int spawnPoint = GetNearestSpawn(param1); + int spawnPoint = Spawns_GetNearestSpawn(param1); if (spawnPoint != -1) { - DeleteSpawn(spawnPoint); + Spawns_DeleteSpawn(spawnPoint); CPrintToChat(param1, "%t %t #%i (%i total).", "Chat Tag", "Spawn Editor Deleted Spawn", spawnPoint + 1, g_iSpawnPointCount); } } @@ -561,7 +557,7 @@ public int Menu_ConfigTime(Menu menu, MenuAction action, int param1, int param2) { char info[32]; menu.GetItem(param2, info, sizeof(info)); - LoadTimeConfig(param1, g_cLoadConfigMenu, info); + LoadTimeConfig(param1, g_sLoadConfigMenu, info); } } @@ -574,14 +570,9 @@ void DisplaySpawnStats(int client, bool console) { PrintToServer("////////////////////////////////////////////////////////////////"); PrintToServer("Spawn Stats:"); + PrintToServer("////////////////////////////////////////////////////////////////"); Format(text, sizeof(text), "- Number of player spawns: %i", g_iNumberOfPlayerSpawns); PrintToServer("%s", text); - Format(text, sizeof(text), "- LoS + Distance Attempts: %i", g_iLosDisSearchAttempts); - PrintToServer("%s", text); - Format(text, sizeof(text), "- LoS + Distance search success rate: %.2f\%", (float(g_iLosDisSearchSuccesses) / float(g_iLosDisSearchAttempts)) * 100) - PrintToServer("%s", text); - Format(text, sizeof(text), "- LoS + Distance search failure rate: %.2f\%", (float(g_iLosDisSearchFailures) / float(g_iLosDisSearchAttempts)) * 100); - PrintToServer("%s", text); Format(text, sizeof(text), "- LoS Attempts: %i", g_iLosSearchAttempts); PrintToServer("%s", text); Format(text, sizeof(text), "- LoS search success rate: %.2f\%", (float(g_iLosSearchSuccesses) / float(g_iLosSearchAttempts)) * 100); @@ -604,12 +595,6 @@ void DisplaySpawnStats(int client, bool console) panel.SetTitle("Spawn Stats:"); Format(text, sizeof(text), "- Number of player spawns: %i", g_iNumberOfPlayerSpawns); panel.DrawText(text); - Format(text, sizeof(text), "- LoS + Distance Attempts: %i", g_iLosDisSearchAttempts); - panel.DrawText(text); - Format(text, sizeof(text), "- LoS + Distance search success rate: %.2f\%", (float(g_iLosDisSearchSuccesses) / float(g_iLosDisSearchAttempts)) * 100); - panel.DrawText(text); - Format(text, sizeof(text), "- LoS + Distance search failure rate: %.2f\%", (float(g_iLosDisSearchFailures) / float(g_iLosDisSearchAttempts)) * 100); - panel.DrawText(text); Format(text, sizeof(text), "- LoS Attempts: %i", g_iLosSearchAttempts); panel.DrawText(text); Format(text, sizeof(text), "- LoS search success rate: %.2f\%", (float(g_iLosSearchSuccesses) / float(g_iLosSearchAttempts)) * 100); @@ -631,12 +616,77 @@ void DisplaySpawnStats(int client, bool console) } } -void Reset_Handle(Handle handle) +public int Menu_WeaponStats(Menu menu, MenuAction action, int param1, int param2) { - if (handle != null) + if (action == MenuAction_End) + delete menu; +} + +void DisplayWeaponStats(int client, bool console) +{ + char text[64]; + char weapon[32]; + char weaponMenuName[32]; + int weaponCount; + int weaponLimit; + + if (console) { - CancelMenu(handle); - CloseHandle(handle); - handle = null; + PrintToServer("////////////////////////////////////////////////////////////////"); + PrintToServer("Weapon Primary Stats:"); + PrintToServer("////////////////////////////////////////////////////////////////"); + for (int i = 0; i < g_aPrimaryWeaponsAvailable.Length; i++) + { + g_aPrimaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); + g_smWeaponMenuNames.GetString(weapon, weaponMenuName, sizeof(weaponMenuName)); + g_smWeaponCounts.GetValue(weapon, weaponCount); + g_smWeaponLimits.GetValue(weapon, weaponLimit); + + Format(text, sizeof(text), "%s | Count: %i | Limit: %i", weaponMenuName, weaponCount, weaponLimit); + PrintToServer("%s", text); + } + PrintToServer("////////////////////////////////////////////////////////////////"); + PrintToServer("Weapon Secondary Stats:"); + for (int i = 0; i < g_aSecondaryWeaponsAvailable.Length; i++) + { + g_aSecondaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); + g_smWeaponMenuNames.GetString(weapon, weaponMenuName, sizeof(weaponMenuName)); + g_smWeaponCounts.GetValue(weapon, weaponCount); + g_smWeaponLimits.GetValue(weapon, weaponLimit); + + Format(text, sizeof(text), "%s | Count: %i | Limit: %i", weaponMenuName, weaponCount, weaponLimit); + PrintToServer("%s", text); + } + PrintToServer("////////////////////////////////////////////////////////////////"); + } + else + { + Menu menu = new Menu(Menu_WeaponStats); + menu.SetTitle("Weapon Stats:"); + + for (int i = 0; i < g_aPrimaryWeaponsAvailable.Length; i++) + { + g_aPrimaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); + g_smWeaponMenuNames.GetString(weapon, weaponMenuName, sizeof(weaponMenuName)); + g_smWeaponCounts.GetValue(weapon, weaponCount); + g_smWeaponLimits.GetValue(weapon, weaponLimit); + + Format(text, sizeof(text), "%s | Count: %i | Limit: %i", weaponMenuName, weaponCount, weaponLimit); + menu.AddItem(weapon, text); + } + + for (int i = 0; i < g_aSecondaryWeaponsAvailable.Length; i++) + { + g_aSecondaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); + g_smWeaponMenuNames.GetString(weapon, weaponMenuName, sizeof(weaponMenuName)); + g_smWeaponCounts.GetValue(weapon, weaponCount); + g_smWeaponLimits.GetValue(weapon, weaponLimit); + + Format(text, sizeof(text), "%s | Count: %i | Limit: %i", weaponMenuName, weaponCount, weaponLimit); + menu.AddItem(weapon, text); + } + + menu.ExitButton = true; + menu.Display(client, MENU_TIME_FOREVER); } } \ No newline at end of file diff --git a/scripting/deathmatch/natives.sp b/scripting/deathmatch/natives.sp index 9d2d869..8b0ce37 100644 --- a/scripting/deathmatch/natives.sp +++ b/scripting/deathmatch/natives.sp @@ -4,8 +4,10 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max CreateNative("Deathmatch_DisplayWeaponsMenu", Native_DisplayWeaponsMenu); CreateNative("Deathmatch_GiveSavedWeapons", Native_GiveSavedWeapons); - CreateNative("Deathmatch_UpdateSetting_Primary", Native_UpdateSetting_Primary); - CreateNative("Deathmatch_UpdateSetting_Secondary", Native_UpdateSetting_Secondary); + CreateNative("Deathmatch_SetPrimaryWeapon", Native_SetPrimaryWeapon); + CreateNative("Deathmatch_SetSecondaryWeapon", Native_SetSecondaryWeapon); + CreateNative("Deathmatch_SetPrimaryWeaponCookie", Native_SetPrimaryWeaponCookie); + CreateNative("Deathmatch_SetSecondaryWeaponCookie", Native_SetSecondaryWeaponCookie); return APLRes_Success; } @@ -44,22 +46,56 @@ public int Native_GiveSavedWeapons(Handle plugin, int numParams) GiveSavedWeapons(client, false, false); } -public int Native_UpdateSetting_Primary(Handle plugin, int numParams) +public int Native_SetPrimaryWeapon(Handle plugin, int numParams) { int client = GetNativeCell(1); if (client < 1 || client > MaxClients || !IsClientInGame(client)) ThrowNativeError(SP_ERROR_NATIVE, "Client is invalid."); - GetNativeString(2, g_cPrimaryWeapon[client], sizeof(g_cPrimaryWeapon[])); + GetNativeString(2, g_sPrimaryWeapon[client], sizeof(g_sPrimaryWeapon[])); + + bool cookie = true; + cookie = GetNativeCell(3); + if (cookie) + SetClientCookie(client, g_hWeapon_Primary_Cookie, g_sPrimaryWeapon[client]); +} + +public int Native_SetSecondaryWeapon(Handle plugin, int numParams) +{ + int client = GetNativeCell(1); + + if (client < 1 || client > MaxClients || !IsClientInGame(client)) + ThrowNativeError(SP_ERROR_NATIVE, "Client is invalid."); + + GetNativeString(2, g_sSecondaryWeapon[client], sizeof(g_sSecondaryWeapon[])); + + bool cookie = true; + cookie = GetNativeCell(3); + if (cookie) + SetClientCookie(client, g_hWeapon_Primary_Cookie, g_sPrimaryWeapon[client]); +} + +public int Native_SetPrimaryWeaponCookie(Handle plugin, int numParams) +{ + int client = GetNativeCell(1); + + if (client < 1 || client > MaxClients || !IsClientInGame(client)) + ThrowNativeError(SP_ERROR_NATIVE, "Client is invalid."); + + char buffer[32]; + GetNativeString(2, buffer, sizeof(buffer)); + SetClientCookie(client, g_hWeapon_Primary_Cookie, buffer); } -public int Native_UpdateSetting_Secondary(Handle plugin, int numParams) +public int Native_SetSecondaryWeaponCookie(Handle plugin, int numParams) { int client = GetNativeCell(1); if (client < 1 || client > MaxClients || !IsClientInGame(client)) ThrowNativeError(SP_ERROR_NATIVE, "Client is invalid."); - GetNativeString(2, g_cSecondaryWeapon[client], sizeof(g_cSecondaryWeapon[])); + char buffer[32]; + GetNativeString(2, buffer, sizeof(buffer)); + SetClientCookie(client, g_hWeapon_Secondary_Cookie, buffer); } \ No newline at end of file diff --git a/scripting/deathmatch/spawns.sp b/scripting/deathmatch/spawns.sp index 1a6f382..1fbf245 100644 --- a/scripting/deathmatch/spawns.sp +++ b/scripting/deathmatch/spawns.sp @@ -1,37 +1,36 @@ -void RespawnDead() -{ - for (int i = 1; i <= MaxClients; i++) - RequestFrame(Frame_RespawnDead, GetClientSerial(i)); -} - -void RespawnAll() +void Spawns_RespawnAll() { for (int i = 1; i <= MaxClients; i++) + { + if (!IsClientInGame(i)) + continue; RequestFrame(Frame_RespawnAll, GetClientSerial(i)); + } } public Action Timer_Respawn(Handle timer, any serial) { int client = GetClientFromSerial(serial); - if (!g_bRoundEnded && client && (GetClientTeam(client) > CS_TEAM_SPECTATOR) && !IsPlayerAlive(client)) - { - UpdateSpawnPoints(); - g_bPlayerMoved[client] = false; - g_iHealthshotCount[client] = 0; - CS_RespawnPlayer(client); - } + if (g_bRoundEnded || !IsValidClient(client, true) || GetClientTeam(client) <= CS_TEAM_SPECTATOR || IsPlayerAlive(client)) + return Plugin_Handled; + + g_bPlayerMoved[client] = false; + g_iHealthshotCount[client] = 0; + CS_RespawnPlayer(client); + + return Plugin_Handled; } -void EnableSpawnProtection(int client) +void Spawns_EnableSpawnProtection(int client) { int clientTeam = GetClientTeam(client); /* Disable damage */ SetEntProp(client, Prop_Data, "m_takedamage", 0, 1); /* Set player color */ if (clientTeam == CS_TEAM_T) - SetPlayerColor(client, g_iColorT); + Spawns_SetPlayerColor(client, g_iColorT); else if (clientTeam == CS_TEAM_CT) - SetPlayerColor(client, g_iColorCT); + Spawns_SetPlayerColor(client, g_iColorCT); /* Create timer to remove spawn protection */ CreateTimer(g_cvDM_spawn_protection_time.FloatValue, Timer_DisableSpawnProtection, GetClientSerial(client)); } @@ -39,36 +38,46 @@ void EnableSpawnProtection(int client) public Action Timer_DisableSpawnProtection(Handle timer, any serial) { int client = GetClientFromSerial(serial); - if (client && (GetClientTeam(client) > CS_TEAM_SPECTATOR) && IsPlayerAlive(client)) - { - /* Enable damage */ - SetEntProp(client, Prop_Data, "m_takedamage", 2, 1); - /* Set player color */ - SetPlayerColor(client, g_iDefaultColor); - } + if (!IsValidClient(client, true) || GetClientTeam(client) <= CS_TEAM_SPECTATOR || !IsPlayerAlive(client)) + return Plugin_Handled; + + /* Enable damage */ + SetEntProp(client, Prop_Data, "m_takedamage", 2, 1); + /* Set player color */ + Spawns_SetPlayerColor(client, g_iDefaultColor); + + return Plugin_Handled; } -void SetPlayerColor(int client, const int color[4]) +void Spawns_SetPlayerColor(int client, const int color[4]) { + /* Set the player color to the specified variables */ SetEntityRenderMode(client, (color[3] == 255) ? RENDER_NORMAL : RENDER_TRANSCOLOR); SetEntityRenderColor(client, color[0], color[1], color[2], color[3]); } -void EnableEditorMode(int client) +void Spawns_EnableEditorMode(int client) { + /* Set client edit mode to false */ g_bInEditModeClient[client] = true; - SetEntProp(client, Prop_Data, "m_takedamage", 0, 1); - SetEntProp(client, Prop_Data, "m_CollisionGroup", 2); - SetEntPropFloat(client, Prop_Data, "m_flGravity", 0.2); - SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.5); + if (IsPlayerAlive(client)) + { + /* After checking client alive, set attributes for God mode */ + SetEntProp(client, Prop_Data, "m_takedamage", 0, 1); + SetEntProp(client, Prop_Data, "m_CollisionGroup", 2); + SetEntPropFloat(client, Prop_Data, "m_flGravity", 0.2); + SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.5); + } CPrintToChat(client, "%t %t", "Chat Tag", "Spawn Editor Enabled"); } -void DisableEditorMode(int client) +void Spawns_DisableEditorMode(int client) { + /* Set client edit mode to false */ g_bInEditModeClient[client] = false; if (IsPlayerAlive(client)) { + /* After checking client alive, remove attributes for God mode */ SetEntProp(client, Prop_Data, "m_takedamage", 2, 1); SetEntProp(client, Prop_Data, "m_CollisionGroup", 5); SetEntPropFloat(client, Prop_Data, "m_flGravity", 1.0); @@ -77,22 +86,22 @@ void DisableEditorMode(int client) CPrintToChat(client, "%t %t", "Chat Tag", "Spawn Editor Disabled"); } -public Action RenderSpawnPoints(Handle timer, any serial) +public Action Timer_RenderSpawnPoints(Handle timer, any serial) { if (!g_bInEditMode) return Plugin_Stop; int client = GetClientFromSerial(serial); - if (!client) + if (!IsValidClient(client)) return Plugin_Stop; for (int i = 0; i < g_iSpawnPointCount; i++) - DisplaySpawnPoint(client, g_fSpawnPositions[i], g_fSpawnAngles[i], 40.0); + Spawns_DisplaySpawnPoint(client, g_fSpawnPositions[i], g_fSpawnAngles[i], 40.0); return Plugin_Continue; } -void DisplaySpawnPoint(int client, float position[3], float angles[3], float size) +void Spawns_DisplaySpawnPoint(int client, float position[3], float angles[3], float size) { float direction[3]; float spawnPosition[3]; @@ -113,7 +122,7 @@ void DisplaySpawnPoint(int client, float position[3], float angles[3], float siz TE_SendToClient(client); } -int GetNearestSpawn(int client) +public int Spawns_GetNearestSpawn(int client) { if (g_iSpawnPointCount == 0) { @@ -139,7 +148,7 @@ int GetNearestSpawn(int client) return nearestPoint; } -void AddSpawn(int client) +void Spawns_AddSpawn(int client) { if (g_iSpawnPointCount >= MAX_SPAWNS) { @@ -152,7 +161,7 @@ void AddSpawn(int client) CPrintToChat(client, "%t %t", "Chat Tag", "Spawn Editor Spawn Added", g_iSpawnPointCount, g_iSpawnPointCount); } -void InsertSpawn(int client) +void Spawns_InsertSpawn(int client) { if (g_iSpawnPointCount >= MAX_SPAWNS) { @@ -161,16 +170,16 @@ void InsertSpawn(int client) } if (g_iSpawnPointCount == 0) - AddSpawn(client); + Spawns_AddSpawn(client); else { - /* Move spawn points down the list to make room for insertion. */ + /* Move spawn points down the list to make room for insertion */ for (int i = g_iSpawnPointCount - 1; i >= g_iLastEditorSpawnPoint[client]; i--) { g_fSpawnPositions[i + 1] = g_fSpawnPositions[i]; g_fSpawnAngles[i + 1] = g_fSpawnAngles[i]; } - /* Insert new spawn point. */ + /* Insert new spawn point */ GetClientAbsOrigin(client, g_fSpawnPositions[g_iLastEditorSpawnPoint[client]]); GetClientAbsAngles(client, g_fSpawnAngles[g_iLastEditorSpawnPoint[client]]); g_iSpawnPointCount++; @@ -178,9 +187,9 @@ void InsertSpawn(int client) } } -void DeleteSpawn(int spawnIndex) +void Spawns_DeleteSpawn(int spawnIndex) { - for (int i = spawnIndex; i < (g_iSpawnPointCount - 1); i++) + for (int i = spawnIndex; i < g_iSpawnPointCount - 1; i++) { g_fSpawnPositions[i] = g_fSpawnPositions[i + 1]; g_fSpawnAngles[i] = g_fSpawnAngles[i + 1]; @@ -188,22 +197,21 @@ void DeleteSpawn(int spawnIndex) g_iSpawnPointCount--; } -/* Updates the occupation status of all spawn points. */ -void UpdateSpawnPoints() +/* Updates the occupation status of all spawn points */ +void Spawns_UpdateSpawnPoints() { - if (g_cvDM_enabled.BoolValue && (g_iSpawnPointCount > 0)) + if (g_cvDM_enabled.BoolValue && g_iSpawnPointCount > 0) { - /* Retrieve player positions. */ + /* Retrieve player positions */ float playerPositions[MAXPLAYERS+1][3]; int numberOfAlivePlayers = 0; for (int i = 1; i <= MaxClients; i++) { - if (IsClientInGame(i) && (GetClientTeam(i) > CS_TEAM_SPECTATOR) && IsPlayerAlive(i)) - { - GetClientAbsOrigin(i, playerPositions[numberOfAlivePlayers]); - numberOfAlivePlayers++; - } + if (!IsClientInGame(i) || GetClientTeam(i) <= CS_TEAM_SPECTATOR || !IsPlayerAlive(i)) + continue; + GetClientAbsOrigin(i, playerPositions[numberOfAlivePlayers]); + numberOfAlivePlayers++; } /* Check each spawn point for occupation by proximity to alive players */ @@ -213,90 +221,88 @@ void UpdateSpawnPoints() for (int j = 0; j < numberOfAlivePlayers; j++) { float fDistance = GetVectorDistance(g_fSpawnPositions[i], playerPositions[j], true); - if (fDistance < 10000.0) - { - g_bSpawnPointOccupied[i] = true; - break; - } + if (fDistance > 10000.0) + continue; + g_bSpawnPointOccupied[i] = true; + break; } } } } -void MovePlayer(int client) +void Spawns_MovePlayer(int client) { g_iNumberOfPlayerSpawns++; /* Stats */ int spawnPoint; + int spawnLoSAttempts = g_cvDM_spawn_los_attempts.IntValue; + int spawnDisAttempts = g_cvDM_spawn_distance_attempts.IntValue; + float spawnMinDistance = g_cvDM_spawn_distance.FloatValue; bool spawnPointFound = false; /* Retrieve enemy positions if required by LoS/distance spawning (at eye level for LoS checking). */ if (g_cvDM_spawn_los.BoolValue) { - g_iLosDisSearchAttempts++; /* Stats */ + g_iLosSearchAttempts++; /* Stats */ /* Try to find a suitable spawn point with a clear line of sight within distance. */ - for (int i = 0; i < g_cvDM_spawn_los_attempts.IntValue; i++) + for (int i = 0; i <= spawnLoSAttempts; i++) { + #if defined DEBUG + PrintToServer("LosAttempt = %i", i); + #endif + spawnPoint = GetRandomInt(0, g_iSpawnPointCount - 1); if (g_bSpawnPointOccupied[spawnPoint]) continue; - if (!IsSpawnPointSuitable(spawnPoint, client, true)) + if (!Spawns_IsSuitableDistance(spawnPoint, client)) continue; - else - { - spawnPointFound = true; - break; - } - } - /* Stats */ - if (spawnPointFound) - g_iLosDisSearchSuccesses++; - else - g_iLosDisSearchFailures++; - } - - /* First fallback. Find a random unoccupied spawn point with a clear LoS. */ - if (!spawnPointFound && g_cvDM_spawn_los.BoolValue) - { - g_iLosSearchAttempts++; /* Stats */ - for (int i = 0; i < g_cvDM_spawn_los_attempts.IntValue; i++) - { - spawnPoint = GetRandomInt(0, g_iSpawnPointCount - 1); - - if (g_bSpawnPointOccupied[spawnPoint]) + if (!Spawns_IsSuitableLineOfSight(spawnPoint, client)) continue; - if (!IsSpawnPointSuitable(spawnPoint, client, true)) - continue; - else - { - spawnPointFound = true; - break; - } + #if defined DEBUG + PrintToServer("Los SpawnPoint Found = %i", spawnPoint); + #endif + spawnPointFound = true; + break; } /* Stats */ if (spawnPointFound) g_iLosSearchSuccesses++; else g_iLosSearchFailures++; + + #if defined DEBUG + if (spawnPointFound) + PrintToServer("LoS and Distance | Found spawn point"); + else + PrintToServer("LoS and Distance | Did not find spawn point"); + #endif } - /* Second fallback. Find a random unoccupied spawn point at a suitable distance. */ - if (!spawnPointFound && g_cvDM_spawn_distance.FloatValue > 0.0) + /* First fallback. Find a random unoccupied spawn point at a suitable distance. */ + if (!spawnPointFound) { g_iDistanceSearchAttempts++; /* Stats */ - for (int i = 0; i < g_cvDM_spawn_distance_attempts.IntValue; i++) + if (spawnMinDistance < 0.0) + spawnMinDistance = 0.0 + + for (int i = 0; i <= spawnDisAttempts; i++) { + #if defined DEBUG + PrintToServer("DisAttempt = %i", i); + #endif + spawnPoint = GetRandomInt(0, g_iSpawnPointCount - 1); + if (g_bSpawnPointOccupied[spawnPoint]) continue; - if (!IsSpawnPointSuitable(spawnPoint, client, false)) + if (!Spawns_IsSuitableDistance(spawnPoint, client)) continue; else { @@ -309,12 +315,19 @@ void MovePlayer(int client) g_iDistanceSearchSuccesses++; else g_iDistanceSearchFailures++; + + #if defined DEBUG + if (spawnPointFound) + PrintToServer("Distance | Found spawn point"); + else + PrintToServer("Distance | Did not find spawn point"); + #endif } /* Final fallback. Find a random unoccupied spawn point. */ if (!spawnPointFound) { - for (int i = 0; i < 100; i++) + for (int i = 0; i <= MAX_SPAWNS; i++) { spawnPoint = GetRandomInt(0, g_iSpawnPointCount - 1); if (!g_bSpawnPointOccupied[spawnPoint]) @@ -323,74 +336,86 @@ void MovePlayer(int client) break; } } + + #if defined DEBUG + PrintToServer("Final Fallback | spawn point"); + #endif } if (spawnPointFound) { TeleportEntity(client, g_fSpawnPositions[spawnPoint], g_fSpawnAngles[spawnPoint], NULL_VECTOR); g_bSpawnPointOccupied[spawnPoint] = true; - g_bPlayerMoved[client] = true; } else g_iSpawnPointSearchFailures++; /* Stats */ } -bool IsSpawnPointSuitable(int spawnPoint, int client, bool lineofsight) +public bool Spawns_IsSuitableDistance(int spawnPoint, int client) { - bool hasClearLineOfSight = true; + bool freeForAll = g_cvDM_free_for_all.BoolValue; float enemyEyePositions[MAXPLAYERS+1][3]; + float spawnMinDistance = g_cvDM_spawn_distance.FloatValue; for (int i = 1; i <= MaxClients; i++) { - if (IsClientInGame(i) && !IsClientSourceTV(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR && IsPlayerAlive(i) && i != client) - { - if (g_cvDM_free_for_all.BoolValue || GetClientTeam(i) != GetClientTeam(client)) - GetClientEyePosition(i, enemyEyePositions[i]); + if (!IsClientInGame(i) || GetClientTeam(i) <= CS_TEAM_SPECTATOR || !IsPlayerAlive(i) || i == client) + continue; - float fDistance = GetVectorDistance(g_fSpawnPositions[spawnPoint], enemyEyePositions[i], true); - if (fDistance < g_cvDM_spawn_distance.FloatValue) - return false; - } + if (freeForAll || GetClientTeam(i) != GetClientTeam(client)) + GetClientEyePosition(i, enemyEyePositions[i]); + + float fDistance = GetVectorDistance(g_fSpawnPositions[spawnPoint], enemyEyePositions[i], true); + if (fDistance < spawnMinDistance) + return false; } - if (lineofsight) + return true; +} + +public bool Spawns_IsSuitableLineOfSight(int spawnPoint, int client) +{ + bool freeForAll = g_cvDM_free_for_all.BoolValue; + bool hasClearLineOfSight = true; + float enemyEyePositions[MAXPLAYERS+1][3]; + float spawnPointEyePosition[3]; + + AddVectors(g_fSpawnPositions[spawnPoint], g_fEyeOffset, spawnPointEyePosition); + + for (int i = 1; i <= MaxClients; i++) { - float spawnPointEyePosition[3]; - AddVectors(g_fSpawnPositions[spawnPoint], g_fEyeOffset, spawnPointEyePosition); + if (!IsClientInGame(i) || GetClientTeam(i) <= CS_TEAM_SPECTATOR || !IsPlayerAlive(i) || i == client) + continue; + + if (freeForAll || GetClientTeam(i) != GetClientTeam(client)) + GetClientEyePosition(i, enemyEyePositions[i]); - for (int j = 1; j <= MaxClients; j++) + Handle trace = TR_TraceRayFilterEx(spawnPointEyePosition, enemyEyePositions[i], MASK_PLAYERSOLID_BRUSHONLY, RayType_EndPoint, Spawns_TraceEntityFilterPlayer); + + if (!TR_DidHit(trace)) { - Handle trace = TR_TraceRayFilterEx(spawnPointEyePosition, enemyEyePositions[j], MASK_PLAYERSOLID_BRUSHONLY, RayType_EndPoint, TraceEntityFilterPlayer); - if (!TR_DidHit(trace)) - { - hasClearLineOfSight = false; - delete trace; - break; - } + hasClearLineOfSight = false; delete trace; + break; } - - if (hasClearLineOfSight) - return true; - else - return false; + delete trace; } - else + + if (hasClearLineOfSight) return true; + else + return false; } -public bool TraceEntityFilterPlayer(int entity, int contentsMask) +public bool Spawns_TraceEntityFilterPlayer(int entity, int contentsMask) { if ((entity > 0) && (entity <= MaxClients)) return false; return true; } -void ResetSpawnStats() +void Spawns_ResetSpawnStats() { g_iNumberOfPlayerSpawns = 0; - g_iLosDisSearchAttempts = 0; - g_iLosDisSearchSuccesses = 0; - g_iLosDisSearchFailures = 0; g_iLosSearchAttempts = 0; g_iLosSearchSuccesses = 0; g_iLosSearchFailures = 0; diff --git a/scripting/deathmatch/weapons.sp b/scripting/deathmatch/weapons.sp index 4faddf4..cde9078 100644 --- a/scripting/deathmatch/weapons.sp +++ b/scripting/deathmatch/weapons.sp @@ -3,8 +3,8 @@ void LoadWeapons() g_iAmmoOffset = FindSendPropInfo("CCSPlayer", "m_iAmmo"); /* Create arrays to store available weapons loaded by config */ - g_aPrimaryWeaponsAvailable = new ArrayList(25); - g_aSecondaryWeaponsAvailable = new ArrayList(11); + g_aPrimaryWeaponsAvailable = new ArrayList(24); + g_aSecondaryWeaponsAvailable = new ArrayList(10); /* Create stringmap to store weapon limits, counts, and teams */ g_smWeaponLimits = new StringMap(); @@ -17,8 +17,8 @@ void LoadWeapons() void SetClientGunSettings(int client, char[] primary, char[] secondary) { - strcopy(g_cPrimaryWeapon[client], sizeof(g_cPrimaryWeapon[]), primary); - strcopy(g_cSecondaryWeapon[client], sizeof(g_cSecondaryWeapon[]), secondary); + strcopy(g_sPrimaryWeapon[client], sizeof(g_sPrimaryWeapon[]), primary); + strcopy(g_sSecondaryWeapon[client], sizeof(g_sSecondaryWeapon[]), secondary); } void SetClientGunModeSettings(int client) @@ -52,7 +52,6 @@ void SetClientGunModeSettings(int client) { SetClientCookie(client, g_hWeapon_Primary_Cookie, "random"); SetClientCookie(client, g_hWeapon_Secondary_Cookie, "random"); - SetClientCookie(client, g_hWeapon_First_Cookie, "0"); } } case 6: @@ -71,7 +70,7 @@ void BuildWeaponMenuNames() g_smWeaponMenuNames = new StringMap(); /* Primary weapons */ g_smWeaponMenuNames.SetString("weapon_ak47", "AK-47"); - g_smWeaponMenuNames.SetString("weapon_m4a1", "M4A1"); + g_smWeaponMenuNames.SetString("weapon_m4a1", "M4A4"); g_smWeaponMenuNames.SetString("weapon_m4a1_silencer", "M4A1-S"); g_smWeaponMenuNames.SetString("weapon_sg556", "SG 553"); g_smWeaponMenuNames.SetString("weapon_aug", "AUG"); @@ -109,36 +108,44 @@ void BuildWeaponMenuNames() g_smWeaponMenuNames.SetString("random", "Random"); } -void InitialiseWeaponCounts() +void InitializeWeaponCounts() { for (int i = 0; i < g_aPrimaryWeaponsAvailable.Length; i++) { - char weapon[24]; + char weapon[32]; g_aPrimaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); g_smWeaponCounts.SetValue(weapon, 0); } for (int i = 0; i < g_aSecondaryWeaponsAvailable.Length; i++) { - char weapon[24]; + char weapon[32]; g_aSecondaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); g_smWeaponCounts.SetValue(weapon, 0); } } -void IncrementWeaponCount(char[] weapon) +void IncrementWeaponCount(const char[] weapon) { - int weaponCount; - g_smWeaponCounts.GetValue(weapon, weaponCount); - g_smWeaponCounts.SetValue(weapon, weaponCount + 1); + if (strcmp(weapon, "none") == 0 || strcmp(weapon, "random") == 0) + return + else + { + int weaponCount; + g_smWeaponCounts.GetValue(weapon, weaponCount); + g_smWeaponCounts.SetValue(weapon, weaponCount + 1); + } } -void DecrementWeaponCount(char[] weapon) +void DecrementWeaponCount(const char[] weapon) { - if (!StrEqual(weapon, "none")) + if (strcmp(weapon, "none") == 0 || strcmp(weapon, "random") == 0) + return + else { int weaponCount; g_smWeaponCounts.GetValue(weapon, weaponCount); - g_smWeaponCounts.SetValue(weapon, weaponCount - 1); + if (weaponCount > 0) + g_smWeaponCounts.SetValue(weapon, weaponCount - 1); } } @@ -149,10 +156,13 @@ public int GetWeaponTeam(const char[] weapon) return team; } -public void GiveSkinnedWeapon(int client, const char[] weapon) +void GiveSkinnedWeapon(int client, const char[] weapon, bool primary, bool random = false) { int playerTeam = GetEntProp(client, Prop_Data, "m_iTeamNum"); int weaponTeam = GetWeaponTeam(weapon); + bool playerVIP = CheckCommandAccess(client, "dm_access_weapons_awp", ADMFLAG_RESERVATION); + bool awpCurrent = strcmp(weapon, "weapon_awp") == 0; + bool awpPrevious = strcmp(g_sPrimaryWeaponPrevious[client], "weapon_awp") == 0; if (weaponTeam > 0) SetEntProp(client, Prop_Data, "m_iTeamNum", weaponTeam); @@ -162,11 +172,31 @@ public void GiveSkinnedWeapon(int client, const char[] weapon) if (g_cvDM_fast_equip.BoolValue) RequestFrame(Frame_FastSwitch, GetClientSerial(client)); + + if (!IsFakeClient(client)) + { + if (primary) + { + if (!playerVIP && !awpCurrent) + IncrementWeaponCount(weapon); + if (!playerVIP && !awpPrevious) + DecrementWeaponCount(weapon); + if (!random) + strcopy(g_sPrimaryWeapon[client], sizeof(g_sPrimaryWeapon[]), weapon); + } + else + { + IncrementWeaponCount(weapon); + DecrementWeaponCount(weapon); + if (!random) + strcopy(g_sSecondaryWeapon[client], sizeof(g_sSecondaryWeapon[]), weapon); + } + } } void GiveSavedWeapons(int client, bool primary, bool secondary) { - if (client && IsPlayerAlive(client)) + if (IsValidClient(client, true) && IsPlayerAlive(client) && GetClientTeam(client) > CS_TEAM_SPECTATOR) { if (IsFakeClient(client)) SetClientGunModeSettings(client); @@ -178,28 +208,29 @@ void GiveSavedWeapons(int client, bool primary, bool secondary) { RemoveClientWeapons(client); - if (g_cvDM_gun_menu_mode.IntValue == 2 && StrEqual(g_cPrimaryWeapon[client], "none")) - g_cPrimaryWeapon[client] = "random"; - if (primary && !StrEqual(g_cPrimaryWeapon[client], "none")) + if (g_cvDM_gun_menu_mode.IntValue == 2 && strcmp(g_sPrimaryWeapon[client], "none") == 0) + g_sPrimaryWeapon[client] = "random"; + + if (primary && !StrEqual(g_sPrimaryWeapon[client], "none") && g_aPrimaryWeaponsAvailable.Length != 0) { - if (StrEqual(g_cPrimaryWeapon[client], "random")) + int random = GetRandomInt(0, g_aPrimaryWeaponsAvailable.Length - 1); + if (strcmp(g_sPrimaryWeapon[client], "random") == 0) { /* Select random menu item (excluding "Random" option) */ - int random = GetRandomInt(0, g_aPrimaryWeaponsAvailable.Length - 2); - char randomWeapon[24]; + char randomWeapon[32]; g_aPrimaryWeaponsAvailable.GetString(random, randomWeapon, sizeof(randomWeapon)); - GiveSkinnedWeapon(client, randomWeapon); + GiveSkinnedWeapon(client, randomWeapon, true, true); if (!IsFakeClient(client)) SetClientCookie(client, g_hWeapon_Primary_Cookie, "random"); } else { bool weaponFound = false; - char weapon[24]; + char weapon[32]; for (int i = 0; i < g_aPrimaryWeaponsAvailable.Length; i++) { g_aPrimaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); - if (StrEqual(g_cPrimaryWeapon[client], weapon)) + if (StrEqual(g_sPrimaryWeapon[client], weapon)) { weaponFound = true; break; @@ -208,16 +239,15 @@ void GiveSavedWeapons(int client, bool primary, bool secondary) if (weaponFound) { - GiveSkinnedWeapon(client, g_cPrimaryWeapon[client]); + GiveSkinnedWeapon(client, g_sPrimaryWeapon[client], true); if (!IsFakeClient(client)) - SetClientCookie(client, g_hWeapon_Primary_Cookie, g_cPrimaryWeapon[client]); + SetClientCookie(client, g_hWeapon_Primary_Cookie, g_sPrimaryWeapon[client]); } else { - int random = GetRandomInt(0, g_aPrimaryWeaponsAvailable.Length - 2); - char randomWeapon[24]; + char randomWeapon[32]; g_aPrimaryWeaponsAvailable.GetString(random, randomWeapon, sizeof(randomWeapon)); - GiveSkinnedWeapon(client, randomWeapon); + GiveSkinnedWeapon(client, randomWeapon, true, true); if (!IsFakeClient(client)) SetClientCookie(client, g_hWeapon_Primary_Cookie, "random"); } @@ -225,28 +255,29 @@ void GiveSavedWeapons(int client, bool primary, bool secondary) } if (secondary) { - if (g_cvDM_gun_menu_mode.IntValue == 3 && StrEqual(g_cSecondaryWeapon[client], "none")) - g_cSecondaryWeapon[client] = "random"; - if (!StrEqual(g_cSecondaryWeapon[client], "none")) + if (g_cvDM_gun_menu_mode.IntValue == 3 && strcmp(g_sSecondaryWeapon[client], "none") == 0) + g_sSecondaryWeapon[client] = "random"; + + if (!StrEqual(g_sSecondaryWeapon[client], "none") && g_aSecondaryWeaponsAvailable.Length != 0) { - if (StrEqual(g_cSecondaryWeapon[client], "random")) + int random = GetRandomInt(0, g_aSecondaryWeaponsAvailable.Length - 1); + if (strcmp(g_sSecondaryWeapon[client], "random") == 0) { /* Select random menu item (excluding "Random" option) */ - int random = GetRandomInt(0, g_aSecondaryWeaponsAvailable.Length - 2); - char randomWeapon[24]; + char randomWeapon[32]; g_aSecondaryWeaponsAvailable.GetString(random, randomWeapon, sizeof(randomWeapon)); - GiveSkinnedWeapon(client, randomWeapon); + GiveSkinnedWeapon(client, randomWeapon, false, true); if (!IsFakeClient(client)) SetClientCookie(client, g_hWeapon_Secondary_Cookie, "random"); } else { bool weaponFound = false; - char weapon[24]; + char weapon[32]; for (int i = 0; i < g_aSecondaryWeaponsAvailable.Length; i++) { g_aSecondaryWeaponsAvailable.GetString(i, weapon, sizeof(weapon)); - if (StrEqual(g_cSecondaryWeapon[client], weapon)) + if (StrEqual(g_sSecondaryWeapon[client], weapon)) { weaponFound = true; break; @@ -255,16 +286,15 @@ void GiveSavedWeapons(int client, bool primary, bool secondary) if (weaponFound) { - GiveSkinnedWeapon(client, g_cSecondaryWeapon[client]); + GiveSkinnedWeapon(client, g_sSecondaryWeapon[client], false); if (!IsFakeClient(client)) - SetClientCookie(client, g_hWeapon_Secondary_Cookie, g_cSecondaryWeapon[client]); + SetClientCookie(client, g_hWeapon_Secondary_Cookie, g_sSecondaryWeapon[client]); } else { - int random = GetRandomInt(0, g_aSecondaryWeaponsAvailable.Length - 2); - char randomWeapon[24]; + char randomWeapon[32]; g_aSecondaryWeaponsAvailable.GetString(random, randomWeapon, sizeof(randomWeapon)); - GiveSkinnedWeapon(client, randomWeapon); + GiveSkinnedWeapon(client, randomWeapon, false, true); if (!IsFakeClient(client)) SetClientCookie(client, g_hWeapon_Secondary_Cookie, "random"); } @@ -315,79 +345,80 @@ void GiveSavedWeapons(int client, bool primary, bool secondary) SetClientCookie(client, g_hWeapon_Remember_Cookie, "1"); } + PreviousClientWeapons(client); } } } -int GetWeaponAmmoCount(char[] weaponName, bool currentClip) +public int GetWeaponAmmoCount(char[] weaponName, bool currentClip) { - if (StrEqual(weaponName, "weapon_ak47")) + if (strcmp(weaponName, "weapon_ak47") == 0) return currentClip ? 30 : 90; - else if (StrEqual(weaponName, "weapon_m4a1")) + else if (strcmp(weaponName, "weapon_m4a1") == 0) return currentClip ? 30 : 90; - else if (StrEqual(weaponName, "weapon_m4a1_silencer")) - return currentClip ? 25 : 75; - else if (StrEqual(weaponName, "weapon_awp")) + else if (strcmp(weaponName, "weapon_m4a1_silencer") == 0) + return currentClip ? 20 : 80; + else if (strcmp(weaponName, "weapon_awp") == 0) return currentClip ? 10 : 30; - else if (StrEqual(weaponName, "weapon_sg552")) + else if (strcmp(weaponName, "weapon_sg552") == 0) return currentClip ? 30 : 90; - else if (StrEqual(weaponName, "weapon_aug")) + else if (strcmp(weaponName, "weapon_aug") == 0) return currentClip ? 30 : 90; - else if (StrEqual(weaponName, "weapon_p90")) + else if (strcmp(weaponName, "weapon_p90") == 0) return currentClip ? 50 : 100; - else if (StrEqual(weaponName, "weapon_galilar")) + else if (strcmp(weaponName, "weapon_galilar") == 0) return currentClip ? 35 : 90; - else if (StrEqual(weaponName, "weapon_famas")) + else if (strcmp(weaponName, "weapon_famas") == 0) return currentClip ? 25 : 90; - else if (StrEqual(weaponName, "weapon_ssg08")) + else if (strcmp(weaponName, "weapon_ssg08") == 0) return currentClip ? 10 : 90; - else if (StrEqual(weaponName, "weapon_g3sg1")) + else if (strcmp(weaponName, "weapon_g3sg1") == 0) return currentClip ? 20 : 90; - else if (StrEqual(weaponName, "weapon_scar20")) + else if (strcmp(weaponName, "weapon_scar20") == 0) return currentClip ? 20 : 90; - else if (StrEqual(weaponName, "weapon_m249")) + else if (strcmp(weaponName, "weapon_m249") == 0) return currentClip ? 100 : 200; - else if (StrEqual(weaponName, "weapon_negev")) + else if (strcmp(weaponName, "weapon_negev") == 0) return currentClip ? 150 : 200; - else if (StrEqual(weaponName, "weapon_nova")) + else if (strcmp(weaponName, "weapon_nova") == 0) return currentClip ? 8 : 32; - else if (StrEqual(weaponName, "weapon_xm1014")) + else if (strcmp(weaponName, "weapon_xm1014") == 0) return currentClip ? 7 : 32; - else if (StrEqual(weaponName, "weapon_sawedoff")) + else if (strcmp(weaponName, "weapon_sawedoff") == 0) return currentClip ? 7 : 32; - else if (StrEqual(weaponName, "weapon_mag7")) + else if (strcmp(weaponName, "weapon_mag7") == 0) return currentClip ? 5 : 32; - else if (StrEqual(weaponName, "weapon_mac10")) + else if (strcmp(weaponName, "weapon_mac10") == 0) return currentClip ? 30 : 100; - else if (StrEqual(weaponName, "weapon_mp9")) + else if (strcmp(weaponName, "weapon_mp9") == 0) return currentClip ? 30 : 120; - else if (StrEqual(weaponName, "weapon_mp7")) + else if (strcmp(weaponName, "weapon_mp7") == 0) return currentClip ? 30 : 120; - else if (StrEqual(weaponName, "weapon_mp5sd")) + else if (strcmp(weaponName, "weapon_mp5sd") == 0) return currentClip ? 30 : 120; - else if (StrEqual(weaponName, "weapon_ump45")) + else if (strcmp(weaponName, "weapon_ump45") == 0) return currentClip ? 25 : 100; - else if (StrEqual(weaponName, "weapon_bizon")) + else if (strcmp(weaponName, "weapon_bizon") == 0) return currentClip ? 64 : 120; - else if (StrEqual(weaponName, "weapon_glock")) + else if (strcmp(weaponName, "weapon_glock") == 0) return currentClip ? 20 : 120; - else if (StrEqual(weaponName, "weapon_fiveseven")) + else if (strcmp(weaponName, "weapon_fiveseven") == 0) return currentClip ? 20 : 100; - else if (StrEqual(weaponName, "weapon_deagle")) + else if (strcmp(weaponName, "weapon_deagle") == 0) return currentClip ? 7 : 35; - else if (StrEqual(weaponName, "weapon_revolver")) + else if (strcmp(weaponName, "weapon_revolver") == 0) return currentClip ? 8 : 8; - else if (StrEqual(weaponName, "weapon_hkp2000")) + else if (strcmp(weaponName, "weapon_hkp2000") == 0) return currentClip ? 13 : 52; - else if (StrEqual(weaponName, "weapon_usp_silencer")) + else if (strcmp(weaponName, "weapon_usp_silencer") == 0) return currentClip ? 12 : 24; - else if (StrEqual(weaponName, "weapon_p250")) + else if (strcmp(weaponName, "weapon_p250") == 0) return currentClip ? 13 : 26; - else if (StrEqual(weaponName, "weapon_elite")) + else if (strcmp(weaponName, "weapon_elite") == 0) return currentClip ? 30 : 120; - else if (StrEqual(weaponName, "weapon_tec9")) + else if (strcmp(weaponName, "weapon_tec9") == 0) return currentClip ? 24 : 120; - else if (StrEqual(weaponName, "weapon_cz75a")) + else if (strcmp(weaponName, "weapon_cz75a") == 0) return currentClip ? 12 : 12; return currentClip ? 30 : 90; } @@ -449,7 +480,7 @@ void Ammo_FullRefill(int weaponRef, any client) int weaponEntity = EntRefToEntIndex(weaponRef); if (IsValidEdict(weaponEntity)) { - char weaponName[35]; + char weaponName[64]; char clipSize; int maxAmmoCount; int ammoType = GetEntProp(weaponEntity, Prop_Send, "m_iPrimaryAmmoType", 1) * 4; @@ -472,12 +503,45 @@ void Ammo_FullRefill(int weaponRef, any client) } } +void PreviousClientWeapons(int client) +{ + int entProp; + int entityIndex; + int weaponEntity; + char weaponName[32]; + + for (int i = 0; i < 4; i++) + { + if ((entityIndex = GetPlayerWeaponSlot(client, i)) != -1) + { + if (GetEntityClassname(entityIndex, weaponName, sizeof(weaponName))) + { + weaponEntity = EntIndexToEntRef(entityIndex); + entProp = GetEntProp(weaponEntity, Prop_Send, "m_iItemDefinitionIndex"); + switch (entProp) + { + case 60: strcopy(weaponName, sizeof(weaponName), "weapon_m4a1_silencer"); + case 61: strcopy(weaponName, sizeof(weaponName), "weapon_usp_silencer"); + case 63: strcopy(weaponName, sizeof(weaponName), "weapon_cz75a"); + case 64: strcopy(weaponName, sizeof(weaponName), "weapon_revolver"); + } + + if (i == CS_SLOT_PRIMARY) + g_sPrimaryWeaponPrevious[client] = weaponName; + else if (i == CS_SLOT_SECONDARY) + g_sSecondaryWeaponPrevious[client] = weaponName; + } + } + } +} + void RemoveClientWeapons(int client) { + int entityIndex; + for (int i = 0; i < 4; i++) { - int entityIndex; - while ((entityIndex = GetPlayerWeaponSlot(client, i)) != -1) + if ((entityIndex = GetPlayerWeaponSlot(client, i)) != -1) { RemovePlayerItem(client, entityIndex); RemoveEntity(entityIndex); @@ -492,12 +556,14 @@ void RemoveGroundWeapons() for (int i = MaxClients + 1; i < MaxEntities; i++) { - if (IsValidEdict(i) && HasEntProp(i, Prop_Send, "m_hOwnerEntity") && (GetEntPropEnt(i, Prop_Send, "m_hOwnerEntity") == -1)) + if (!IsValidEdict(i)) continue; + + if (HasEntProp(i, Prop_Send, "m_hOwnerEntity") && (GetEntPropEnt(i, Prop_Send, "m_hOwnerEntity") == -1)) { GetEdictClassname(i, class, sizeof(class)); if ((StrContains(class, "weapon_") != -1) || (StrContains(class, "item_") != -1)) { - if (StrEqual(class, "weapon_c4")) + if (strcmp(class, "weapon_c4") == 0) { if (!g_cvDM_remove_objectives.BoolValue) continue; diff --git a/scripting/deathmatch_loader.sp b/scripting/deathmatch_loader.sp index dd0090d..dbd4f4c 100644 --- a/scripting/deathmatch_loader.sp +++ b/scripting/deathmatch_loader.sp @@ -1,9 +1,23 @@ +/** + * [CS:GO] Deathmatch Loader + * + * Copyright (C) 2020 Maxximous 'Maxximou5' Ambrosio + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see http://www.gnu.org/licenses/. + */ + #include -#include -#include -#include -#include -#include +#include #pragma newdecls required @@ -11,7 +25,7 @@ #define PLUGIN_NAME "[CS:GO] Deathmatch Loader" #define PLUGIN_AUTHOR "Maxximou5" #define PLUGIN_DESCRIPTION "Loads Deathmatch configuration files based on events or at specified times." -#define PLUGIN_URL "https://github.com/Maxximou5/csgo-deathmatch/" +#define PLUGIN_URL "https://github.com/Maxximou5/csgo-deathmatch-loader/" public Plugin myinfo = { @@ -99,7 +113,10 @@ public void OnMapTimeLeftChanged() int iTimeleft; if (GetMapTimeLeft(iTimeleft) && iTimeleft > 0) + { + PrintToServer("Timeleft: %i", iTimeleft); g_hTimer = CreateTimer(60.0, Timer_ExecTimeleftConfig, _, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); + } } public void OnClientPutInServer(int client) @@ -171,10 +188,14 @@ public Action Timer_ExecTimeleftConfig(Handle timer) if (!GetMapTimeLeft(iTimeleft) || iTimeleft < 0) return Plugin_Continue; + PrintToServer("Timeleft: %i", iTimeleft); + char sTimeleft[4]; IntToString(iTimeleft / 60, sTimeleft, sizeof(sTimeleft)); ExecConfig(TIMELEFT, sTimeleft); + PrintToServer("Timeleft: %s", sTimeleft); + return Plugin_Continue; } @@ -213,7 +234,7 @@ void ExecClientsConfig(int client) client += GetClientCount(); else { - for(int i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i)) continue; diff --git a/scripting/include/colorlib.inc b/scripting/include/colorlib.inc new file mode 100644 index 0000000..b3381b7 --- /dev/null +++ b/scripting/include/colorlib.inc @@ -0,0 +1,683 @@ +#if defined _colorlib_included + #endinput +#endif +#define _colorlib_included + +#include + +#define MAX_MESSAGE_LENGTH 512 + +#define SERVER_INDEX 0 +#define NO_INDEX -1 +#define NO_PLAYER -2 + +/* CL_Colors' properties */ +bool _CL_proto_buff_support; +int _CL_buffer_index; +int _CL_buffer_size; +char _CL_buffer[MAX_MESSAGE_LENGTH]; +char _CL_buffer_tag[MAX_MESSAGE_LENGTH]; +bool _CL_skip_list[MAXPLAYERS + 1] = { false, ... }; + +/** + * Prints a message to a specific client in the chat area. + * Supports color tags. + * + * @param client Client index. + * @param message Message (formatting rules). + * @return No return + * + * On error/Errors: If the client is not connected an error will be thrown. + */ +stock void CPrintToChat(int client, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToChat(client, _CL_buffer); +} + +/** + * Prints a message to a specific client in the chat area. + * Supports color tags. + * + * @param client Client index. + * @param author Author index whose color will be used for teamcolor tag. + * @param message Message (formatting rules). + * @return No return + * + * On error/Errors: If the client or author are not connected an error will be thrown. + */ +stock void CPrintToChatEx(int client, int author, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + _CL_SendChatMessage(client, author, _CL_buffer); +} + +/** + * Prints a message to all clients in the chat area. + * Supports color tags. + * + * @param client Client index. + * @param message Message (formatting rules) + * @return No return + */ +stock void CPrintToChatAll(const char[] message, any ...) +{ + for (int i = 1; i <= MaxClients; ++i) + { + if (IsClientInGame(i) && !IsFakeClient(i) && !_CL_skip_list[i]) + { + SetGlobalTransTarget(i); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 2); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToChat(i, _CL_buffer); + } + + _CL_skip_list[i] = false; + } +} + +/** + * Prints a message to all clients in the chat area. + * Supports color tags. + * + * @param author Author index whos color will be used for teamcolor tag. + * @param message Message (formatting rules). + * @return No return + * + * On error/Errors: If the author is not connected an error will be thrown. + */ +stock void CPrintToChatAllEx(int author, const char[] message, any ...) +{ + for (int i = 1; i <= MaxClients; ++i) + { + if (IsClientInGame(i) && !IsFakeClient(i) && !_CL_skip_list[i]) + { + SetGlobalTransTarget(i); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + _CL_SendChatMessage(i, author, _CL_buffer); + } + + _CL_skip_list[i] = false; + } +} + +/** + * Prints a message to all clients on a specific team. + * Supports color tags. + * + * @param team Team index. + * @param message Message (formatting rules). + * @return No return + * + * On error/Errors: If the client is not connected an error will be thrown. + */ +stock void CPrintToChatTeam(int team, const char[] message, any ...) +{ + for (int i = 1; i <= MaxClients; ++i) + { + if (IsClientInGame(i) && + !IsFakeClient(i) && + !_CL_skip_list[i] && + GetClientTeam(i) == team) + { + SetGlobalTransTarget(i); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToChat(i, _CL_buffer); + } + + _CL_skip_list[i] = false; + } +} + +/** + * Prints a message to all clients on a specific team. + * Supports color tags. + * + * @param team Team index. + * @param author Author index whos color will be used for teamcolor tag. + * @param message Message (formatting rules). + * @return No return + * + * On error/Errors: If the client is not connected an error will be thrown. + */ +stock void CPrintToChatTeamEx(int team, int author, const char[] message, any ...) +{ + for (int i = 1; i <= MaxClients; ++i) + { + if (IsClientInGame(i) && + !IsFakeClient(i) && + !_CL_skip_list[i] && + GetClientTeam(i) == team) + { + SetGlobalTransTarget(i); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + _CL_SendChatMessage(i, author, _CL_buffer); + } + + _CL_skip_list[i] = false; + } +} + +/** + * Prints a message to all admins with the given access flags. + * Supports color tags. + * + * @param flags Admin flags. + * @param message Message (formatting rules). + * @return No return + * + * On error/Errors: If the client is not connected an error will be thrown. + */ +stock void CPrintToChatAdmins(int flags, const char[] message, any ...) +{ + for (int i = 1; i <= MaxClients; ++i) + { + if (IsClientInGame(i) && !IsFakeClient(i) && !_CL_skip_list[i]) + { + if (CheckCommandAccess(i, "colorlib_admin", flags, true)) + { + SetGlobalTransTarget(i); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToChat(i, _CL_buffer); + } + } + + _CL_skip_list[i] = false; + } +} + +/** + * Reples to a message in a command. A client index of 0 will use PrintToServer(). + * If the command was from the console, PrintToConsole() is used. If the command was from chat, C_PrintToChat() is used. + * Supports color tags. + * + * @param client Client index, or 0 for server. + * @param message Formatting rules. + * @param ... Variable number of format parameters. + * @return No return + * + * On error/Errors: If the client is not connected or invalid. + */ +stock void CReplyToCommand(int client, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + if (client == 0) + { + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CRemoveTags(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToServer(_CL_buffer[_CL_buffer_index]); + } + else if (GetCmdReplySource() == SM_REPLY_TO_CONSOLE) + { + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CRemoveTags(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToConsole(client, _CL_buffer[_CL_buffer_index]); + } + else + { + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToChat(client, _CL_buffer); + } +} + +/** + * Reples to a message in a command. A client index of 0 will use PrintToServer(). + * If the command was from the console, PrintToConsole() is used. If the command was from chat, C_PrintToChat() is used. + * Supports color tags. + * + * @param client Client index, or 0 for server. + * @param author Author index whose color will be used for teamcolor tag. + * @param message Formatting rules. + * @param ... Variable number of format parameters. + * @return No return + * + * On error/Errors: If the client is not connected or invalid. + */ +stock void CReplyToCommandEx(int client, int author, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + if (client == 0) + { + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CRemoveTags(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToServer(_CL_buffer[_CL_buffer_index]); + } + else if (GetCmdReplySource() == SM_REPLY_TO_CONSOLE) + { + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CRemoveTags(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToConsole(client, _CL_buffer[_CL_buffer_index]); + } + else + { + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + _CL_SendChatMessage(client, author, _CL_buffer); + } +} + +/** + * Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar. + * This version does not display a message to the originating client if used from chat triggers or menus. If manual replies are used for these cases, then this function will suffice. Otherwise, ShowActivity2() is slightly more useful. + * Supports color tags. + * + * @param client Client index, or 0 for server. + * @param message Formatting rules. + * @param ... Variable number of format parameters. + * @return No return + * + * On error/Errors: If the client is not connected or invalid. + */ +stock void CShowActivity(int client, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 3); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + ShowActivity(client, _CL_buffer[_CL_buffer_index]); +} + +/** + * Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar. All users receive a message in their chat text, except for the originating client, who receives the message based on the current ReplySource. + * Supports color tags. + * + * @param client Client index, or 0 for server. + * @param message Formatting rules. + * @param ... Variable number of format parameters. + * @return No return + * + * On error/Errors: If the client is not connected or invalid. + */ +stock void CShowActivity2(int client, const char[] tag, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + strcopy(_CL_buffer_tag, sizeof(_CL_buffer_tag), tag); + CFormat(_CL_buffer_tag, sizeof(_CL_buffer_tag)); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + + ShowActivity2(client, _CL_buffer_tag, _CL_buffer); +} + +/** + * Same as ShowActivity(), except the tag parameter is used instead of "[SM] " (note that you must supply any spacing). + * Supports color tags. + * + * @param client Client index, or 0 for server. + * @param message Formatting rules. + * @param ... Variable number of format parameters. + * @return No return + * + * On error/Errors: If the client is not connected or invalid. + */ +stock void CShowActivityEx(int client, const char[] tag, const char[] message, any ...) +{ + SetGlobalTransTarget(client); + + strcopy(_CL_buffer_tag, sizeof(_CL_buffer_tag), tag); + CFormat(_CL_buffer_tag, sizeof(_CL_buffer_tag)); + + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 4); + CFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + + ShowActivityEx(client, _CL_buffer_tag, _CL_buffer); +} + +/** + * Replaces PrintToServer. + * Removes color tags. + * + * @param message Formatting rules. + * @param ... Variable number of format parameters. + * @return No return + */ +stock void CPrintToServer(const char[] message, any ...) +{ + VFormat(_CL_buffer[_CL_buffer_index], _CL_buffer_size, message, 2); + CRemoveTags(_CL_buffer[_CL_buffer_index], _CL_buffer_size); + PrintToServer(_CL_buffer[_CL_buffer_index]); +} + +/** + * Gets a clients name that is safe to use with Color Lib. + * + * @param client Client index. + * @param name Buffer to store the clients name. + * @param maxlength The size of the buffer. + * @return No return + */ +stock void CGetClientName(int client, char[] name, int maxlength, bool remove = true) +{ + GetClientName(client, name, maxlength); + if (remove) + { + CRemoveTags(name, maxlength); + } + else + { + CEscapeTags(name, maxlength); + } +} + +/** + * Removes color tags from the string. + * E.g. "{default}Hello {red}World" -> "Hello World". + * + * @param message String. + * @param maxlength Size of the message buffer. + * @return No return + */ +stock void CRemoveTags(char[] message, int maxlength) +{ + int index = 0; + for (int i = 0; i < maxlength; ++i) + { + if (message[i] == 0x00) + { + break; + } + + if (message[i] == '{') + { + ++i; + while (message[i] != '}') + { + ++i; + } + } + else if (message[i] == '\\') + { + ++i; + if (message[i] == '{') + { + message[index] = '{'; + } + else + { + message[index] = '\\'; + --i; + } + + ++index; + } + else + { + message[index] = message[i]; + ++index; + } + } + + message[index] = 0x00; +} + +/** + * Removes colors escape codes from the string. + * E.g. "\x01Hello \x02World" -> "Hello World". + * + * @param message String. + * @param maxlength Size of the message buffer. + * @return No return + */ +stock void CRemoveColors(char[] message, int maxlength) +{ + int index = 0; + for (int i = 0; i < maxlength; ++i) + { + if (message[i] == 0x00) + { + break; + } + + if (message[i] >= 0x01 && message[i] <= 0x10) + { + ++i; + } + + message[index] = message[i]; + ++index; + } + + message[index] = 0x00; +} + +/** + * Escapes colors escape codes from the string. + * E.g. "{red}Hello {blue}World" -> "\{red}Hello \{blue}World". + * This means they shal be ignored by CFormat, useful for sanitising player + * names for printing. + * + * @param message String. + * @param maxlength Size of the message buffer. + * @return No return + */ +stock void CEscapeTags(char[] message, int maxlength) +{ + int index = 0; + for (int i = 0; i < maxlength; ++i) + { + if (message[i] == 0x00) + { + break; + } + + if (message[i] == '{') + { + message[index] = '\\'; + ++index; + message[index] = '{'; + ++index; + } + else if (message[i] == '\\') + { + ++i; + if (message[i] == '{') + { + message[index] = '\\'; + ++index; + message[index] = '{'; + } + else + { + message[index] = '\\'; + --i; + } + + ++index; + } + else + { + message[index] = message[i]; + ++index; + } + } + + message[index] = 0x00; +} + +/** + * This function should only be used right in front of + * C_PrintToChatAll or C_PrintToChatAllEx and it tells + * to those funcions to skip specified client when printing + * message to all clients. After message is printed client will + * no more be skipped. + * + * @param client Client index + * @return No return + */ +stock void CSkipNextClient(int client) +{ + if (client < 1 || client > MaxClients) + ThrowError("Invalid client index %d", client); + + _CL_skip_list[client] = true; +} + +/** + * Initialises the _CL_buffer for color formatting + * + * @param message String. + * @return First free index in the array + */ +stock int CPreFormat(char[] message) +{ + int index = 0; + // If CS:GO set invisible precolor + if (GetEngineVersion() == Engine_CSGO) + { + message[0] = ' '; + ++index; + } + + message[index] = 0x01; + ++index; + + return index; +} + +/** + * Replaces color tags in a string with color codes + * + * @param message String. + * @param maxlength Size of the message buffer. + * @return Client index that can be used for SayText2 author index + * + * On error/Errors: If there is more then one team color is used an error will be thrown. + */ +stock void CFormat(char[] message, int maxlength) +{ + int index = 0; + for (int i = 0; i < maxlength; ++i) + { + if (message[i] == 0x00) + { + break; + } + + if (message[i] == '{') + { + ++i; + int length = 0; + char cc = view_as(_CL_ColorMap(message[i], length)); + if (cc) + { + message[index] = cc; + i += length; + } + else + { + message[index] = '{'; + } + + /* we need to unpeek the increment for skipping over all of the + * color tag + so we dont skip a char for a bad tag */ + --i; + ++index; + } + else if (message[i] == '\\') + { + ++i; + if (message[i] == '{') + { + message[index] = '{'; + } + else + { + message[index] = '\\'; + --i; + } + + ++index; + } + else + { + message[index] = message[i]; + ++index; + } + } + + message[index] = 0x00; +} + +/** + * Sends a SayText2 usermessage to a client + * + * @param message Client index + * @param author Author index + * @param message Message + * @return No return. + */ +stock void CSayText2(int client, int author, const char[] message) +{ + if (_CL_proto_buff_support) + { + Protobuf pbMessage = view_as(StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS)); + pbMessage.SetInt("ent_idx", author); + pbMessage.SetBool("chat", true); + pbMessage.SetString("msg_name", message); + pbMessage.AddString("params", ""); + pbMessage.AddString("params", ""); + pbMessage.AddString("params", ""); + pbMessage.AddString("params", ""); + } + else + { + Handle hMessage = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS); + BfWriteByte(hMessage, author); + BfWriteByte(hMessage, true); + BfWriteString(hMessage, message); + } + + EndMessage(); +} + +/** + * Sends a message to a client. + * + * @param message Client index + * @param author Author index + * @param message Message + * @return No return. + */ +stock void _CL_SendChatMessage(int client, int author, char[] message) +{ + if (author) + { + CSayText2(client, author, message); + } + else + { + PrintToChat(client, message); + } +} + +/* BADNESS BELOW THIS LINE DO NOT EDIT */ + +public void OnPluginStart() +{ + _CL_proto_buff_support = (GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available) && (GetUserMessageType() == UM_Protobuf); + _CL_buffer_index = CPreFormat(_CL_buffer); + _CL_buffer_size = sizeof(_CL_buffer) - _CL_buffer_index; + _CL_OnPluginStart(); +} + +#define OnPluginStart _CL_OnPluginStart diff --git a/scripting/include/colorlib_map.inc b/scripting/include/colorlib_map.inc new file mode 100644 index 0000000..c93c04c --- /dev/null +++ b/scripting/include/colorlib_map.inc @@ -0,0 +1,341 @@ +// +// This file was generated with color_gen.py and should not be used outside of colorlib.inc +// +// Do not edit! Regenerate this file with color_gen.py (see https://github.com/c0rp3n/colorlib-gen) +// + +#if defined _colorlib_map_included + #endinput +#endif +#define _colorlib_map_included + +enum CL_Color +{ + CL_Color_Default = 0x01, + CL_Color_Prefix = 0x04, + CL_Color_Reply2cmd = 0x01, + CL_Color_Showactivity = 0x01, + CL_Color_Error = 0x07, + CL_Color_Highlight = 0x10, + CL_Color_Player = 0x09, + CL_Color_Settings = 0x02, + CL_Color_Command = 0x02, + CL_Color_Team_0 = 0x08, + CL_Color_Team_1 = 0x09, + CL_Color_Team_2 = 0x11, + CL_Color_Teamcolor = 0x03, + CL_Color_Red = 0x07, + CL_Color_Lightred = 0x0F, + CL_Color_Darkred = 0x02, + CL_Color_Bluegrey = 0x0A, + CL_Color_Blue = 0x0B, + CL_Color_Darkblue = 0x0C, + CL_Color_Purple = 0x03, + CL_Color_Orchid = 0x0E, + CL_Color_Orange = 0x10, + CL_Color_Yellow = 0x09, + CL_Color_Gold = 0x10, + CL_Color_Lightgreen = 0x05, + CL_Color_Green = 0x04, + CL_Color_Lime = 0x06, + CL_Color_Grey = 0x08, + CL_Color_Grey2 = 0x0D, + CL_Color_Engine_1 = 0x01, + CL_Color_Engine_2 = 0x02, + CL_Color_Engine_3 = 0x03, + CL_Color_Engine_4 = 0x04, + CL_Color_Engine_5 = 0x05, + CL_Color_Engine_6 = 0x06, + CL_Color_Engine_7 = 0x07, + CL_Color_Engine_8 = 0x08, + CL_Color_Engine_9 = 0x09, + CL_Color_Engine_10 = 0x0A, + CL_Color_Engine_11 = 0x0B, + CL_Color_Engine_12 = 0x0C, + CL_Color_Engine_13 = 0x0D, + CL_Color_Engine_14 = 0x0E, + CL_Color_Engine_15 = 0x0F, + CL_Color_Engine_16 = 0x10, +}; + +CL_Color _CL_ColorMap(const char[] color, int& length) +{ + if (color[0] == 'e') + { + if (color[1] == 'n') + { + if (color[7] == '1') + { + if (color[8] == '}') + { + length = 9; + return CL_Color_Engine_1; + } + else if (color[8] == '0') + { + length = 10; + return CL_Color_Engine_10; + } + else if (color[8] == '1') + { + length = 10; + return CL_Color_Engine_11; + } + else if (color[8] == '2') + { + length = 10; + return CL_Color_Engine_12; + } + else if (color[8] == '3') + { + length = 10; + return CL_Color_Engine_13; + } + else if (color[8] == '4') + { + length = 10; + return CL_Color_Engine_14; + } + else if (color[8] == '5') + { + length = 10; + return CL_Color_Engine_15; + } + else if (color[8] == '6') + { + length = 10; + return CL_Color_Engine_16; + } + } + else if (color[7] == '2') + { + length = 9; + return CL_Color_Engine_2; + } + else if (color[7] == '3') + { + length = 9; + return CL_Color_Engine_3; + } + else if (color[7] == '4') + { + length = 9; + return CL_Color_Engine_4; + } + else if (color[7] == '5') + { + length = 9; + return CL_Color_Engine_5; + } + else if (color[7] == '6') + { + length = 9; + return CL_Color_Engine_6; + } + else if (color[7] == '7') + { + length = 9; + return CL_Color_Engine_7; + } + else if (color[7] == '8') + { + length = 9; + return CL_Color_Engine_8; + } + else if (color[7] == '9') + { + length = 9; + return CL_Color_Engine_9; + } + } + else if (color[1] == 'r') + { + length = 6; + return CL_Color_Error; + } + } + else if (color[0] == 't') + { + if (color[4] == ' ') + { + if (color[5] == '0') + { + length = 7; + return CL_Color_Team_0; + } + else if (color[5] == '1') + { + length = 7; + return CL_Color_Team_1; + } + else if (color[5] == '2') + { + length = 7; + return CL_Color_Team_2; + } + } + else if (color[4] == 'c') + { + length = 10; + return CL_Color_Teamcolor; + } + } + else if (color[0] == 'g') + { + if (color[1] == 'r') + { + if (color[3] == 'y') + { + if (color[4] == '}') + { + length = 5; + return CL_Color_Grey; + } + else if (color[4] == '2') + { + length = 6; + return CL_Color_Grey2; + } + } + else if (color[3] == 'e') + { + length = 6; + return CL_Color_Green; + } + } + else if (color[1] == 'o') + { + length = 5; + return CL_Color_Gold; + } + } + else if (color[0] == 'd') + { + if (color[1] == 'a') + { + if (color[4] == 'r') + { + length = 8; + return CL_Color_Darkred; + } + else if (color[4] == 'b') + { + length = 9; + return CL_Color_Darkblue; + } + } + else if (color[1] == 'e') + { + length = 8; + return CL_Color_Default; + } + } + else if (color[0] == 'p') + { + if (color[1] == 'r') + { + length = 7; + return CL_Color_Prefix; + } + else if (color[1] == 'l') + { + length = 7; + return CL_Color_Player; + } + else if (color[1] == 'u') + { + length = 7; + return CL_Color_Purple; + } + } + else if (color[0] == 'l') + { + if (color[2] == 'g') + { + if (color[5] == 'r') + { + length = 9; + return CL_Color_Lightred; + } + else if (color[5] == 'g') + { + length = 11; + return CL_Color_Lightgreen; + } + } + else if (color[2] == 'm') + { + length = 5; + return CL_Color_Lime; + } + } + else if (color[0] == 'r') + { + if (color[2] == 'p') + { + length = 10; + return CL_Color_Reply2cmd; + } + else if (color[2] == 'd') + { + length = 4; + return CL_Color_Red; + } + } + else if (color[0] == 's') + { + if (color[1] == 'h') + { + length = 13; + return CL_Color_Showactivity; + } + else if (color[1] == 'e') + { + length = 9; + return CL_Color_Settings; + } + } + else if (color[0] == 'b') + { + if (color[4] == 'g') + { + length = 9; + return CL_Color_Bluegrey; + } + else if (color[4] == '}') + { + length = 5; + return CL_Color_Blue; + } + } + else if (color[0] == 'o') + { + if (color[2] == 'c') + { + length = 7; + return CL_Color_Orchid; + } + else if (color[2] == 'a') + { + length = 7; + return CL_Color_Orange; + } + } + else if (color[0] == 'h') + { + length = 10; + return CL_Color_Highlight; + } + else if (color[0] == 'c') + { + length = 8; + return CL_Color_Command; + } + else if (color[0] == 'y') + { + length = 7; + return CL_Color_Yellow; + } + + return view_as(0x00); +} diff --git a/scripting/include/csgocolors.inc b/scripting/include/csgocolors.inc deleted file mode 100644 index 323aba3..0000000 --- a/scripting/include/csgocolors.inc +++ /dev/null @@ -1,558 +0,0 @@ -/************************************************************************** -* * -* Colored Chat Functions * -* Author: exvel, Editor: Popoklopsi, Powerlord, Bara * -* Version: 1.1.3 * -* * -**************************************************************************/ - - -#if defined _colors_included -#endinput -#endif -#define _colors_included - -#define MAX_MESSAGE_LENGTH 250 -#define MAX_COLORS 16 - -#define SERVER_INDEX 0 -#define NO_INDEX -1 -#define NO_PLAYER -2 - -enum Colors -{ - Color_Default = 0, - Color_Darkred, - Color_Pink, - Color_Green, - Color_Lightgreen, - Color_Lime, - Color_Red, - Color_Grey, - Color_Olive, - Color_A, - Color_Lightblue, - Color_Blue, - Color_D, - Color_Purple, - Color_Darkrange, - Color_Orange -} - -/* Colors' properties */ -new String:CTag[][] = {"{default}", "{darkred}", "{pink}", "{green}", "{lightgreen}", "{lime}", "{red}", "{grey}", "{olive}", "{a}", "{lightblue}", "{blue}", "{d}", "{purple}", "{darkorange}", "{orange}"}; -new String:CTagCode[][] = {"\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10"}; -new bool:CTagReqSayText2[] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}; -new bool:CEventIsHooked = false; -new bool:CSkipList[MAXPLAYERS+1] = {false,...}; - -/* Game default profile */ -new bool:CProfile_Colors[] = {true, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false}; -new CProfile_TeamIndex[] = {NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX, NO_INDEX}; -new bool:CProfile_SayText2 = false; - -/** -* Prints a message to a specific client in the chat area. -* Supports color tags. -* -* @param client Client index. -* @param szMessage Message (formatting rules). -* @return No return -* -* On error/Errors: If the client is not connected an error will be thrown. -*/ -stock CPrintToChat(client, const String:szMessage[], any:...) -{ - if (client <= 0 || client > MaxClients) - ThrowError("Invalid client index %d", client); - - if (!IsClientInGame(client)) - ThrowError("Client %d is not in game", client); - - decl String:szBuffer[MAX_MESSAGE_LENGTH]; - decl String:szCMessage[MAX_MESSAGE_LENGTH]; - - SetGlobalTransTarget(client); - - Format(szBuffer, sizeof(szBuffer), "\x01%s", szMessage); - VFormat(szCMessage, sizeof(szCMessage), szBuffer, 3); - - new index = CFormat(szCMessage, sizeof(szCMessage)); - - if (index == NO_INDEX) - PrintToChat(client, "%s", szCMessage); - else - CSayText2(client, index, szCMessage); -} - -stock CReplyToCommand(client, const String:szMessage[], any:...) -{ - - decl String:szCMessage[MAX_MESSAGE_LENGTH]; - VFormat(szCMessage, sizeof(szCMessage), szMessage, 3); - - if (client == 0) - { - CRemoveTags(szCMessage, sizeof(szCMessage)); - PrintToServer("%s", szCMessage); - } - else if (GetCmdReplySource() == SM_REPLY_TO_CONSOLE) - { - CRemoveTags(szCMessage, sizeof(szCMessage)); - PrintToConsole(client, "%s", szCMessage); - } - else - { - CPrintToChat(client, "%s", szCMessage); - } -} - - -/** -* Prints a message to all clients in the chat area. -* Supports color tags. -* -* @param client Client index. -* @param szMessage Message (formatting rules) -* @return No return -*/ -stock CPrintToChatAll(const String:szMessage[], any:...) -{ - decl String:szBuffer[MAX_MESSAGE_LENGTH]; - - for (new i = 1; i <= MaxClients; i++) - { - if (IsClientInGame(i) && !IsFakeClient(i) && !CSkipList[i]) - { - SetGlobalTransTarget(i); - VFormat(szBuffer, sizeof(szBuffer), szMessage, 2); - - CPrintToChat(i, "%s", szBuffer); - } - - CSkipList[i] = false; - } -} - -/** -* Prints a message to a specific client in the chat area. -* Supports color tags and teamcolor tag. -* -* @param client Client index. -* @param author Author index whose color will be used for teamcolor tag. -* @param szMessage Message (formatting rules). -* @return No return -* -* On error/Errors: If the client or author are not connected an error will be thrown. -*/ -stock CPrintToChatEx(client, author, const String:szMessage[], any:...) -{ - if (client <= 0 || client > MaxClients) - ThrowError("Invalid client index %d", client); - - if (!IsClientInGame(client)) - ThrowError("Client %d is not in game", client); - - if (author < 0 || author > MaxClients) - ThrowError("Invalid client index %d", author); - - decl String:szBuffer[MAX_MESSAGE_LENGTH]; - decl String:szCMessage[MAX_MESSAGE_LENGTH]; - - SetGlobalTransTarget(client); - - Format(szBuffer, sizeof(szBuffer), "\x01%s", szMessage); - VFormat(szCMessage, sizeof(szCMessage), szBuffer, 4); - - new index = CFormat(szCMessage, sizeof(szCMessage), author); - - if (index == NO_INDEX) - PrintToChat(client, "%s", szCMessage); - else - CSayText2(client, author, szCMessage); -} - -/** -* Prints a message to all clients in the chat area. -* Supports color tags and teamcolor tag. -* -* @param author Author index whos color will be used for teamcolor tag. -* @param szMessage Message (formatting rules). -* @return No return -* -* On error/Errors: If the author is not connected an error will be thrown. -*/ -stock CPrintToChatAllEx(author, const String:szMessage[], any:...) -{ - if (author < 0 || author > MaxClients) - ThrowError("Invalid client index %d", author); - - if (!IsClientInGame(author)) - ThrowError("Client %d is not in game", author); - - decl String:szBuffer[MAX_MESSAGE_LENGTH]; - - for (new i = 1; i <= MaxClients; i++) - { - if (IsClientInGame(i) && !IsFakeClient(i) && !CSkipList[i]) - { - SetGlobalTransTarget(i); - VFormat(szBuffer, sizeof(szBuffer), szMessage, 3); - - CPrintToChatEx(i, author, "%s", szBuffer); - } - - CSkipList[i] = false; - } -} - -/** -* Removes color tags from the string. -* -* @param szMessage String. -* @return No return -*/ -stock CRemoveTags(String:szMessage[], maxlength) -{ - for (new i = 0; i < MAX_COLORS; i++) - ReplaceString(szMessage, maxlength, CTag[i], "", false); - - ReplaceString(szMessage, maxlength, "{teamcolor}", "", false); -} - -/** -* Checks whether a color is allowed or not -* -* @param tag Color Tag. -* @return True when color is supported, otherwise false -*/ -stock CColorAllowed(Colors:color) -{ - if (!CEventIsHooked) - { - CSetupProfile(); - - CEventIsHooked = true; - } - - return CProfile_Colors[color]; -} - -/** -* Replace the color with another color -* Handle with care! -* -* @param color color to replace. -* @param newColor color to replace with. -* @noreturn -*/ -stock CReplaceColor(Colors:color, Colors:newColor) -{ - if (!CEventIsHooked) - { - CSetupProfile(); - - CEventIsHooked = true; - } - - CProfile_Colors[color] = CProfile_Colors[newColor]; - CProfile_TeamIndex[color] = CProfile_TeamIndex[newColor]; - - CTagReqSayText2[color] = CTagReqSayText2[newColor]; - Format(CTagCode[color], sizeof(CTagCode[]), CTagCode[newColor]) -} - -/** -* This function should only be used right in front of -* CPrintToChatAll or CPrintToChatAllEx and it tells -* to those funcions to skip specified client when printing -* message to all clients. After message is printed client will -* no more be skipped. -* -* @param client Client index -* @return No return -*/ -stock CSkipNextClient(client) -{ - if (client <= 0 || client > MaxClients) - ThrowError("Invalid client index %d", client); - - CSkipList[client] = true; -} - -/** -* Replaces color tags in a string with color codes -* -* @param szMessage String. -* @param maxlength Maximum length of the string buffer. -* @return Client index that can be used for SayText2 author index -* -* On error/Errors: If there is more then one team color is used an error will be thrown. -*/ -stock CFormat(String:szMessage[], maxlength, author=NO_INDEX) -{ - decl String:szGameName[30]; - - GetGameFolderName(szGameName, sizeof(szGameName)); - - /* Hook event for auto profile setup on map start */ - if (!CEventIsHooked) - { - CSetupProfile(); - HookEvent("server_spawn", CEvent_MapStart, EventHookMode_PostNoCopy); - - CEventIsHooked = true; - } - - new iRandomPlayer = NO_INDEX; - - // On CS:GO set invisible precolor - if (StrEqual(szGameName, "csgo", false)) - Format(szMessage, maxlength, " \x01\x0B\x01%s", szMessage); - - /* If author was specified replace {teamcolor} tag */ - if (author != NO_INDEX) - { - if (CProfile_SayText2) - { - ReplaceString(szMessage, maxlength, "{teamcolor}", "\x03", false); - - iRandomPlayer = author; - } - /* If saytext2 is not supported by game replace {teamcolor} with green tag */ - else - ReplaceString(szMessage, maxlength, "{teamcolor}", CTagCode[Color_Green], false); - } - else - ReplaceString(szMessage, maxlength, "{teamcolor}", "", false); - - /* For other color tags we need a loop */ - for (new i = 0; i < MAX_COLORS; i++) - { - /* If tag not found - skip */ - if (StrContains(szMessage, CTag[i], false) == -1) - continue; - - /* If tag is not supported by game replace it with green tag */ - else if (!CProfile_Colors[i]) - ReplaceString(szMessage, maxlength, CTag[i], CTagCode[Color_Green], false); - - /* If tag doesn't need saytext2 simply replace */ - else if (!CTagReqSayText2[i]) - ReplaceString(szMessage, maxlength, CTag[i], CTagCode[i], false); - - /* Tag needs saytext2 */ - else - { - /* If saytext2 is not supported by game replace tag with green tag */ - if (!CProfile_SayText2) - ReplaceString(szMessage, maxlength, CTag[i], CTagCode[Color_Green], false); - - /* Game supports saytext2 */ - else - { - /* If random player for tag wasn't specified replace tag and find player */ - if (iRandomPlayer == NO_INDEX) - { - /* Searching for valid client for tag */ - iRandomPlayer = CFindRandomPlayerByTeam(CProfile_TeamIndex[i]); - - /* If player not found replace tag with green color tag */ - if (iRandomPlayer == NO_PLAYER) - ReplaceString(szMessage, maxlength, CTag[i], CTagCode[Color_Green], false); - - /* If player was found simply replace */ - else - ReplaceString(szMessage, maxlength, CTag[i], CTagCode[i], false); - - } - /* If found another team color tag throw error */ - else - { - //ReplaceString(szMessage, maxlength, CTag[i], ""); - ThrowError("Using two team colors in one message is not allowed"); - } - } - - } - } - - return iRandomPlayer; -} - -/** -* Founds a random player with specified team -* -* @param color_team Client team. -* @return Client index or NO_PLAYER if no player found -*/ -stock CFindRandomPlayerByTeam(color_team) -{ - if (color_team == SERVER_INDEX) - return 0; - else - { - for (new i = 1; i <= MaxClients; i++) - { - if (IsClientInGame(i) && GetClientTeam(i) == color_team) - return i; - } - } - - return NO_PLAYER; -} - -/** -* Sends a SayText2 usermessage to a client -* -* @param szMessage Client index -* @param maxlength Author index -* @param szMessage Message -* @return No return. -*/ -stock CSayText2(client, author, const String:szMessage[]) -{ - new Handle:hBuffer = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS); - - if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) - { - PbSetInt(hBuffer, "ent_idx", author); - PbSetBool(hBuffer, "chat", true); - PbSetString(hBuffer, "msg_name", szMessage); - PbAddString(hBuffer, "params", ""); - PbAddString(hBuffer, "params", ""); - PbAddString(hBuffer, "params", ""); - PbAddString(hBuffer, "params", ""); - } - else - { - BfWriteByte(hBuffer, author); - BfWriteByte(hBuffer, true); - BfWriteString(hBuffer, szMessage); - } - - EndMessage(); -} - -/** -* Creates game color profile -* This function must be edited if you want to add more games support -* -* @return No return. -*/ -stock CSetupProfile() -{ - decl String:szGameName[30]; - GetGameFolderName(szGameName, sizeof(szGameName)); - - if (StrEqual(szGameName, "cstrike", false)) - { - CProfile_Colors[Color_Lightgreen] = true; - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_Colors[Color_Olive] = true; - CProfile_TeamIndex[Color_Lightgreen] = SERVER_INDEX; - CProfile_TeamIndex[Color_Red] = 2; - CProfile_TeamIndex[Color_Blue] = 3; - CProfile_SayText2 = true; - } - else if (StrEqual(szGameName, "csgo", false)) - { - CProfile_Colors[Color_Default] = true; - CProfile_Colors[Color_Darkred] = true; - CProfile_Colors[Color_Pink] = true; - CProfile_Colors[Color_Green] = true; - CProfile_Colors[Color_Lightgreen] = true; - CProfile_Colors[Color_Lime] = true; - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Grey] = true; - CProfile_Colors[Color_Olive] = true; - CProfile_Colors[Color_A] = true; - CProfile_Colors[Color_Lightblue] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_Colors[Color_D] = true; - CProfile_Colors[Color_Purple] = true; - CProfile_Colors[Color_Darkrange] = true; - CProfile_Colors[Color_Orange] = true; - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_Colors[Color_Olive] = true; - CProfile_Colors[Color_Darkred] = true; - CProfile_Colors[Color_Lime] = true; - CProfile_Colors[Color_Purple] = true; - CProfile_Colors[Color_Grey] = true; - CProfile_Colors[Color_Orange] = true; - CProfile_TeamIndex[Color_Red] = 2; - CProfile_TeamIndex[Color_Blue] = 3; - CProfile_SayText2 = true; - } - else if (StrEqual(szGameName, "tf", false)) - { - CProfile_Colors[Color_Lightgreen] = true; - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_Colors[Color_Olive] = true; - CProfile_TeamIndex[Color_Lightgreen] = SERVER_INDEX; - CProfile_TeamIndex[Color_Red] = 2; - CProfile_TeamIndex[Color_Blue] = 3; - CProfile_SayText2 = true; - } - else if (StrEqual(szGameName, "left4dead", false) || StrEqual(szGameName, "left4dead2", false)) - { - CProfile_Colors[Color_Lightgreen] = true; - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_Colors[Color_Olive] = true; - CProfile_TeamIndex[Color_Lightgreen] = SERVER_INDEX; - CProfile_TeamIndex[Color_Red] = 3; - CProfile_TeamIndex[Color_Blue] = 2; - CProfile_SayText2 = true; - } - else if (StrEqual(szGameName, "hl2mp", false)) - { - /* hl2mp profile is based on mp_teamplay convar */ - if (GetConVarBool(FindConVar("mp_teamplay"))) - { - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_Colors[Color_Olive] = true; - CProfile_TeamIndex[Color_Red] = 3; - CProfile_TeamIndex[Color_Blue] = 2; - CProfile_SayText2 = true; - } - else - { - CProfile_SayText2 = false; - CProfile_Colors[Color_Olive] = true; - } - } - else if (StrEqual(szGameName, "dod", false)) - { - CProfile_Colors[Color_Olive] = true; - CProfile_SayText2 = false; - } - /* Profile for other games */ - else - { - if (GetUserMessageId("SayText2") == INVALID_MESSAGE_ID) - { - CProfile_SayText2 = false; - } - else - { - CProfile_Colors[Color_Red] = true; - CProfile_Colors[Color_Blue] = true; - CProfile_TeamIndex[Color_Red] = 2; - CProfile_TeamIndex[Color_Blue] = 3; - CProfile_SayText2 = true; - } - } -} - -public Action:CEvent_MapStart(Handle:event, const String:name[], bool:dontBroadcast) -{ - CSetupProfile(); - - for (new i = 1; i <= MaxClients; i++) - CSkipList[i] = false; -} \ No newline at end of file diff --git a/scripting/include/deathmatch.inc b/scripting/include/deathmatch.inc index 0a34f90..8852e40 100644 --- a/scripting/include/deathmatch.inc +++ b/scripting/include/deathmatch.inc @@ -1,30 +1,97 @@ +/** + * [CS:GO] Deathmatch + * + * Copyright (C) 2024 Maxximou5 + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see http://www.gnu.org/licenses/. + */ + #if defined _deathmatch_included #endinput #endif #define _deathmatch_included +/** + * Displays options menu to client + * + * @param client Client index to send menu. + * @error Invalid client. + */ native void Deathmatch_DisplayOptionsMenu(int client); + +/** + * Finds a group by name. + * + * @param client Client index to give weapons. + * @error Invalid client. + */ native void Deathmatch_GiveSavedWeapons(int client); -native void Deathmatch_UpdateSetting_Primary(int client, char[] primary); -native void Deathmatch_UpdateSetting_Secondary(int client, char[] secondary); + +/** + * Sets a clients primary weapon to the specified weapon + * + * @param client Client index to set primary for. + * @param primary Weapon to set primary as. + * @error Invalid client. + */ +native void Deathmatch_SetPrimaryWeapon(int client, char[] primary); + +/** + * Sets a clients secondary weapon to the specified weapon + * + * @param client Client index to set secondary for. + * @param secondary Weapon to set secondary as. + * @error Invalid client. + */ +native void Deathmatch_SetSecondaryWeapon(int client, char[] secondary); + +/** + * Sets a clients primary weapon cookie to the specified weapon + * + * @param client Client index to set primary for. + * @param primary Weapon to set primary as. + * @error Invalid client. + */ +native void Deathmatch_SetPrimaryWeapon(int client, char[] primary); + +/** + * Sets a clients secondary weapon cookie to the specified weapon + * + * @param client Client index to set secondary for. + * @param secondary Weapon to set secondary as. + * @error Invalid client. + */ +native void Deathmatch_SetSecondaryWeapon(int client, char[] secondary); #if !defined REQUIRE_PLUGIN public void __pl_deathmatch_SetNTVOptional() { - MarkNativeAsOptional("Deathmatch_DisplayOptionsMenu"); - MarkNativeAsOptional("Deathmatch_GiveSavedWeapons"); - MarkNativeAsOptional("Deathmatch_UpdateSetting_Primary"); - MarkNativeAsOptional("Deathmatch_UpdateSetting_Secondary"); + MarkNativeAsOptional("Deathmatch_DisplayOptionsMenu"); + MarkNativeAsOptional("Deathmatch_GiveSavedWeapons"); + MarkNativeAsOptional("Deathmatch_SetPrimaryWeapon"); + MarkNativeAsOptional("Deathmatch_SetSecondaryWeapon"); + MarkNativeAsOptional("Deathmatch_SetPrimaryWeaponCookie"); + MarkNativeAsOptional("Deathmatch_SetSecondaryWeaponCookie"); } #endif public SharedPlugin __pl_deathmatch = { - name = "deathmatch", - file = "deathmatch.smx", + name = "deathmatch", + file = "deathmatch.smx", #if defined REQUIRE_PLUGIN - required = 1 + required = 1 #else - required = 0 + required = 0 #endif }; diff --git a/translations/deathmatch.phrases.txt b/translations/deathmatch.phrases.txt index 6da483f..0563803 100644 --- a/translations/deathmatch.phrases.txt +++ b/translations/deathmatch.phrases.txt @@ -2,15 +2,15 @@ { "Chat Tag" { - "chi" "[{green}DM{default}]" - "en" "[{green}DM{default}]" - "es" "[{green}DM{default}]" - "de" "[{green}DM{default}]" - "fr" "[{green}DM{default}]" - "jp" "[{green}DM{default}]" - "pl" "[{green}DM{default}]" - "pt" "[{green}DM{default}]" - "ru" "[{green}DM{default}]" + "chi" "[{darkred}DM{default}]" + "en" "[{darkred}DM{default}]" + "es" "[{darkred}DM{default}]" + "de" "[{darkred}DM{default}]" + "fr" "[{darkred}DM{default}]" + "jp" "[{darkred}DM{default}]" + "pl" "[{darkred}DM{default}]" + "pt" "[{darkred}DM{default}]" + "ru" "[{darkred}DM{default}]" } "Settings Menu" { @@ -36,7 +36,7 @@ "pt" "Digite {green}guns{default} para abrir o menu de armas." "ru" "Напечатайте {green}guns{default} что бы открыть меню оружия." } - "Guns Disabled" + "Guns Menu Disabled" { "chi" "选枪功能 {red}被暂时停用{default}." "en" "The guns menu has been {red}disabled{default}." @@ -48,17 +48,41 @@ "pt" "O menu de armas foi {red}desativado{default}." "ru" "Меню оружия было {red}отключено{default}." } - "Guns Menu" + "Guns New Spawn" { - "chi" "直接按 {green}G 键{default} 选枪." - "en" "Type {green}guns{default} to open the weapons menu." - "es" "Escriba {green}guns{default} para abrir el menú de armas." - "de" "Schreibe {green}guns{default} um das Waffenmenü zu öffnen." - "fr" "Tapez {green}guns{default} pour ouvrir le menu des armes." - "jp" "Type {green}guns{default} to open the weapons menu." - "pl" "Napisz {green}guns{default} aby otworzyć menu broni." - "pt" "Digite {green}guns{default} para abrir o menu de armas." - "ru" "Напечатайте {green}guns{default} что бы открыть меню оружия." + "chi" "下次复活时 {green}你将获得新枪{default}." + "en" "You will be given {green}new{default} weapons on next spawn." + "es" "Se le dará {green}nuevas{default} armas en el próximo desove." + "de" "Beim nächsten Spawn erhältst du {grün}neue{default} Waffen." + "fr" "Vous recevrez de {green}nouvelles{default} armes sur le prochain spawn." + "jp" "次のスポーン時に{green}新しい武器{default}が手に入ります。" + "pl" "Zostaną dodane {green}nowe{default} bronie po respawnie." + "pt" "Voce recebera a {green}nova{default} arma no próximo spawn." + "ru" "Вы получите {green}новое{default} оружие в следующем возрождении." + } + "Guns Same Spawn" + { + "chi" "下次复活时 {green}你将获得相同的武器{default}." + "en" "You will be given {green}same{default} weapons on next spawn." + "es" "Se le dará {green}mismas{default} armas en el próximo desove." + "de" "Beim nächsten Spawn erhältst du die {grün}gleichen{default} Waffen." + "fr" "Vous recevrez {green}mêmes{default} armes sur le prochain spawn." + "jp" "次のスポーン時から{green}同じ武器{default}が手に入るようになります。" + "pl" "Zostaną dodane {green}te same{default} bronie po respawnie." + "pt" "Você recebera as {green}mesmas{default} armas nos próximos spawns" + "ru" "Вы получите {green}аналогичное{default} оружие в следующем возрождении." + } + "Guns Random Spawn" + { + "chi" "下次复活时 {green}你将获得随机武器{default}." + "en" "You will be given {green}random{default} weapons on next spawn." + "es" "Se le dará armas {green}al azar{default} en el próximo desove." + "de" "Beim nächsten Spawn erhältst du {grün}zufällige{default} Waffen." + "fr" "Vous recevrez armes {green}aléatoires{default} sur le prochain spawn." + "jp" "次のスポーン時から{green}ランダムで{default}武器が手に入ります。" + "pl" "Zostaną dodane {green}losowe{default} bronie po respawnie." + "pt" "Você recebera armas {green}aleatórias{default} nos próximos spawns" + "ru" "Вы получите {green}случайное{default} оружие в следующем возрождении." } "Weapons Menu" { @@ -132,78 +156,317 @@ "pt" "Your new {purple}secondary{default} weapon will be:{green}" "ru" "Your new {purple}secondary{default} weapon will be:{green}" } - "HS Only" - { - "chi" "爆头模式 {green}开启{default}." - "en" "HS Only mode is {green}enabled{default}." - "es" "HS Only mode is {green}enabled{default}." - "de" "HS Only Modus wurde {green}aktiviert{default}." - "fr" "HS Only mode is {green}enabled{default}." - "jp" "ヘッドショットのみのモードが{green}有効{default}になりました。" - "pl" "HS Only mode is {green}enabled{default}." - "pt" "HS Only mode is {green}enabled{default}." - "ru" "HS Only mode is {green}enabled{default}." - } - "HS Only Client Disabled" - { - "chi" "个人爆头模式 {red}已关闭{default}." - "en" "HS Only Client mode has been {red}disabled{default}." - "es" "HS Only Client mode has been {red}disabled{default}." - "de" "HS Only Client Modus wurde {red}deaktiviert{default}." - "fr" "HS Only Client mode has been {red}disabled{default}." - "jp" "あなただけヘッドショットのみのモードが{red}無効{default}になりました。" - "pl" "HS Only Client mode has been {red}disabled{default}." - "pt" "HS Only Client mode has been {red}disabled{default}." - "ru" "HS Only Client mode has been {red}disabled{default}." - } - - "HS Only Client Enabled" - { - "chi" "现在启动 {green}个人爆头模式{default}." - "en" "HS Only Client mode has been {green}enabled{default}." - "es" "HS Only Client mode has been {green}enabled{default}." - "de" "HS Only Client Modus wurde {green}aktiviert{default}." - "fr" "HS Only Client mode has been {green}enabled{default}." - "jp" "あなただけヘッドショットのみのモードが{green}有効{default}になりました。" - "pl" "HS Only Client mode has been {green}enabled{default}." - "pt" "HS Only Client mode has been {green}enabled{default}." - "ru" "HS Only Client mode has been {green}enabled{default}." - } - "Guns New Spawn" - { - "chi" "下次复活时 {green}你将获得新枪{default}." - "en" "You will be given {green}new{default} weapons on next spawn." - "es" "Se le dará {green}nuevas{default} armas en el próximo desove." - "de" "Beim nächsten Spawn erhältst du {grün}neue{default} Waffen." - "fr" "Vous recevrez de {green}nouvelles{default} armes sur le prochain spawn." - "jp" "次のスポーン時に{green}新しい武器{default}が手に入ります。" - "pl" "Zostaną dodane {green}nowe{default} bronie po respawnie." - "pt" "Voce recebera a {green}nova{default} arma no próximo spawn." - "ru" "Вы получите {green}новое{default} оружие в следующем возрождении." - } - "Guns Same Spawn" - { - "chi" "下次复活时 {green}你将获得相同的武器{default}." - "en" "You will be given {green}same{default} weapons on next spawn." - "es" "Se le dará {green}mismas{default} armas en el próximo desove." - "de" "Beim nächsten Spawn erhältst du die {grün}gleichen{default} Waffen." - "fr" "Vous recevrez {green}mêmes{default} armes sur le prochain spawn." - "jp" "次のスポーン時から{green}同じ武器{default}が手に入るようになります。" - "pl" "Zostaną dodane {green}te same{default} bronie po respawnie." - "pt" "Você recebera as {green}mesmas{default} armas nos próximos spawns" - "ru" "Вы получите {green}аналогичное{default} оружие в следующем возрождении." - } - "Guns Random Spawn" - { - "chi" "下次复活时 {green}你将获得随机武器{default}." - "en" "You will be given {green}random{default} weapons on next spawn." - "es" "Se le dará armas {green}al azar{default} en el próximo desove." - "de" "Beim nächsten Spawn erhältst du {grün}zufällige{default} Waffen." - "fr" "Vous recevrez armes {green}aléatoires{default} sur le prochain spawn." - "jp" "次のスポーン時から{green}ランダムで{default}武器が手に入ります。" - "pl" "Zostaną dodane {green}losowe{default} bronie po respawnie." - "pt" "Você recebera armas {green}aleatórias{default} nos próximos spawns" - "ru" "Вы получите {green}случайное{default} оружие в следующем возрождении." + "Damage Panel Enabled" + { + "chi" "Damage Panel has been {green}enabled{default}." + "en" "Damage Panel has been {green}enabled{default}." + "es" "Damage Panel has been {green}enabled{default}." + "de" "Damage Panel has been {green}enabled{default}." + "fr" "Damage Panel has been {green}enabled{default}." + "jp" "Damage Panel has been {green}enabled{default}." + "pl" "Damage Panel has been {green}enabled{default}." + "pt" "Damage Panel has been {green}enabled{default}." + "ru" "Damage Panel has been {green}enabled{default}." + } + "Damage Panel Disabled" + { + "chi" "Damage Panel has been {green}disabled{default}." + "en" "Damage Panel has been {green}disabled{default}." + "es" "Damage Panel has been {green}disabled{default}." + "de" "Damage Panel has been {green}disabled{default}." + "fr" "Damage Panel has been {green}disabled{default}." + "jp" "Damage Panel has been {green}disabled{default}." + "pl" "Damage Panel has been {green}disabled{default}." + "pt" "Damage Panel has been {green}disabled{default}." + "ru" "Damage Panel has been {green}disabled{default}." + } + "Damage Popup Enabled" + { + "chi" "Damage Popup has been {green}enabled{default}." + "en" "Damage Popup has been {green}enabled{default}." + "es" "Damage Popup has been {green}enabled{default}." + "de" "Damage Popup has been {green}enabled{default}." + "fr" "Damage Popup has been {green}enabled{default}." + "jp" "Damage Popup has been {green}enabled{default}." + "pl" "Damage Popup has been {green}enabled{default}." + "pt" "Damage Popup has been {green}enabled{default}." + "ru" "Damage Popup has been {green}enabled{default}." + } + "Damage Popup Disabled" + { + "chi" "Damage Popup has been {green}disabled{default}." + "en" "Damage Popup has been {green}disabled{default}." + "es" "Damage Popup has been {green}disabled{default}." + "de" "Damage Popup has been {green}disabled{default}." + "fr" "Damage Popup has been {green}disabled{default}." + "jp" "Damage Popup has been {green}disabled{default}." + "pl" "Damage Popup has been {green}disabled{default}." + "pt" "Damage Popup has been {green}disabled{default}." + "ru" "Damage Popup has been {green}disabled{default}." + } + "Damage Text Enabled" + { + "chi" "Damage Text has been {green}enabled{default}." + "en" "Damage Text has been {green}enabled{default}." + "es" "Damage Text has been {green}enabled{default}." + "de" "Damage Text has been {green}enabled{default}." + "fr" "Damage Text has been {green}enabled{default}." + "jp" "Damage Text has been {green}enabled{default}." + "pl" "Damage Text has been {green}enabled{default}." + "pt" "Damage Text has been {green}enabled{default}." + "ru" "Damage Text has been {green}enabled{default}." + } + "Damage Text Disabled" + { + "chi" "Damage Text has been {green}disabled{default}." + "en" "Damage Text has been {green}disabled{default}." + "es" "Damage Text has been {green}disabled{default}." + "de" "Damage Text has been {green}disabled{default}." + "fr" "Damage Text has been {green}disabled{default}." + "jp" "Damage Text has been {green}disabled{default}." + "pl" "Damage Text has been {green}disabled{default}." + "pt" "Damage Text has been {green}disabled{default}." + "ru" "Damage Text has been {green}disabled{default}." + } + "Filter Kill Feed Enabled" + { + "chi" "Filter Kill Feed has been {green}enabled{default}." + "en" "Filter Kill Feed has been {green}enabled{default}." + "es" "Filter Kill Feed has been {green}enabled{default}." + "de" "Filter Kill Feed has been {green}enabled{default}." + "fr" "Filter Kill Feed has been {green}enabled{default}." + "jp" "Filter Kill Feed has been {green}enabled{default}." + "pl" "Filter Kill Feed has been {green}enabled{default}." + "pt" "Filter Kill Feed has been {green}enabled{default}." + "ru" "Filter Kill Feed has been {green}enabled{default}." + } + "Filter Kill Feed Disabled" + { + "chi" "Filter Kill Feed has been {green}disabled{default}." + "en" "Filter Kill Feed has been {green}disabled{default}." + "es" "Filter Kill Feed has been {green}disabled{default}." + "de" "Filter Kill Feed has been {green}disabled{default}." + "fr" "Filter Kill Feed has been {green}disabled{default}." + "jp" "Filter Kill Feed has been {green}disabled{default}." + "pl" "Filter Kill Feed has been {green}disabled{default}." + "pt" "Filter Kill Feed has been {green}disabled{default}." + "ru" "Filter Kill Feed has been {green}disabled{default}." + } + "Filter Death Sounds Enabled" + { + "chi" "Filter Death Sounds has been {green}enabled{default}." + "en" "Filter Death Sounds has been {green}enabled{default}." + "es" "Filter Death Sounds has been {green}enabled{default}." + "de" "Filter Death Sounds has been {green}enabled{default}." + "fr" "Filter Death Sounds has been {green}enabled{default}." + "jp" "Filter Death Sounds has been {green}enabled{default}." + "pl" "Filter Death Sounds has been {green}enabled{default}." + "pt" "Filter Death Sounds has been {green}enabled{default}." + "ru" "Filter Death Sounds has been {green}enabled{default}." + } + "Filter Death Sounds Disabled" + { + "chi" "Filter Death Sounds has been {green}disabled{default}." + "en" "Filter Death Sounds has been {green}disabled{default}." + "es" "Filter Death Sounds has been {green}disabled{default}." + "de" "Filter Death Sounds has been {green}disabled{default}." + "fr" "Filter Death Sounds has been {green}disabled{default}." + "jp" "Filter Death Sounds has been {green}disabled{default}." + "pl" "Filter Death Sounds has been {green}disabled{default}." + "pt" "Filter Death Sounds has been {green}disabled{default}." + "ru" "Filter Death Sounds has been {green}disabled{default}." + } + "Filter Gun Shot Sounds Enabled" + { + "chi" "Filter Gun Shot Sounds has been {green}enabled{default}." + "en" "Filter Gun Shot Sounds has been {green}enabled{default}." + "es" "Filter Gun Shot Sounds has been {green}enabled{default}." + "de" "Filter Gun Shot Sounds has been {green}enabled{default}." + "fr" "Filter Gun Shot Sounds has been {green}enabled{default}." + "jp" "Filter Gun Shot Sounds has been {green}enabled{default}." + "pl" "Filter Gun Shot Sounds has been {green}enabled{default}." + "pt" "Filter Gun Shot Sounds has been {green}enabled{default}." + "ru" "Filter Gun Shot Sounds has been {green}enabled{default}." + } + "Filter Gun Shot Sounds Disabled" + { + "chi" "Filter Gun Shot Sounds has been {green}disabled{default}." + "en" "Filter Gun Shot Sounds has been {green}disabled{default}." + "es" "Filter Gun Shot Sounds has been {green}disabled{default}." + "de" "Filter Gun Shot Sounds has been {green}disabled{default}." + "fr" "Filter Gun Shot Sounds has been {green}disabled{default}." + "jp" "Filter Gun Shot Sounds has been {green}disabled{default}." + "pl" "Filter Gun Shot Sounds has been {green}disabled{default}." + "pt" "Filter Gun Shot Sounds has been {green}disabled{default}." + "ru" "Filter Gun Shot Sounds has been {green}disabled{default}." + } + "Filter Body Shot Sounds Enabled" + { + "chi" "Filter Body Shot Sounds has been {green}enabled{default}." + "en" "Filter Body Shot Sounds has been {green}enabled{default}." + "es" "Filter Body Shot Sounds has been {green}enabled{default}." + "de" "Filter Body Shot Sounds has been {green}enabled{default}." + "fr" "Filter Body Shot Sounds has been {green}enabled{default}." + "jp" "Filter Body Shot Sounds has been {green}enabled{default}." + "pl" "Filter Body Shot Sounds has been {green}enabled{default}." + "pt" "Filter Body Shot Sounds has been {green}enabled{default}." + "ru" "Filter Body Shot Sounds has been {green}enabled{default}." + } + "Filter Body Shot Sounds Disabled" + { + "chi" "Filter Body Shot Sounds has been {green}disabled{default}." + "en" "Filter Body Shot Sounds has been {green}disabled{default}." + "es" "Filter Body Shot Sounds has been {green}disabled{default}." + "de" "Filter Body Shot Sounds has been {green}disabled{default}." + "fr" "Filter Body Shot Sounds has been {green}disabled{default}." + "jp" "Filter Body Shot Sounds has been {green}disabled{default}." + "pl" "Filter Body Shot Sounds has been {green}disabled{default}." + "pt" "Filter Body Shot Sounds has been {green}disabled{default}." + "ru" "Filter Body Shot Sounds has been {green}disabled{default}." + } + "Filter Headshot Shot Sounds Enabled" + { + "chi" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "en" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "es" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "de" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "fr" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "jp" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "pl" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "pt" "Filter Headshot Shot Sounds has been {green}enabled{default}." + "ru" "Filter Headshot Shot Sounds has been {green}enabled{default}." + } + "Filter Headshot Shot Sounds Disabled" + { + "chi" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "en" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "es" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "de" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "fr" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "jp" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "pl" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "pt" "Filter Headshot Shot Sounds has been {green}disabled{default}." + "ru" "Filter Headshot Shot Sounds has been {green}disabled{default}." + } + "Headshot Only Enabled" + { + "chi" "Headshot Only has been {green}enabled{default}." + "en" "Headshot Only has been {green}enabled{default}." + "es" "Headshot Only has been {green}enabled{default}." + "de" "Headshot Only has been {green}enabled{default}." + "fr" "Headshot Only has been {green}enabled{default}." + "jp" "Headshot Only has been {green}enabled{default}." + "pl" "Headshot Only has been {green}enabled{default}." + "pt" "Headshot Only has been {green}enabled{default}." + "ru" "Headshot Only has been {green}enabled{default}." + } + "Headshot Only Disabled" + { + "chi" "Headshot Only has been {green}disabled{default}." + "en" "Headshot Only has been {green}disabled{default}." + "es" "Headshot Only has been {green}disabled{default}." + "de" "Headshot Only has been {green}disabled{default}." + "fr" "Headshot Only has been {green}disabled{default}." + "jp" "Headshot Only has been {green}disabled{default}." + "pl" "Headshot Only has been {green}disabled{default}." + "pt" "Headshot Only has been {green}disabled{default}." + "ru" "Headshot Only has been {green}disabled{default}." + } + "Bell Kill Enabled" + { + "chi" "Bell Kill has been {green}enabled{default}." + "en" "Bell Kill has been {green}enabled{default}." + "es" "Bell Kill has been {green}enabled{default}." + "de" "Bell Kill has been {green}enabled{default}." + "fr" "Bell Kill has been {green}enabled{default}." + "jp" "Bell Kill has been {green}enabled{default}." + "pl" "Bell Kill has been {green}enabled{default}." + "pt" "Bell Kill has been {green}enabled{default}." + "ru" "Bell Kill has been {green}enabled{default}." + } + "Bell Kill Disabled" + { + "chi" "Bell Kill has been {green}disabled{default}." + "en" "Bell Kill has been {green}disabled{default}." + "es" "Bell Kill has been {green}disabled{default}." + "de" "Bell Kill has been {green}disabled{default}." + "fr" "Bell Kill has been {green}disabled{default}." + "jp" "Bell Kill has been {green}disabled{default}." + "pl" "Bell Kill has been {green}disabled{default}." + "pt" "Bell Kill has been {green}disabled{default}." + "ru" "Bell Kill has been {green}disabled{default}." + } + "Bell Hit Enabled" + { + "chi" "Bell Hit has been {green}enabled{default}." + "en" "Bell Hit has been {green}enabled{default}." + "es" "Bell Hit has been {green}enabled{default}." + "de" "Bell Hit has been {green}enabled{default}." + "fr" "Bell Hit has been {green}enabled{default}." + "jp" "Bell Hit has been {green}enabled{default}." + "pl" "Bell Hit has been {green}enabled{default}." + "pt" "Bell Hit has been {green}enabled{default}." + "ru" "Bell Hit has been {green}enabled{default}." + } + "Bell Hit Disabled" + { + "chi" "Bell Hit has been {green}disabled{default}." + "en" "Bell Hit has been {green}disabled{default}." + "es" "Bell Hit has been {green}disabled{default}." + "de" "Bell Hit has been {green}disabled{default}." + "fr" "Bell Hit has been {green}disabled{default}." + "jp" "Bell Hit has been {green}disabled{default}." + "pl" "Bell Hit has been {green}disabled{default}." + "pt" "Bell Hit has been {green}disabled{default}." + "ru" "Bell Hit has been {green}disabled{default}." + } + "Bell Headshot Enabled" + { + "chi" "Bell Headshot has been {green}enabled{default}." + "en" "Bell Headshot has been {green}enabled{default}." + "es" "Bell Headshot has been {green}enabled{default}." + "de" "Bell Headshot has been {green}enabled{default}." + "fr" "Bell Headshot has been {green}enabled{default}." + "jp" "Bell Headshot has been {green}enabled{default}." + "pl" "Bell Headshot has been {green}enabled{default}." + "pt" "Bell Headshot has been {green}enabled{default}." + "ru" "Bell Headshot has been {green}enabled{default}." + } + "Bell Headshot Disabled" + { + "chi" "Bell Headshot has been {green}disabled{default}." + "en" "Bell Headshot has been {green}disabled{default}." + "es" "Bell Headshot has been {green}disabled{default}." + "de" "Bell Headshot has been {green}disabled{default}." + "fr" "Bell Headshot has been {green}disabled{default}." + "jp" "Bell Headshot has been {green}disabled{default}." + "pl" "Bell Headshot has been {green}disabled{default}." + "pt" "Bell Headshot has been {green}disabled{default}." + "ru" "Bell Headshot has been {green}disabled{default}." + } + "Reset Score" + { + "chi" "Your score has been reset." + "en" "Your score has been reset." + "es" "Your score has been reset." + "de" "Your score has been reset." + "fr" "Your score has been reset." + "jp" "Your score has been reset." + "pl" "Your score has been reset." + "pt" "Your score has been reset." + "ru" "Your score has been reset." + } + "Reset Score Disabled" + { + "chi" "Reset score is {red}unavailable{default}." + "en" "Reset score is {red}unavailable{default}." + "es" "Reset score is {red}unavailable{default}." + "de" "Reset score is {red}unavailable{default}." + "fr" "Reset score is {red}unavailable{default}." + "jp" "Reset score is {red}unavailable{default}." + "pl" "Reset score is {red}unavailable{default}." + "pt" "Reset score is {red}unavailable{default}." + "ru" "Reset score is {red}unavailable{default}." } "All Player Respawn" { @@ -265,6 +528,31 @@ "pt" "danos ao" "ru" "урон по" } + "Display Damage None" + { + "chi" "You did not damage" + "en" "You did not damage" + "es" "You did not damage" + "de" "You did not damage" + "fr" "You did not damage" + "jp" "You did not damage" + "pl" "You did not damage" + "pt" "You did not damage" + "ru" "You did not damage" + } + "Display Damage Hits" + { + "#format" "{1:d}" + "chi" "in {blue}{1}{default} hit(s)" + "en" "in {blue}{1}{default} hit(s)" + "es" "in {blue}{1}{default} hit(s)" + "de" "in {blue}{1}{default} hit(s)" + "fr" "in {blue}{1}{default} hit(s)" + "jp" "in {blue}{1}{default} hit(s)" + "pl" "in {blue}{1}{default} hit(s)" + "pt" "in {blue}{1}{default} hit(s)" + "ru" "in {blue}{1}{default} hit(s)" + } "Display Kill Confirmed" { "chi" "你将Ta击毙." @@ -279,39 +567,39 @@ } "Knife Kill" { - "chi" "因为击毙对手 ({green}刀斩{default})." - "en" "for killing an enemy ({green}knife{default})." - "es" "por matar a un enemigo ({green}cuchillo{default})." - "de" "für das Töten eines Gegners mit dem ({green}Messer{default})." - "fr" "pour avoir frag ({green}couteau{default})." - "jp" "敵を{green}ナイフ{default}でキルした。" - "pl" "za zabicie przeciwnika ({green}nożem{default})." - "pt" "Por matar um inimigo com a ({green}faca{default})." - "ru" "за убийство противника ({green}ножом{default})." + "chi" "因为击毙对手 ({red}刀斩{default})." + "en" "for killing an enemy ({red}knife{default})." + "es" "por matar a un enemigo ({red}cuchillo{default})." + "de" "für das Töten eines Gegners mit dem ({red}Messer{default})." + "fr" "pour avoir frag ({red}couteau{default})." + "jp" "敵を{red}ナイフ{default}でキルした。" + "pl" "za zabicie przeciwnika ({red}nożem{default})." + "pt" "Por matar um inimigo com a ({red}faca{default})." + "ru" "за убийство противника ({red}ножом{default})." } "Headshot Kill" { - "chi" "因为击毙对手 ({green}爆头{default})." - "en" "for killing an enemy ({green}headshot{default})." - "es" "por matar a un enemigo ({green}disparo a la cabeza{default})." - "de" "für das Töten eines Gegners mit einem ({green}Kopfschuss{default})." - "fr" "pour avoir frag ({green}à la tête{default})." - "jp" "敵を{green}ヘッドショット{default}でキルした。" - "pl" "za zabicie przeciwnika ({green}headshotem{default})." - "pt" "Por matar um inimigo de ({green}headshot{default})." - "ru" "за убийство противника ({green}в голову{default})." + "chi" "因为击毙对手 ({red}爆头{default})." + "en" "for killing an enemy ({red}headshot{default})." + "es" "por matar a un enemigo ({red}disparo a la cabeza{default})." + "de" "für das Töten eines Gegners mit einem ({red}Kopfschuss{default})." + "fr" "pour avoir frag ({red}à la tête{default})." + "jp" "敵を{red}ヘッドショット{default}でキルした。" + "pl" "za zabicie przeciwnika ({red}headshotem{default})." + "pt" "Por matar um inimigo de ({red}headshot{default})." + "ru" "за убийство противника ({red}в голову{default})." } "Nade Kill" { - "chi" "因为击毙对手 ({green}雷杀{default})." - "en" "for killing an enemy ({green}grenade{default})." - "es" "por matar a un enemigo ({green}granada{default})." - "de" "für das Töten eines Gegners mit einer ({green}Granate{default})." - "fr" "pour avoir frag ({green}grenade{default})." - "jp" "敵を{green}グレネード{default}でキルした。" - "pl" "za zabicie przeciwnika ({green}granatem{default})." - "pt" "Por matar um inimigo na ({green}granada{default})." - "ru" "за убийство противника ({green}гранатой{default})." + "chi" "因为击毙对手 ({red}雷杀{default})." + "en" "for killing an enemy ({red}grenade{default})." + "es" "por matar a un enemigo ({red}granada{default})." + "de" "für das Töten eines Gegners mit einer ({red}Granate{default})." + "fr" "pour avoir frag ({red}grenade{default})." + "jp" "敵を{red}グレネード{default}でキルした。" + "pl" "za zabicie przeciwnika ({red}granatem{default})." + "pt" "Por matar um inimigo na ({red}granada{default})." + "ru" "за убийство противника ({red}гранатой{default})." } "Kill" {