Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sourcemod>
- #include <sdktools>
- public void OnPluginStart()
- {
- HookEvent("infected_hurt", Hurt);
- }
- public Action Hurt (Handle event, const char[] name, bool dontBroadcast)
- {
- int entity = GetEventInt(event, "entityid");
- int attacker = GetEventInt(event, "attacker");
- int damagetype = GetEventInt(event, "type");
- if(damagetype == 128 && IsCommonInfected(entity) && IsSurvivor(attacker))
- {
- float current[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", current, 0);
- if(GetRandomInt(-4, 4) >= 0)
- current[0] += 4;
- else
- current[0] -= 4;
- TeleportEntity(entity, current, NULL_VECTOR, NULL_VECTOR);
- SetEventInt(event, "amount", 0);
- SetEntProp(entity, Prop_Data, "m_iHealth", 50);
- }
- }
- stock bool IsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement