DeathChaos25

[L4D2] Round End HP Restore

Nov 16th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <sdktools>
  4.  
  5. #define PLUGIN_VERSION "1.00"
  6.  
  7. public Plugin:myinfo =
  8. {
  9.     name = "[L4D2] Round End HP Restore",
  10.     author = "DeathChaos25",
  11.     description = "When transitioning into the next map, if a survivor has less than 79 HP, this plugin will heal them for 50 HP, removing the need to kill injured survivors.",
  12.     version = "1.0",
  13. }
  14.  
  15. public OnPluginStart()
  16. {
  17.     HookEvent("map_transition", Event_maptransition);
  18. }
  19.  
  20. public Action:Event_maptransition(Handle:event, const String:name[], bool:dontBroadcast)
  21. {
  22.     new maxplayers = GetMaxClients();
  23.     for (new i = 1; i <= maxplayers; i++)
  24.     {
  25.         if (IsClientInGame(i))
  26.         {
  27.             if (GetClientTeam(i) == 2 && IsPlayerAlive(i))
  28.             {
  29.                 new health = GetEntProp(i, Prop_Send, "m_iHealth");
  30.                 if (health < 79)
  31.                 {
  32.                     SetEntProp(i, Prop_Send, "m_iHealth", 80);
  33.                     SetEntProp(i, Prop_Send, "m_currentReviveCount", 0);
  34.                     SetEntProp(i, Prop_Send, "m_bIsOnThirdStrike", 0);
  35.                     SetEntProp(i, Prop_Send, "m_isGoingToDie", 0);
  36.                 }
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment