Plugin on Github: https://github.com/bcserv/spawnandkillprotection
Code contributions are welcome! -
How do I create a pull request on Github ?
Description
Adds a spawnprotection to the game that protects all players on spawn until they move or shoot. Displays a notification when the protection is enabled. Provides various cvar options for customizing.
Since it's common that players who look at a wall shouldn't be killed, this also adds a protection for players who are chatting or are away for a short time. They just have to stand close to the wall and look at it, after some seconds (set sakp_walltime) they are given protection against getting killed.
Screenshots
Features
- spawnprotection until player moves or shoots
- max time a player is protected
- protected players are transparent
- protected players don't see their HUD
- different kind of punishments
- noblock when protected
- chatprotection when a player looks at wall
- multilanguage
- configurable
Downloads
spawnandkillprotection-release-1.4.0.zip
Compiled with smlib 0.11 or higher
Authors
Requirements
Installation
1. Download the
SDKHooks extension and install it:
Download
TF2, CSS, HL2DM, DODS = ob-valve, ask for other games.
extract the contents of the zip into your sourcemod directory
2. Simply extract the contents of the attached zip file into the sourcemod directory.
Updating
- Delete cfg/sourcemod/plugin.spawnandkillprotection.cfg when new cvars got added or cvars got changed
- Follow the Installation instructions
Commands
sm_enablekillprotection - mainly used for debugging purposes.
ConVars
Code:
// Sourcemod Spawn & kill protection plugin:
// 0 = don't disable, 1 = disable the spawnprotection when player moves or shoots, 2 = disable the spawn protection when shooting only
// -
// Default: "1"
sakp_disableonmoveshoot "1"
// Sourcemod Spawn & kill protection plugin:
// Time in seconds until the protection is removed after the player moved and/or shooted, 0 = immediately
// -
// Default: "0"
sakp_disabletime "0"
// Sourcemod Spawn & kill protection plugin:
// same as sakp_disabletime, but for team 2 only (overrides sakp_disabletime if not set to -1)
// -
// Default: "-1"
sakp_disabletime_team1 "-1"
// Sourcemod Spawn & kill protection plugin:
// same as sakp_disabletime, but for team 2 only (overrides sakp_disabletime if not set to -1)
// -
// Default: "-1"
sakp_disabletime_team2 "-1"
// Sourcemod Spawn & kill protection plugin:
// Spawn & Kill Protection enabled
// -
// Default: "1"
sakp_enabled "1"
// Sourcemod Spawn & kill protection plugin:
// Fade screen to black
// -
// Default: "1"
sakp_fadescreen "1"
// Sourcemod Spawn & kill protection plugin:
// Set to 1 to hide the HUD when being protected
// -
// Default: "1"
sakp_hidehud "1"
// Sourcemod Spawn & kill protection plugin:
// The amount of time in seconds pressing any keys will not turn off spawn protection
// -
// Default: "0.8"
sakp_keypressignoretime "0.8"
// Sourcemod Spawn & kill protection plugin:
// same as sakp_keypressignoretime, but for team 1 only (overrides sakp_keypressignoretime if not set to -1)
// -
// Default: "-1"
sakp_keypressignoretime_team1 "-1"
// Sourcemod Spawn & kill protection plugin:
// same as sakp_keypressignoretime, but for team 1 only (overrides sakp_keypressignoretime if not set to -1)
// -
// Default: "-1"
sakp_keypressignoretime_team2 "-1"
// Sourcemod Spawn & kill protection plugin:
// max timelimit in seconds the spawnprotection stays, 0 = no limit
// -
// Default: "0"
sakp_maxspawnprotection "0"
// Sourcemod Spawn & kill protection plugin:
// same as sakp_maxspawnprotection, but for team 1 only (overrides sakp_maxspawnprotection if not set to -1)
// -
// Default: "-1"
sakp_maxspawnprotection_team1 "-1"
// Sourcemod Spawn & kill protection plugin:
// same as sakp_maxspawnprotection, but for team 2 only (overrides sakp_maxspawnprotection if not set to -1)
// -
// Default: "-1"
sakp_maxspawnprotection_team2 "-1"
// Sourcemod Spawn & kill protection plugin:
// 1 = enable noblock when protected, 0 = disabled feature
// -
// Default: "1"
sakp_noblock "1"
// Sourcemod Spawn & kill protection plugin:
// 0 = off, 1 = HUD message, 2 = center message, 3 = chat message, 4 = auto
// -
// Default: "4"
sakp_notify "4"
// Sourcemod Spawn & kill protection plugin:
// alpha amount of a protected player 0-255
// -
// Default: "50"
sakp_player_alpha "50"
// Sourcemod Spawn & kill protection plugin:
// amount of blue when a player is protected 0-255
// -
// Default: "0"
sakp_player_color_blue "0"
// Sourcemod Spawn & kill protection plugin:
// amount of green when a player is protected 0-255
// -
// Default: "0"
sakp_player_color_green "0"
// Sourcemod Spawn & kill protection plugin:
// amount of red when a player is protected 0-255
// -
// Default: "255"
sakp_player_color_red "255"
// Sourcemod Spawn & kill protection plugin:
// 0 = off, 1 = slap, 2 = decrease health 3 = slay, 4 = apply damage done to enemy
// -
// Default: "0"
sakp_punishmode "0"
// Sourcemod Spawn & kill protection plugin:
// The amount of health to take from the player when shooting at protected players (when punishmode = 2)
// -
// Default: "5"
sakp_takedamage "5"
// Sourcemod Spawn & kill protection plugin:
// How long a player has to look at a wall to get kill protection activated, set to -1 to disable
// -
// Default: "4"
sakp_walltime "4"
Config
cfg/sourcemod/spawnandkillprotection.cfg (auto generated OnPluginStart)
Games tested & support
- Tested with Half Life 2: Deathmatch and Counter-Strike: Source
- Should work with any games
Natives for other plugins
PHP Code:
/**
* Returns if a client is currently protected.
*
* @param client Client index.
* @return Returns true if the client is protected otherwise false.
*/
native bool:SAKP_IsClientProtected(client);
Todo
-
Changelog
Date: 09.12.2012
Version: 1.4.0
- Fixed the physical mayhem bug (by not setting collision groups anymore and using sdkhooks)
- Fixed the health issues reported (by not setting the health anymore)
- Fixed the kill protection staying when a player dies.
- Fixed not using relieable userid's instead of client indexes when creating timers.
- Changed the HUD elements not getting completely removed anymore to allow the player to see and write chat message (the chatkill protection didn't really make sense before).
- Added some team specific cvars (by ph, thanks)
- Code cleanup
Date: 03.02.2011
Version: 1.3.0
- Fixed the errors people reported (hopefully)
- Enhanced ConVar sakpdisableonmoveshoot
- Added ConVar sakpdisabletime
- Added ConVar sakpkeypressignoretime
- Added ConVar sakpfadescreen
- Added ConVar sakp_player_color_red
- Added ConVar sakp_player_color_green
- Added ConVar sakp_player_color_blue
- Added ConVar sakp_player_alpha
- Added ConVar sakp_disabletime
- Added french translation (thanks to pywaie)
- Replaced allot of code with smlib function calls.
- Optimized code allot.
Date: 29.01.2010
Version: 1.0.2
- No wallprotection when player is pressing the Use button
Date: 24.01.2010
Version: 1.0.1
- Took back in fadeclientscreen feature and other things I removed by accident
- Some small changes
Date: 24.01.2010
Version: 1.0
- Changed to the Sdkhooks extension for better OnTakeDamage support
- Added cvar sakp_noblock for enable/disabling playercollisions when protected for usage of this plugin with other noblock plugins
- Added cvar sakp_disableonmoveshoot for auto enabling/disabling spawnprotection when player shoots or moves
- Added cvar sakp_maxspawnprotection for specifying a time after which the spawnprotection automatically gets disabled
- Removed cvar sakp_fadescreen
- Fixed a possible bug/exploit with the wallprotection
- Added code for handling midgame loading of the plugin
- renamed the plugin to "spawnandkillprotection"
- Fixed bug in ProtectedPlayerHurted
- Fixed bug with sakp_notify cvar
- Added german translation
- Put server warning when hud support is not enabled into translation file
Date: 18.08.2009
Version: 0.9.6
- Added ability to turn notifications & damage off
- Renamed spawnkillprotection files to killprotection
- Added Fadescreen, the players screen now fades to black when is protected (new cvar sakp_fadescreen)
- Further code improvements
Date: 15.08.2009
Version: 0.9.4
- Added 2 different messages to the translations for spawn and wall kill protection.
Date: 15.08.2009
Version: 0.9.3