Implement dull melee

This commit is contained in:
Jackzie 2021-10-16 12:37:28 -05:00
parent c82ac230e1
commit 41efdd80d7
No known key found for this signature in database
GPG key ID: 1E834FE36520537A

View file

@ -534,6 +534,22 @@ void EntityCreateCallback(int entity) {
}
}
//Dull Melee
public Action L4D2_MeleeGetDamageForVictim(int client, int weapon, int victim, float &damage) {
static int dullMeleeID;
if(!dullMeleeID) dullMeleeID = GetTrollID("Dull Melee");
if(Trolls[dullMeleeID].IsActive(client)) {
float max = 1.0;
if(Trolls[dullMeleeID].activeFlagClients[client] & 2) max = 0.5;
else if(Trolls[dullMeleeID].activeFlagClients[client] & 4) max = 0.1;
if(GetRandomFloat() <= max) {
damage = 0.0;
return Plugin_Changed;
}
}
return Plugin_Continue;
}
int FindClosestVisibleClient(int source) {
static float pos[3], ang[3];
GetClientEyePosition(source, pos);
@ -544,4 +560,4 @@ int FindClosestVisibleClient(int source) {
public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
return data != entity && entity <= MaxClients && GetClientTeam(entity) == 2 && IsPlayerAlive(entity);
}
}