AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me PLZ part 2 :) (https://forums.alliedmods.net/showthread.php?t=63080)

sQn 11-11-2007 11:51

Help me PLZ part 2 :)
 
I wants in order to all near (about) it victims or attackers listens sounds tk and ta.


PHP Code:

#include <amxmodx>
#include <amxmisc>
new const PLUGIN[] = "Ta and tk sounds"
new const VERSION[] = "1.0"
new const AUTHOR[] = "sQn"
new const g_teamattack_sounds[][] =
{
 
"tk_1.wav",
 
"tk_2.wav",
 
"tk_3.wav",
 
"tk_4.wav"
}
new const 
g_teamkill_sounds[][] =
{
 
"taunt_1.wav",
 
"taunt_2.wav",
 
"taunt_3.wav",
 
"taunt_4.wav",
 
"taunt_5.wav"
}
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_event("Damage""damage_event""b""2>10")
 
}
public 
plugin_precache()
{
 
precache_sound"FtF/tk_1.wav" )
 
precache_sound"FtF/tk_2.wav" )
 
precache_sound"FtF/tk_3.wav" )
 
precache_sound"FtF/tk_4.wav" )
 
 
precache_sound"FtF/taunt_1.wav" )
 
precache_sound"FtF/taunt_2.wav" )
 
precache_sound"FtF/taunt_3.wav" )
 
precache_sound"FtF/taunt_4.wav" )
 
precache_sound"FtF/taunt_5.wav" )
}
public 
client_damage(attackervictimdamagewpnindexhitplaceTA)
{
 if(
TA)
 {
  
emit_sound(victimCHAN_VOICEg_teamattack_sounds[random_num(0sizeof g_teamattack_sounds 1)], VOL_NORMATTN_NORM0PITCH_NORM)
 }
}
public 
damage_eventvictim ) {
   
   new 
damage read_data(2)
   new 
weaponhitplace
   
new attacker get_user_attacker(victim,weapon,hitplace)
   return 
PLUGIN_CONTINUE
//TK
  
  
else if (get_user_health(victim) <= &&(get_user_team(victim) == get_user_team(attacker)) {
   if (
getrandom() >= && getrandom() <= 80) {
   
client_cmd(attacker,"spk FtF/pl/tk_1.wav")
   
client_cmd(victim,"spk FtF/pl/taunt_1.wav")
   }
   if (
getrandom() >= && getrandom() <= 80) {
   
client_cmd(attacker,"spk FtF/pl/tk_2.wav")
   
client_cmd(victim,"spk FtF/pl/taunt_2.wav")
   }
   if (
getrandom() >= && getrandom() <= 80) {
   
client_cmd(attacker,"spk FtF/pl/tk_3.wav")
   
client_cmd(victim,"spk FtF/pl/taunt_3.wav")
   }
   else {
   return 
PLUGIN_CONTINUE
}



sQn 11-11-2007 16:21

Re: Help me PLZ part 2 :)
 
Any help ?? :0

purple_pixie 11-13-2007 05:58

Re: Help me PLZ part 2 :)
 
I'm sorry if this doesn't really help, but I've not a lot of experience with sound.

All I can say is you shouldn't be re-calling getrandom(), but using the same random number throughout the function.

Call it once and save it, or it is possible none of your sounds get played.


All times are GMT -4. The time now is 01:18.

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