Raised This Month: $51 Target: $400
 12% 

Knife Spark


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ayemnowan
Member
Join Date: Aug 2015
Old 06-06-2017 , 05:16   Knife Spark
Reply With Quote #1

Good day, can anyone please remove other things on these plugin I only want knife spark and a cvar to enable or disable it.

It's for CS 1.6 I attach a picture I found on internet, just to clarify.

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN_NAME     "Bloody Corpses"
#define PLUGIN_AUTHOR    "se7h/BlackCat"
#define PLUGIN_VERSION    "2.0"
#define RED_BLOOD_COLOR    248

new g_LastWeapon[33], g_LastAmmo[33], g_max_clientsbool:g_wounded[33]
new 
gradius[4] = {14131114}
new 
gorigin[33][4][3]
new 
spr_blood_dropspr_blood_spray
new gSprRedBloodDecal[8] = {190,191,192,193,194,195,196,197}
new 
gSprYellowBloodDecal[8] = {190,191,192,193,194,195,196,197}

new 
hitflesh[4][] = 
{
    
"weapons/knife_hit1.wav"
    
"weapons/knife_hit2.wav",
    
"weapons/knife_hit3.wav",
    
"weapons/knife_hit4.wav"
}

new 
scream[4][] =
{
    
"player/death6.wav",
    
"player/die1.wav",
    
"player/die2.wav",
    
"player/die3.wav"
}

new 
pain[5][] =
{
    
"player/pl_pain2.wav",
    
"player/pl_pain4.wav",
    
"player/pl_pain5.wav",
    
"player/pl_pain6.wav",
    
"player/pl_pain7.wav"    
}

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
register_event("ClCorpse""event_cl_corpse""a")
    
register_event("CurWeapon""event_curweapon""be""1=1")
    
    
register_forward(FM_EmitSound"fwEmitSound")

    
g_max_clients global_get(glb_maxClients)
}

public 
plugin_precache()
{
    
spr_blood_drop precache_model("sprites/blood.spr")
    
spr_blood_spray precache_model("sprites/bloodspray.spr")
}

public 
event_cl_corpse()
{
    static 
id
    id 
read_data(12)

    if(!
is_user_connected(id))
        return

    
g_wounded[id] = (random(2) == 0) ? true false

    
static Float:origin1[3], Float:origin2[3], Float:angle[3]

    
engfunc(EngFunc_GetBonePositionid6origin1angle)
    
FVecIVec(origin1gorigin[id][0])

    
engfunc(EngFunc_GetBonePositionid2origin2angle)
    
FVecIVec(origin2gorigin[id][1])

    
engfunc(EngFunc_GetBonePositionid32origin1angle)
    
engfunc(EngFunc_GetBonePositionid37origin2angle)
    
mid_point(origin1origin2gorigin[id][2])

    
engfunc(EngFunc_GetBonePositionid33origin1angle)
    
engfunc(EngFunc_GetBonePositionid38origin2angle)
    
mid_point(origin1origin2gorigin[id][3])
}

public 
fwEmitSound(idchannelsound[])
{
    if(!(
<= id <= g_max_clients) || !is_user_alive(id) || !equali(sound"weapons/knife_hitwall1.wav") || g_LastWeapon[id] != CSW_KNIFE || !(pev(idpev_button) & (IN_ATTACK IN_ATTACK2)))
        return 
FMRES_IGNORED

    
return doit(id)
}

