Raised This Month: $32 Target: $400
 8% 

Can someone help me please? DeathType Effects


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OmgKhalifa
Member
Join Date: Aug 2018
Location: Marijuana Land
Old 08-23-2019 , 23:56   Can someone help me please? DeathType Effects
Reply With Quote #1

Can someone edit this plugin below and add a working custom knife sound and a hud that shows when someone gets knifed (example OmgKhalifa SHANKED <player name>!!! and a custom knife sound that players and others who are near them can hear it too.

I have already tried adding a custom sound to the current but it does not seem to play

if anyone wants to make it from scratch just the sound and hud i do not mind but i would love my current plugin to be fixed/added to. so its all in one plugin. (Makes more sense to me)
Attached Files
File Type: sma Get Plugin or Get Source (ls_death_effects.sma - 161 views - 3.9 KB)
__________________

Last edited by OmgKhalifa; 08-23-2019 at 23:56.
OmgKhalifa is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-24-2019 , 11:49   Re: Can someone help me please? DeathType Effects
Reply With Quote #2

Is this enough ?
PHP Code:
#include <amxmodx> 

new toggle_plugin,toggle_hs

new const MESSAGE[] = "%s SHANKED %s with a knife" // Attacker name , Victim name
new const HS_MESSAGE[] = "%s SHANKED %s head's with a knife" // same as up

// RED , GREEN , BLUE
new const HUD_COLOR[3] = {255 0}

const 
FloatHUD_POSITION_X = -1.0

const FloatHUD_POSITION_Y 0.25

const HOLD_TIME 3


new g_sounds[][] = 

    
"sound.wav"
    
"sound2.wav"
    
"sound3.wav"
    
"sound4.wav"
    
"sound5.wav" 


public 
plugin_precache() 

    for (new 
ii<sizeof g_soundsi++) 
    
precache_sound(g_sounds[i]) 


public 
plugin_init() 

    
register_plugin"Custom Knife Sound""0.01""LearninG" 

    
toggle_plugin register_cvar("death_effects","1")
    
toggle_hs register_cvar("hs_effect","1")

    
register_event("DeathMsg""Player_Die""a""2>0"


public 
Player_Die(iAttacker iVictim)
{
    if (
get_pcvar_num(toggle_plugin) != 1)
        return 
PLUGIN_HANDLED
    
static iAttacker iVictim iHS iWpn ,  szName_Attacker[32] , szName_Victim[32]

    
iAttacker read_data(1)
    
iVictim read_data(2)
    
iHS read_data(3)
    
iWpn get_user_weapon(iAttacker)

    
get_user_name(iAttacker szName_Attacker charsmax(szName_Attacker))
    
get_user_name(iVictim szName_Victim charsmax(szName_Victim))

    if (
iWpn == CSW_KNIFE)
    {
        
set_hudmessage(HUD_COLOR[0] , HUD_COLOR[1] , HUD_COLOR[2] , HUD_POSITION_X HUD_POSITION_Y 08.06.00.30.3HOLD_TIME)
        
show_hudmessage(MESSAGE szName_Attacker szName_Victim)

        
emit_sound(iAttackerCHAN_AUTOg_sounds[random(sizeof g_sounds)], 1.0ATTN_NORM0PITCH_NORM

    }
    if (
iWpn == CSW_KNIFE && get_pcvar_num(toggle_hs) == && iHS)
    {
        
set_hudmessage(HUD_COLOR[0] , HUD_COLOR[1] , HUD_COLOR[2] , HUD_POSITION_X HUD_POSITION_Y 08.06.00.30.3HOLD_TIME)
        
show_hudmessage(HS_MESSAGE szName_Attacker szName_Victim)

        
emit_sound(iAttackerCHAN_AUTOg_sounds[random(sizeof g_sounds)], 1.0ATTN_NORM0PITCH_NORM

    }
    return 
PLUGIN_CONTINUE



Last edited by LearninG; 08-25-2019 at 01:58.
LearninG is offline
OmgKhalifa
Member
Join Date: Aug 2018
Location: Marijuana Land
Old 08-26-2019 , 17:04   Re: Can someone help me please? DeathType Effects
Reply With Quote #3

@LearninG Thank you!
__________________
OmgKhalifa is offline
OmgKhalifa
Member
Join Date: Aug 2018
Location: Marijuana Land
Old 08-26-2019 , 18:15   Re: Can someone help me please? DeathType Effects
Reply With Quote #4

@LearninG everything works great but noticed one slight bug sometimes out of it choosing a random sound it will either play both/all sounds at once or sometimes it will glitch and play the same sound twice is it possible to have it not glitch and play one random sound out of the listed.
__________________
OmgKhalifa is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-27-2019 , 05:12   Re: Can someone help me please? DeathType Effects
Reply With Quote #5

fixed.
PHP Code:
#include <amxmodx>
 #include <cstrike>

new toggle_plugin,toggle_hs

new const MESSAGE[] = "%s SHANKED %s with a knife" // Attacker name , Victim name
new const HS_MESSAGE[] = "%s SHANKED %s head's with a knife" // same as up

// RED , GREEN , BLUE
new const HUD_COLOR[3] = {255 0}

const 
FloatHUD_POSITION_X = -1.0

const FloatHUD_POSITION_Y 0.25

const HOLD_TIME 3


new g_sounds[][] = 

    
"sound.wav",
    
"sound2.wav",
    
"sound3.wav",
    
"sound4.wav",
    
"sound5.wav" 


public 
plugin_precache() 

    for (new 
ii<sizeof g_soundsi++) 
    
precache_sound(g_sounds[i]) 


public 
plugin_init() 

    
register_plugin"Custom Knife Sound""0.01""LearninG" 

    
toggle_plugin register_cvar("death_effects","1")
    
toggle_hs register_cvar("hs_effect","1")

    
register_event("DeathMsg""Player_Die""a""2>0"


public 
Player_Die(iAttacker iVictim)
{
    if (
get_pcvar_num(toggle_plugin) != 1)
        return 
PLUGIN_HANDLED
    
static iAttacker iVictim iHS iWpn ,  szName_Attacker[32] , szName_Victim[32]

    
iAttacker read_data(1)
    
iVictim read_data(2)
    
iHS read_data(3)
    
iWpn get_user_weapon(iAttacker)

    
get_user_name(iAttacker szName_Attacker charsmax(szName_Attacker))
    
get_user_name(iVictim szName_Victim charsmax(szName_Victim))

    if (
cs_get_user_team(iAttacker) == cs_get_user_team(iVictim))
    {
        return 
PLUGIN_HANDLED
    
}

    else if (
iWpn == CSW_KNIFE && !iHS)
    {
        
set_hudmessage(HUD_COLOR[0] , HUD_COLOR[1] , HUD_COLOR[2] , HUD_POSITION_X HUD_POSITION_Y 08.06.00.30.3HOLD_TIME)
        
show_hudmessage(MESSAGE szName_Attacker szName_Victim)
        
emit_sound(iAttackerCHAN_AUTOg_sounds[random(sizeof g_sounds)], 1.0ATTN_NORM0PITCH_NORM)


    }
    if (
iWpn == CSW_KNIFE && get_pcvar_num(toggle_hs) == && iHS)
    {
        
set_hudmessage(HUD_COLOR[0] , HUD_COLOR[1] , HUD_COLOR[2] , HUD_POSITION_X HUD_POSITION_Y 08.06.00.30.3HOLD_TIME)
        
show_hudmessage(HS_MESSAGE szName_Attacker szName_Victim
        
emit_sound(iAttackerCHAN_AUTOg_sounds[random(sizeof g_sounds)], 1.0ATTN_NORM0PITCH_NORM)

    } 
    return 
PLUGIN_CONTINUE



Last edited by LearninG; 08-27-2019 at 19:40.
LearninG is offline
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 07:17.


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