AlliedModders Donor
Join Date: Jul 2009
Location: Canada
|
08-08-2014
, 22:17
Does AddNormalSoundHook only work with one plugin at a time? Bug? Intentional?
|
#1
|
I'm having an issue where if I have a plugin with AddNormalSoundHook, any other plugins that have AddNormalSoundHook absolutely refuse to fire their callbacks whatsoever, effectively rendering them non-functional.
Is this a bug? Intentional? or what? It's making me want to rip my fucking hair out that much I can discern.
The code below refuses to run.
PHP Code:
public OnPluginStart() { GetGame(); // Works AddNormalSoundHook(SoundHook); // Doesn't Work }
public OnMapStart() { if(game == TF2) { LoadSoundSet(DispenserSongs, NumDispenserSongs); // Works } }
public Action:SoundHook(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags) // Doesn't work. { PrintToChatAll("%s", sample); // Test to see if the hook is firing. Doesn't ever trigger. Nothing below does either. if(game == TF2) { if(StrEqual(sample, "weapons/dispenser_idle.wav", false)) { new client = GetEntPropEnt(entity, Prop_Send, "m_hBuilder"); if(IsValidClient(client)) { new dispenser_song = StrikerMod_GetDonatorInfo_Int(client, DonatorInfo_Int_DispenserMusic); if(dispenser_song > 0 && dispenser_song <= NumDispenserSongs) { sample = DispenserSongs[dispenser_song-1]; level = SNDLEVEL_MINIBIKE; } else { return Plugin_Continue; } } else { return Plugin_Continue; } return Plugin_Changed; } } return Plugin_Continue; }
This is code from another plugin of mine. This is the only soundhook that works it seems...
Just warning, it's a fucking mess and I need to clean it up soon.
PHP Code:
public Action:SoundHook(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags) { if(GetConVarBool(cv_sounddebug)) { if(StrContains(sample, "player/footsteps", false) == -1 && StrContains(sample, "physics/", false) == -1) { PrintToChatAll("[DEBUG] Sound Played: %s", sample); } } if(game == TF2) { decl bool:PitchShifted; if(StrEqual(sample, ")weapons/sentry_shoot_mini.wav", false)) { sample = ")sm_weapons/sentry_shoot_mini.wav"; return Plugin_Changed; } else if(StrEqual(sample, ")weapons/sentry_shaft_shoot.wav", false)) { channel = SNDCHAN_AUTO; sample = ")sm_weapons/sentry_shaft_shoot.wav"; return Plugin_Changed; } else if(StrEqual(sample, ")weapons/sentry_shaft_shoot2.wav", false)) { channel = SNDCHAN_AUTO; sample = ")sm_weapons/sentry_shaft_shoot2.wav"; return Plugin_Changed; } else if(StrEqual(sample, ")weapons/sentry_shaft_shoot3.wav", false)) { channel = SNDCHAN_AUTO; sample = ")sm_weapons/sentry_shaft_shoot3.wav"; return Plugin_Changed; } else if(StrEqual(sample, "player/invulnerable_on.wav", false)) { sample = "ShadowMavs/invulnerable_on.wav"; return Plugin_Changed; } else if(StrEqual(sample, "player/quickfix_invulnerable_on.wav", false)) { sample = "ShadowMavs/quickfix_invulnerable_on.wav"; return Plugin_Changed; } else if(StrEqual(sample, ")weapons/weapon_crit_charged_on.wav", false)) { sample = "ShadowMavs/weapon_crit_charged_on.wav"; return Plugin_Changed; } else if(StrEqual(sample, "weapons/sentry_spot_client.wav", false)) { sample = "ShadowMavs/sentry_spot.wav"; return Plugin_Changed; } else if(StrEqual(sample, "weapons/sentry_spot.wav", false)) { sample = "ShadowMavs/sentry_spot.wav"; return Plugin_Changed; } else if(StrContains(sample, "cleaver_hit_world_", false) > -1) { switch(cleaver_type[entity]) { case 1,2: { sample = "sm_weapons/mario_fireball_hit.wav"; return Plugin_Changed; } case 3: { sample = PlasmaImpactSounds[GetRandomInt(0, NumPlasmaImpactSounds-1)]; CreateTimer(0.1, Timer_KillEntity, entity); return Plugin_Changed; } case 99: { sample = PlasmaImpactSounds[GetRandomInt(0, NumPlasmaImpactSounds-1)]; CreateParticle(entity, "eb_aura_calm01", 1.0, false, false, true); CreateTimer(0.1, Timer_KillEntity, entity); return Plugin_Changed; } } } else if(StrContains(sample, "cleaver_hit_", false) > -1) { switch(cleaver_type[entity]) { case 1,2: { sample = "sm_weapons/mario_fireball_hit_enemy.wav"; return Plugin_Changed; } case 3: { sample = ")sm_weapons/aura_hit.wav"; if(entity > MaxClients) { CreateTimer(0.1, Timer_KillEntity, entity); } return Plugin_Changed; } case 99: { sample = ")sm_weapons/aura_hit.wav"; if(entity > MaxClients) { CreateParticle(entity, "eyeboss_aura_calm", 1.0, false, false, true); CreateParticle(entity, "eb_tp_escape_bits", 1.0, false, false, true); CreateTimer(0.1, Timer_KillEntity, entity); } return Plugin_Changed; } } } else if(StrContains(sample, "physics/plastic/plastic_box_impact_", false) > -1) { return Plugin_Handled; } else if(StrContains(sample, "vo/", false) > -1 && IsValidClient(entity)) { if(!IsMvM()) { new Float:BodyScale = GetEntPropFloat(entity, Prop_Send, "m_flModelScale"); new Float:HeadScale = GetEntPropFloat(entity, Prop_Send, "m_flHeadScale"); if(BodyScale != 1.0 || HeadScale != 1.0) { if(channel == SNDCHAN_VOICE) { pitch = RoundToNearest((175 / (1 + (6 * BodyScale * HeadScale))) + 75); flags |= SND_CHANGEPITCH; PitchShifted = true; } } } if(StrContains(sample, "vo/pyro_", false) > -1 && IsValidClient(entity)) { switch(pyro_model[entity]) { case 1: { pitch += 20; flags |= SND_CHANGEPITCH; PitchShifted = true; } case 2: { ReplaceString(sample, 255, "vo/", "ShadowMavs/voices/gaben/", false); String_ToLower(sample, sample, 255); if(TF2_IsPlayerInCondition(entity, TFCond_Taunting)) { if(StrEqual(sample, "shadowmavs/voices/gaben/pyro_painsevere01.wav", false)) { sample = "shadowmavs/voices/gaben/gabe_shinku_v2.wav"; } else if(StrEqual(sample, "shadowmavs/voices/gaben/pyro_headright01.wav", false)) { sample = "shadowmavs/voices/gaben/gabe_hadouken_v2.wav"; } else if(StrEqual(sample, "shadowmavs/voices/gaben/pyro_paincrticialdeath01.wav", false)) { sample = "shadowmavs/voices/gaben/gabe_tostopagaben.wav"; } else if(StrEqual(sample, "shadowmavs/voices/gaben/pyro_paincrticialdeath03.wav", false)) { sample = "shadowmavs/voices/gaben/gabe_fasterstrongerbettergaben.wav"; } } return Plugin_Changed; } } } else if((StrContains(sample, "vo/heavy_", false) > -1) && GetConVarBool(cv_voices)) { if(is_tourettes[entity]) { ReplaceString(sample, 255, "vo/", "ShadowMavs/voices/tourettes_v2/", false); String_ToLower(sample, sample, 255); return Plugin_Changed; } } else if(StrContains(sample, "vo/taunts/medic_taunts16", false) > -1 && IsValidClient(entity)) { if(TF2_IsPlayerInCondition(entity, TFCond_Taunting)) { sample = ")ShadowMavs/smokeweedeveryday.mp3"; return Plugin_Changed; } } } if(GetConVarBool(cv_quake)) { if(StrContains(sample, "weapons/shotgun_shoot", false) > -1) { sample = ")ShadowMavs/weapons/railgun_v1.wav"; return Plugin_Changed; } } if(PitchShifted) { return Plugin_Changed; } } else if(game == CSTRIKE || game == HL2DM) { if(GetConVarBool(cv_voices)) { if(StrContains(sample, "player/death", false) > -1 || StrContains(sample, "pain07.wav", false) > -1 || StrContains(sample, "pain08.wav", false) > -1 || StrContains(sample, "pain09.wav", false) > -1 ) { decl String:ModelName[128]; GetEntPropString(entity, Prop_Data, "m_ModelName", ModelName, sizeof(ModelName)); if(StrContains(ModelName, "renamon", false) > -1) { sample = RenamonDeathSounds[GetRandomInt(0, NumRenamonDeathSounds-1)]; } else if(StrContains(ModelName, "combine", false) > -1 || StrContains(ModelName, "neo_heavy", false) > -1) { sample = CombineDeathSounds[GetRandomInt(0, NumCombineDeathSounds-1)]; } else if(StrContains(ModelName, "police", false) > -1) { sample = MetroCopDeathSounds[GetRandomInt(0, NumMetroCopDeathSounds-1)]; } else if(StrContains(ModelName, "duke", false) > -1) { sample = DukeDeathSounds[GetRandomInt(0, NumDukeDeathSounds-1)]; } else if(StrContains(ModelName, "spy", false) > -1) { sample = SpyDeathSounds[GetRandomInt(0, NumSpyDeathSounds-1)]; } else if(StrContains(ModelName, "sniper", false) > -1) { sample = SniperDeathSounds[GetRandomInt(0, NumSniperDeathSounds-1)]; } else { if(game == CSTRIKE) { sample = CSSDeathSounds[GetRandomInt(0, NumCSSDeathSounds-1)]; } else { return Plugin_Continue; } } level = SNDLEVEL_MINIBIKE; return Plugin_Changed; } } } return Plugin_Continue; }
edit:
Code:
00:07 <Striker> Yeah, I'm convinced there's either a limitation or a bug in sourcemod at this point...
00:08 <Striker> There's literally nothing wrong with the code I had written. Most of it came from the plugin that's working anyway. It just refuses to even consider running the Sound Hook..
Last edited by StrikerMan780; 08-08-2014 at 23:11.
|
|