#include

public Action OnTakeDamage(int client, int attacker, int inflictor, float damage, int dmgtype) { if (IsClientInGame(client) && IsClientInGame(attacker)) { if (IsPlayerAlive(client) && !IsPlayerAlive(attacker) && GetClientTeam(client) == GetClientTeam(attacker)) { int weapon = GetClientActiveWeapon(attacker); if (GetWeaponSlot(weapon) == WEAPON_SLOT_PRIMARY && GetWeaponClass(weapon) == TF_WEAPON_SNIPERRIFLE) { int clip = GetWeaponClip(weapon); if (clip > 0) { // 清空当前弹夹 SetWeaponClip(weapon, 0);

                // 给被攻击者回复15点血量
                SetEntityHealth(client, GetEntityHealth(client) + 15);
                
                // 如果被攻击者倒地,立即起身并且移除黑白状态
                if (IsPlayerOnGround(client))
                {
                    SetPlayerOnGround(client, false);
                    SetPlayerCond(client, TF_COND_BLIND, false);
                }
            }
        }
    }
}

return Plugin_Handled;

}

public void OnPluginStart() { HookEvent("player_hurt", OnTakeDamage, EventHookMode_Post); }

public void OnPluginEnd() { UnhookEvent("player_hurt", OnTakeDamage); }


原文地址: https://www.cveoy.top/t/topic/pEb1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录