mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 19:13:21 +00:00
Implement dull melee
This commit is contained in:
parent
c82ac230e1
commit
41efdd80d7
1 changed files with 17 additions and 1 deletions
|
@ -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) {
|
int FindClosestVisibleClient(int source) {
|
||||||
static float pos[3], ang[3];
|
static float pos[3], ang[3];
|
||||||
GetClientEyePosition(source, pos);
|
GetClientEyePosition(source, pos);
|
||||||
|
@ -544,4 +560,4 @@ int FindClosestVisibleClient(int source) {
|
||||||
|
|
||||||
public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
|
public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
|
||||||
return data != entity && entity <= MaxClients && GetClientTeam(entity) == 2 && IsPlayerAlive(entity);
|
return data != entity && entity <= MaxClients && GetClientTeam(entity) == 2 && IsPlayerAlive(entity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue