AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   headshot sound when doing headshot (https://forums.alliedmods.net/showthread.php?t=133984)

Afro-Ankan 07-30-2010 15:42

headshot sound when doing headshot
 
hello, im trying to make a own "Knife fight" plugin and now i need some

help with headshot sound when you kill an enemy with headshot a hud

msg should be shown and a headshot sound should play. but i don't really know how to do


THANKS

Arkshine 07-30-2010 16:00

Re: headshot sound when doing headshot
 
Learn pawn, see the existing tutorials, wiki, others plugin source, etc. There are many resources. Before wanting to do a plugin, learn the basics.

Gadzislaw007 07-30-2010 16:00

Re: headshot sound when doing headshot
 
Include:
PHP Code:

#include <hamsandwich> 

Register:
PHP Code:

RegisterHam(Ham_TraceAttack"player""TraceAttack"); 

Public
PHP Code:

public TraceAttack(victimattackerFloat:damageFloat:dir[3], resultdmgbits)
{
            if(
get_tr2(resultTR_iHitgroup) = HIT_HEAD)
            {
                if(
get_user_health(victim) <= damage)
                {
                    
////emit_sound
                    ////hud_message
                
{
            }


Untested.

Afro-Ankan 07-30-2010 16:03

Re: headshot sound when doing headshot
 
thanks, but im gonna do what arkshine told me to do, thanks anyway :)

Devil259 07-30-2010 16:04

Re: headshot sound when doing headshot
 
Why you don't hook Ham_Killed Gadzislaw007 ?

Gadzislaw007 07-30-2010 16:07

Re: headshot sound when doing headshot
 
LoL. I'm new so I don't know every command - forgot about something really simple, hamtrace was my first idea. But yeah, my bad :).

Devil259 07-30-2010 16:10

Re: headshot sound when doing headshot
 
You can hook Ham_Killed or event DeathMsg

PHP Code:

public fw_Ham_Killed()

     if ( 
read_data(3) )
     {
           
// stuff
     
}



grimvh2 07-30-2010 17:08

Re: headshot sound when doing headshot
 
Guys he wants headshot, just register then normal death even and do read_data(3)

Devil259 07-30-2010 18:39

Re: headshot sound when doing headshot
 
Fixed, thank you, I forgot :mrgreen:

Bugsy 07-30-2010 21:52

Re: headshot sound when doing headshot
 
Search the forums prior to requesting code.

Untested.
PHP Code:

public plugin_init()
{
    
register_event"DeathMsg" "EvDeathMsg" "a" "3=1" "4&knife" );    
}

public 
EvDeathMsg()
{
    static 
szKiller33 ] , szVictim33 ];
    new 
iKiller read_data);
    new 
iVictim read_data);

    
get_user_nameiKiller szKiller charsmaxszKiller ) );
    
get_user_nameiVictim szVictim charsmaxszVictim ) );
    
    
client_cmd"spk misc/headshot" );
    
client_printprint_chat "* %s killed %s with knife headshot!" szKiller szVictim );




All times are GMT -4. The time now is 00:08.

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