public 
event_curweapon(id
{
    static 
WIDClip
    WID 
read_data(2)
    
Clip read_data(3)

    switch(
WID)
    {
        case 
CSW_KNIFE:
        {
            
g_LastWeapon[id] = WID 
            
return PLUGIN_CONTINUE
        
}
        case 
CSW_HEGRENADECSW_FLASHBANGCSW_SMOKEGRENADECSW_C4: return PLUGIN_CONTINUE
    
}
    if(
g_LastWeapon[id] == WID && g_LastAmmo[id] > Clip)
        
doit(id)

    
g_LastWeapon[id] = WID
    g_LastAmmo
[id] = Clip
    
    
return PLUGIN_CONTINUE
}

find_dead_body(idAim[3], body 0)
{
    static 
ij
    get_user_origin
(idAim3)
    for(
i=1i<=g_max_clientsi++)
    {
        for(
j=0j<4j++)
        {
            if((
get_distance(Aimgorigin[i][j]) < gradius[j]) && (!body || body == i))
                return 
i
        
}
    }
    return 
0
}

stock doit(id)
{
    static 
Aim[3], Float:fAim[3], Point[3], bodyFloat:oldtimeFloat:curtime
    body 
find_dead_body(idAim)
    
curtime get_gametime()
    
    if(!
body || is_user_alive(body))
    {
        if(
g_LastWeapon[id] == CSW_KNIFE)
        {
            
get_user_origin(idPoint)
            
            if(
get_distance(AimPoint) < 66)
                
sparks(Aim)
        }
        return 
FMRES_IGNORED
    
}
    
get_points(idAimPointfAim)
    static 
dead    // Fixed by [TagPro] to support Normal Mode
    
dead is_user_alive(body)
    
func_fx_bloodsprite(deadPoint)
    
func_fx_blood_decal(deadAim)
    
engfunc(EngFunc_EmitAmbientSound0fAimhitflesh[random(4)], VOL_NORMATTN_NORM0PITCH_NORM)
    if(
g_wounded[body] && (curtime oldtime) > 1.0)
    {
        
oldtime curtime
        g_wounded
[body] = (random(3) == 0) ? true false
        
if(g_wounded[body])
            
engfunc(EngFunc_EmitAmbientSound0fAimpain[random(5)], VOL_NORMATTN_NORM0PITCH_NORM)
        else
            
engfunc(EngFunc_EmitAmbientSound0fAimscream[random(4)], VOL_NORMATTN_NORM0PITCH_NORM)
    }
    return 
FMRES_SUPERCEDE
}

stock get_points(id, const aim[3], out[3], Float:faim[3])
{
    static 
start[3], Float:fmultFloat:fstart[3], Float:fout[3]
    
get_user_origin(idstart1)

    
IVecFVec(startfstart)
    
IVecFVec(aimfaim)

    
fout[2] = faim[2] + random_float(10.012.0)
    
fout[0] = faim[2] - fstart[2]
    
fmult = (fout[0] == 0.0) ? 0.0 : ((fout[2] - fstart[2])/fout[0])
    
fout[0] = fmult*(faim[0] - fstart[0]) + fstart[0]
    
fout[1] = fmult*(faim[1] - fstart[1]) + fstart[1]

    
FVecIVec(foutout)
}

stock func_fx_bloodsprite(zombieorigin[])
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BLOODSPRITE)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
write_short(spr_blood_spray)
    
write_short(spr_blood_drop)
    
write_byte(zombie RED_BLOOD_COLOR RED_BLOOD_COLOR)
    
write_byte(random_num(4,7))
    
message_end()
}

stock func_fx_blood_decal(zombieorigin[])
{
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_WORLDDECAL)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
write_byte(zombie gSprYellowBloodDecal[random(6)] : gSprRedBloodDecal[random(8)])
    
message_end()
}

stock sparks(origin[])
{
    
message_begin(MSG_ALLSVC_TEMPENTITY)
    
write_byte(TE_SPARKS)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
message_end()
}

