Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sdktools>
- #include <sdkhooks>
- public void OnClientPutInServer(int client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
- {
- if (!(damagetype & DMG_BURN && damagetype & DMG_BLAST))
- {
- if (IsCommonInfected(attacker))
- {
- if(IsValidClient(victim) && GetClientTeam(victim) == 2)
- {
- int vClass = GetEntProp(victim, Prop_Send, "m_zombieClass");
- if (vClass == 9) damage = GetRandomFloat(8.0, 16.0);
- return Plugin_Changed;
- }
- }
- }
- return Plugin_Continue;
- }
- stock bool IsCommonInfected(int entity)
- {
- if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
- {
- char entType[64];
- GetEdictClassname(entity, entType, sizeof(entType));
- return StrEqual(entType, "infected");
- }
- return false;
- }
- public bool IsValidClient(int client)
- {
- if (client <= 0)
- return false;
- if (client > MaxClients)
- return false;
- if (!IsClientInGame(client))
- return false;
- if (!IsPlayerAlive(client))
- return false;
- return true;
- }
Add Comment
Please, Sign In to add comment