View Single Post
x7s
New Member
Join Date: Feb 2012
Location: Rousse - Bulgaria
Old 02-24-2018 , 14:06   Re: Helmet Hit Sound
Reply With Quote #29

Hello guys i trying to optimized for 1.8.3 if wrong somethink please tell me where i wrong

PHP Code:
//Tested and working good at Amx Mod X 1.8.3
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_stocks>

#define PLUGIN    "Helmet Hit Sound"
#define AUTHOR    "tmen13"
#define VERSION    "1.0"

#define OFFSET_ARMORTYPE 112
#define fm_get_user_armor_type(%1) get_pdata_int(%1, OFFSET_ARMORTYPE)

#if AMXX_VERSION_NUM < 183 
    #define MAX_PLAYERS    32
#endif

//This is from previos version of Amx Mod X
/*new MAX_PLAYERS;*/

new const SOUND[] = "misc/helmet.wav";

// This is from previos version of Amx Mod X
/*public plugin_cfg()
{
    MAX_PLAYERS = get_maxplayers();
}*/

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""playerTakeDamage");
}
public 
plugin_precache()
{
    
precache_sound(SOUND)
}
public 
playerTakeDamage(victiminflictorattackerFloat:fDamagebitDamage
{
    
/*if( (1 <= victim <= MAX_PLAYERS) && (1 <= attacker <= MAX_PLAYERS) && is_user_connected(victim))*/ // This is from previos version of Amx Mod X
    
if( (<= victim <= MaxClients) && (<= attacker <= MaxClients) && is_user_connected(victim))
    {
        new 
gun,hitZone
        get_user_attacker
(victim,gun,hitZone)
                
        if( (
fm_get_user_armor_type(victim) & 2) && (hitZone == HIT_HEAD))
        {
            new 
Float:origin[3];
            
pev(victim,pev_origin,origin);
            
            
EF_EmitAmbientSound(0,origin,SOUND1.0ATTN_NORMPITCH_NORM);
        }
    }

x7s is offline
Send a message via ICQ to x7s Send a message via Skype™ to x7s