stock mid_point(const Float:origin1[], const Float:origin2[], out[])
{
    
out[0] = floatround(origin1[0] + origin2[0])/2
    out
[1] = floatround(origin1[1] + origin2[1])/2
    out
[2] = floatround(origin1[2] + origin2[2])/2

ayemnowan is offline
Houssam Benmouna
Senior Member
Join Date: Apr 2016
Old 06-06-2017 , 12:57   Re: Knife Spark
Reply With Quote #2

You Want The Sounds With IT? OR WHAT?
Houssam Benmouna is offline
Houssam Benmouna
Senior Member
Join Date: Apr 2016
Old 06-06-2017 , 13:04   Re: Knife Spark
Reply With Quote #3

You Meant Like This??!

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN_NAME     "Bloody Corpses"
#define PLUGIN_AUTHOR    "se7h/BlackCat"
#define PLUGIN_VERSION    "2.0"

new g_LastWeapon[33], g_LastAmmo[33]

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
register_event("CurWeapon""event_curweapon""be""1=1")

}

public 
event_curweapon(id
{
    static 
WIDClip
    WID 
read_data(2)
    
Clip read_data(3)

    switch(
WID)
    {
        case 
CSW_KNIFE:
        {
            
g_LastWeapon[id] = WID 
            
return PLUGIN_CONTINUE
        
}
        case 
CSW_HEGRENADECSW_FLASHBANGCSW_SMOKEGRENADECSW_C4: return PLUGIN_CONTINUE
    
}
    if(
g_LastWeapon[id] == WID && g_LastAmmo[id] > Clip)
       
// doit(id)

    
g_LastWeapon[id] = WID
    g_LastAmmo
[id] = Clip
    
    
return PLUGIN_CONTINUE

Houssam Benmouna is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-06-2017 , 14:32   Re: Knife Spark
Reply With Quote #4

He explained very clear that he wants only the knife spark effect.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
ayemnowan
Member
Join Date: Aug 2015
Old 06-06-2017 , 23:32   Re: Knife Spark
Reply With Quote #5

Quote:
Originally Posted by Houssam Benmouna View Post
You Meant Like This??!

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN_NAME     "Bloody Corpses"
#define PLUGIN_AUTHOR    "se7h/BlackCat"
#define PLUGIN_VERSION    "2.0"

new g_LastWeapon[33], g_LastAmmo[33]

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
register_event("CurWeapon""event_curweapon""be""1=1")

}

public 
event_curweapon(id
{
    static 
WIDClip
    WID 
read_data(2)
    
Clip read_data(3)

    switch(
WID)
    {
        case 
CSW_KNIFE:
        {
            
g_LastWeapon[id] = WID 
            
return PLUGIN_CONTINUE
        
}
        case 
CSW_HEGRENADECSW_FLASHBANGCSW_SMOKEGRENADECSW_C4: return PLUGIN_CONTINUE
    
}
    if(
g_LastWeapon[id] == WID && g_LastAmmo[id] > Clip)
       
// doit(id)

    
g_LastWeapon[id] = WID
    g_LastAmmo
[id] = Clip
    
    
return PLUGIN_CONTINUE

Good day, No I only want a spark upon hitting a wall,a metal or anything solid using a knife.. thanks for your reply.
ayemnowan is offline
ayemnowan
Member
Join Date: Aug 2015
Old 07-27-2017 , 04:36   Re: Knife Spark
Reply With Quote #6

bump, anyone?
ayemnowan is offline
kristi
Senior Member
Join Date: Nov 2016
Old 07-27-2017 , 15:47   Re: Knife Spark
Reply With Quote #7

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> public plugin_init() {     RegisterHam(Ham_TraceAttack, "worldspawn", "fw_HamTraceAttackPost", 1) } public fw_HamTraceAttackPost(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType) {     if(get_user_weapon(iAttacker) == CSW_KNIFE)     {         new Float:vecEnd[3]         get_tr2(ptr, TR_vecEndPos, vecEnd)             message_begin(MSG_BROADCAST, SVC_TEMPENTITY);         write_byte(TE_SPARKS);         engfunc(EngFunc_WriteCoord, vecEnd[0])         engfunc(EngFunc_WriteCoord, vecEnd[1])         engfunc(EngFunc_WriteCoord, vecEnd[2])         message_end();     }     return HAM_IGNORED }
kristi is offline
Send a message via Skype™ to kristi
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode