FlacoBey

Untitled

Dec 25th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <sdkhooks>
  4.  
  5. #define HITGROUP_HEAD 0
  6.  
  7. #define ZC_SMOKER       1
  8. #define ZC_HUNTER       3
  9. #define VALUE 1.5  
  10.  
  11. new hitgroup;
  12. new bool:g_HeadShot;
  13.  
  14. public OnPluginStart()
  15. {
  16.     HookEvent("player_hurt", OnPlayerHurt);
  17.     for (new i = 0; i < MAXPLAYERS + 1; i++)
  18.     {
  19.         SDKHook(i, SDKHook_OnTakeDamage, OnTakeDamage);  
  20.     }
  21. }
  22.  
  23. public OnClientPutInServer(client)  
  24. {  
  25.     SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);  
  26. }  
  27.  
  28. public Action:OnPlayerHurt(Handle:event, const String:name[], bool:dontBrodcast)
  29. {
  30.     new client = GetClientOfUserId(GetEventInt(event, "userid"));
  31.     new iClass = GetEntProp(client, Prop_Send, "m_zombieClass");
  32.     hitgroup = GetEventInt(event, "hitgroup");
  33.  
  34.     if(hitgroup == 1 || iClass == ZC_SMOKER & ZC_HUNTER)
  35.     {
  36.         g_HeadShot = true;
  37.         PrintCenterTextAll("Head Shot");
  38.     }
  39.     else
  40.     {
  41.         g_HeadShot = false;
  42.         PrintCenterTextAll("Not Head Shot");
  43.     }
  44. }
  45.  
  46. public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)  
  47. {  
  48.     if (bIsSurvivor(attacker))  
  49.     {
  50.         if(damagetype == DMG_BULLET || g_HeadShot == true)
  51.         {
  52.             damage *= 0.1;
  53.             return Plugin_Changed;  
  54.         }
  55.     }  
  56.     return Plugin_Continue;  
  57. }
  58.  
  59. stock bool bIsSurvivor(int client)
  60. {
  61.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  62. }
Advertisement
Add Comment
Please, Sign In to add comment