
I would like it for to be used when you kill someone by the fists (weapon_fists), You get that overlay. Have a great weekend coming up. Stay KOOL and safe out there.



Code: Select all
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"viewmodel" "models/weapons/v_fists.mdl"
"playermodel" "models/weapons/w_fists.mdl"
// this prefix will be used and fixed by customguns if this gun is custom
// more prefixes can be found in weapon scripts files
"anim_prefix" "crowbar"
"clip_size" "-1"
"primary_ammo" "None"
"secondary_ammo" "None"
"autoswitchto" "0"
"autoswitchfrom" "0"
SoundData
{
"single_shot" "Weapon_Crowbar.Single"
"melee_hit" "Weapon_Crowbar.Melee_Hit"
"melee_hit_world" "Weapon_Crowbar.Melee_HitWorld"
}
"CustomGunsPluginData"
{
"name" "fists"
// mdl or vmt for selection menu
"model" "materials/vgui/cursors/hand.vmt"
// make the gun usable only by admins who have this flag(s), or -1 to alow everyone to use the gun
"admin_level" "-1"
// add this gun to player's inventory on spawn?
"give_on_spawn" "1"
// add this gun to player's inventory when he equips this weapon
"give_with_weapon" ""
// binds to this weapon, auto switching when player selects it; if set, both weapons should use the same ammo type and give_with_weapon should be set the same as this!
"bind_to_weapon" ""
// if 1, does not disappear from inventory when player drops the physical weapon or is stripped from weapons; recommended for admin weapons or weapons given on spawn
"persistent" "1"
// weapon_type - possible values:
// bullet - (default) Standard bullet weapon, uses clip sizes and ammo type defined above
// throwable - Throws something away from the player - grenades, molotovs, ..
// custom - Custom coded weapon
"weapon_type" "custom"
"custom_settings"
{
// * If set to 1, this custom gun will use game-defined ammo type (set above) and behavior instead of plugin managed ammo.
// * Fire functions will be managed by game, so they won't be called when the weapon runs out of ammo.
// * Use with CG_RemovePlayerAmmo() native
//
// ** Setting this to 0 will allow you to manage ammo ("m_iClip1" value) yourself via plugin. This overrides ammotype to an unknown value.
// ** Fire functions will always be called when the weapon is ready to fire, without any ammo checks. Also set this to 0 if your weapon doesn't use ammo.
// ** Set "primary_ammo" other than "None" to enable HUD ammo display.
"uses_game_ammo" "0"
}
"download"
{
"item" "models/weapons/v_shovel.dx80.vtx"
"item" "models/weapons/v_shovel.dx90.vtx"
"item" "models/weapons/v_shovel.mdl"
"item" "models/weapons/v_shovel.sw.vtx"
"item" "models/weapons/v_shovel.vvd"
"item" "models/weapons/w_shovel.dx80.vtx"
"item" "models/weapons/w_shovel.dx90.vtx"
"item" "models/weapons/w_shovel.mdl"
"item" "models/weapons/w_shovel.phy"
"item" "models/weapons/w_shovel.sw.vtx"
"item" "models/weapons/w_shovel.vvd"
}
}
}
Code: Select all
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <customguns>
#define WEAPON "weapon_fists"
#define REFIRE 0.55
#define RANGE 40.0
#define DAMAGE 10.0
#define PUSH_SCALE 30.0
float additionalTime[MAXPLAYERS+1];
float nextEnergy[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Weapon_Fists",
author = "Master(D)",
description = "CustomGuns Weapon_Fists Extension",
version = "00.00.01",
url = ""
};
public void CG_OnHolster(int client, int weapon, int switchingTo)
{
char sWeapon[32];
GetEntityClassname(weapon, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon, WEAPON))
{
additionalTime[client] = 0.0;
nextEnergy[client] = 0.0;
}
}
public void CG_OnPrimaryAttack(int client, int weapon)
{
char sWeapon[32];
GetEntityClassname(weapon, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon, WEAPON))
{
//Declare:
int Random = GetRandomInt(2, 5);
vmSeq(client, Random, REFIRE)
CG_SetPlayerAnimation(client, PLAYER_ATTACK1);
//CG_PlayActivity(weapon, ACT_VM_SECONDARYATTACK);
if(additionalTime[client] <= 0.025)
{
additionalTime[client] = 0.025;
}
additionalTime[client] += additionalTime[client]*1.2;
if(additionalTime[client] >= 0.5)
{
additionalTime[client] = 0.5;
}
CG_Cooldown(weapon, REFIRE + additionalTime[client]);
float pos[3], angles[3], endPos[3];
CG_GetShootPosition(client, pos);
GetClientEyeAngles(client, angles);
GetAngleVectors(angles, endPos, NULL_VECTOR, NULL_VECTOR);
ScaleVector(endPos, RANGE);
AddVectors(pos, endPos, endPos);
TR_TraceHullFilter(pos, endPos, view_as<float>({-10.0, -10.0, -10.0}), view_as<float>({10.0, 10.0, 10.0}), MASK_SHOT_HULL, TraceEntityFilter, client);
float punchAngle[3];
punchAngle[0] = GetRandomFloat( 1.0, 2.0 );
punchAngle[1] = GetRandomFloat( -2.0, -1.0 );
Tools_ViewPunch(client, punchAngle);
if(TR_DidHit())
{
EmitGameSoundToAll("Weapon_Crowbar.Melee_Hit", weapon);
int entityHit = TR_GetEntityIndex();
if(entityHit > 0 && (!IsPlayer(entityHit) || GetClientTeam(entityHit) != GetClientTeam(client)) )
{
char classname[32];
GetEntityClassname(entityHit, classname, sizeof(classname));
if(GetEntityMoveType(entityHit) == MOVETYPE_VPHYSICS || StrContains(classname, "npc_") == 0)
{
float force[3];
GetAngleVectors(angles, force, NULL_VECTOR, NULL_VECTOR);
ScaleVector(force, PUSH_SCALE);
TeleportEntity(entityHit, NULL_VECTOR, NULL_VECTOR, force);
if(GetEntityMoveType(entityHit) == MOVETYPE_VPHYSICS)
{
SetEntPropVector(entityHit, Prop_Data, "m_vecAbsVelocity", NULL_VECTOR); //trampoline fix
}
}
SDKHooks_TakeDamage(entityHit, client, client, DAMAGE, DMG_CLUB);
}
// Do additional trace for impact effects
// if ( ImpactWater( pos, endPos ) ) return;
float impactEndPos[3];
GetAngleVectors(angles, impactEndPos, NULL_VECTOR, NULL_VECTOR);
ScaleVector(impactEndPos, 50.0);
TR_GetEndPosition(endPos);
AddVectors(impactEndPos, endPos, impactEndPos);
TR_TraceRayFilter(endPos, impactEndPos, MASK_SHOT_HULL, RayType_EndPoint, TraceEntityFilter, client);
if(TR_DidHit())
{
UTIL_ImpactTrace(pos, DMG_CLUB);
}
}
else
{
EmitGameSoundToAll("Weapon_Crowbar.Single", weapon);
}
}
}
public void CG_ItemPostFrame(int client, int weapon)
{
char sWeapon[32];
GetEntityClassname(weapon, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon, WEAPON))
{
if(!(GetClientButtons(client) & IN_ATTACK) && GetGameTime() >= nextEnergy[client])
{
additionalTime[client] *= 0.5;
nextEnergy[client] = GetGameTime() + 0.25;
}
}
}
public bool TraceEntityFilter(int entity, int mask, any data)
{
if (entity == data)
return false;
return true;
}
Users browsing this forum: No registered users and 59 guests