View Single Post
Author Message
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 12-08-2019 , 08:10   [CS:GO] AddNormalSoundHook is getting as native error
Reply With Quote #1

Hey!

Today I tried to do something different...

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"

char firesound[] = "sound/weapon/knife/knife_slash1.wav" 

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma newdecls required

public Plugin myinfo 
{
    
name "[SpirT] Custom Weapon Fire Sounds",
    
author PLUGIN_AUTHOR,
    
description "This plugin allows a client to change his weapon fire sound WARNING: For client, it would play the sound that he choosed and the client sided sound, because that cannot be changed (i think)...",
    
version PLUGIN_VERSION,
    
url "https://paypal.me/spirtcfg"
};

public 
void OnPluginStart()
{
    
HookEvent("weapon_fire"OnWeaponFire);
}

public 
Action OnWeaponFire(Event eventchar[] namebool dontBroadCast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    if(
CheckCommandAccess(client"weapon_vip_firesound"ADMFLAG_ROOT))
    {
        
char weapon[64];
        
GetClientWeapon(clientweaponsizeof(weapon));
        if(
StrEqual(weapon"weapon_ak47"))
        {
            
SetWeaponFireSound();
        }
    }
}

void SetWeaponFireSound()
{
    
AddNormalSoundHook(SoundHook);
}

public 
Action SoundHook(int clients[64], int &numClientschar sound[PLATFORM_MAX_PATH], int &entityint &channelfloat &volumeint &levelint &pitchint &flags)
{
    if(
StrContains(sound"weapons/ak47/ak47_01"))
    {
        
EmitSoundToAll(firesoundentitychannellevelflagsvolumepitch);
    }

As u can see above, there is the code for changing the sound to others...

But when compiling I got this error:
http://prntscr.com/q7v0uv

What's the solution for it?

Thanks for helping and best regards,

SpirT.
__________________

Last edited by SpirT; 12-08-2019 at 08:11.
SpirT is offline