Raised This Month: $ Target: $400
 0% 

Not Playing Random Sounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 04-17-2017 , 20:02   Not Playing Random Sounds
Reply With Quote #1

Code:
#include <amxmodx>

#define MESSAGESNOHP 5
#define MESSAGESHP 5

#define lastmansounds 10

new lastmanlist[lastmansounds][] = 
{
	"CSDsounds/lastman/lastman1",
	"CSDsounds/lastman/lastman2",
	"CSDsounds/lastman/lastman3",
	"CSDsounds/lastman/lastman4",
	"CSDsounds/lastman/lastman5",
	"CSDsounds/lastman/lastman6",
	"CSDsounds/lastman/lastman7",
	"CSDsounds/lastman/lastman8",
	"CSDsounds/lastman/lastman9",
	"CSDsounds/lastman/lastman10"
}

new alone_ann = 0

new messagesnohp[MESSAGESNOHP][] = {
"%i terrorist vs %i CT^n%s: Now All Depends On You!",
"%i terrorist vs %i CT^n%s: I Hope You Still Have A Healthpack.",
"%i terrorist vs %i CT^n%s: All Your Teammates Were Killed. Good Luck!",
"%i terrorist vs %i CT^n%s: Your Teammates are dead. It's time to die!",
"%i terrorist vs %i CT^n%s: Now You Are Alone. Have Fun!"};

new messageshp[MESSAGESHP][] = {
"%i terrorist vs %i CT^n%s (%i hp): Now All Depend On You!",
"%i terrorist vs %i CT^n%s (%i hp): I Hope You Still Have A Healthpack.",
"%i terrorist vs %i CT^n%s (%i hp): All Your Teammates Were Killed. Good Luck!",
"%i terrorist vs %i CT^n%s (%i hp): Your Teammates are dead. It's time to die!",
"%i terrorist vs %i CT^n%s (%i hp): Now You Are Alone. Have Fun!"};

public roundend_msg(id)

	alone_ann = 0

public death_msg(id)
{

	new lmmode[8] 
	get_cvar_string("lastman_mode",lmmode,8) 
	new lmmode_bit = read_flags(lmmode)

	new players_ct[32], players_t[32], ict, ite, last
	get_players(players_ct,ict,"ae","CT")   
	get_players(players_t,ite,"ae","TERRORIST")   

	if (ict==1&&ite==1)
	{
		new name1[32], name2[32]
		get_user_name(players_ct[0],name1,32)
		get_user_name(players_t[0],name2,32)
		set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)

		if (lmmode_bit & 1)
		{
			if (lmmode_bit & 2)
			{
				show_hudmessage(0,"%s (%i hp) vs. %s (%i hp)",name1,get_user_health(players_ct[0]),name2,get_user_health(players_t[0]))
			}

			else
			{
				show_hudmessage(0,"%s vs. %s",name1,name2)
			}

			if (lmmode_bit & 4)
			{
				//new r
				//r = random_num(0,lstsounds-1)
				new iSounds = random(lastmansounds); 
				client_cmd(0,"spk ^"%s^"",lastmanlist[iSounds])
			}
		}
	} 
	else
{   
	if (ict==1&&ite>1&&alone_ann==0&&(lmmode_bit & 4))
	{
		last=players_ct[0]
		client_cmd(last,"spk misc/oneandonly")

	}

	else if (ite==1&&ict>1&&alone_ann==0&&(lmmode_bit & 4))
	{
		last=players_t[0]
		client_cmd(last,"spk misc/oneandonly")
	}

	else
	{
		return PLUGIN_CONTINUE
	}
	alone_ann = last
	new name[32]   
	get_user_name(last,name,32)

	if (lmmode_bit & 1)
	{
		set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)

		if (lmmode_bit & 2)
		{
			show_hudmessage(0,messageshp[ random_num(0,MESSAGESHP-1) ],ite ,ict ,name,get_user_health(last))
		}

		else
		{
			show_hudmessage(0,messagesnohp[ random_num(0,MESSAGESNOHP-1) ],ite ,ict ,name )
		}
	}

}
	return PLUGIN_CONTINUE   
}

public plugin_precache()
{
	precache_sound("CSDsounds/lastman/lastman1.wav")
	precache_sound("CSDsounds/lastman/lastman2.wav")
	precache_sound("CSDsounds/lastman/lastman3.wav")
	precache_sound("CSDsounds/lastman/lastman4.wav")
	precache_sound("CSDsounds/lastman/lastman5.wav")
	precache_sound("CSDsounds/lastman/lastman6.wav")
	precache_sound("CSDsounds/lastman/lastman7.wav")
	precache_sound("CSDsounds/lastman/lastman8.wav")
	precache_sound("CSDsounds/lastman/lastman9.wav")
	precache_sound("CSDsounds/lastman/lastman10.wav")
	
	return PLUGIN_CONTINUE 
}



public plugin_init()
{
	register_plugin("Last Man Sounds","1.0","Copper")
	register_event("ResetHUD", "reset_hud", "b");
	register_event("DeathMsg", "death_event", "a", "1>0");
	register_event("SendAudio","roundend_msg","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
	register_event("TextMsg","roundend_msg","a","2&#Game_C","2&#Game_w")
	register_event("DeathMsg","death_msg","a")
	register_cvar("lastman_mode","c")
	
	return PLUGIN_CONTINUE
}
Can anyone tell me what I did wrong, I am trying to edit the ultimate sounds but be able to play more than 1 sound but for some reason the other sounds arent working. Thank You!
Copper is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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