Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <sdkhooks>
- #define HITGROUP_HEAD 0
- #define ZC_SMOKER 1
- #define ZC_HUNTER 3
- #define VALUE 1.5
- new hitgroup;
- new bool:g_HeadShot;
- public OnPluginStart()
- {
- HookEvent("player_hurt", OnPlayerHurt);
- for (new i = 0; i < MAXPLAYERS + 1; i++)
- {
- SDKHook(i, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- }
- public OnClientPutInServer(client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- public Action:OnPlayerHurt(Handle:event, const String:name[], bool:dontBrodcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- new iClass = GetEntProp(client, Prop_Send, "m_zombieClass");
- hitgroup = GetEventInt(event, "hitgroup");
- if(hitgroup == 1 || iClass == ZC_SMOKER & ZC_HUNTER)
- {
- g_HeadShot = true;
- PrintCenterTextAll("Head Shot");
- }
- else
- {
- g_HeadShot = false;
- PrintCenterTextAll("Not Head Shot");
- }
- }
- public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
- {
- if (bIsSurvivor(attacker))
- {
- if(damagetype == DMG_BULLET || g_HeadShot == true)
- {
- damage *= 0.1;
- return Plugin_Changed;
- }
- }
- return Plugin_Continue;
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment