I can't add sound

Въпроси и проблеми свързани с AMXModX.
Аватар
gadinkata
Извън линия
Потребител
Потребител
Мнения: 259
Регистриран на: 21 Мар 2018, 12:33
Местоположение: Враца
Се отблагодари: 25 пъти
Получена благодарност: 7 пъти
Обратна връзка:

I can't add sound

Мнение от gadinkata » 19 Авг 2020, 01:30

I added a sound in the last round of the bonus

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>

#define PREFIX "!y[!tHERO!y]"
#define NEADED_FRAGS 20
#define HERO_ROUNDS 3

#define HERO_HEALTH 130
#define HERO_SPEED 1500

new const g_szHeroFlag[] = "b";


new g_NextRoundHero[33]
new g_Frags[33]

public plugin_init() {
	register_plugin("Hero mode", "1.0", "Ds")
	register_clcmd("say /hero", "hero_command")
	register_clcmd("say_team /hero", "hero_command")

	register_clcmd("say /rs", "reset_frags")
	register_clcmd("say_team /rs", "reset_frags")

	RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled_Post", 1)
}

public client_putinserver(iPlayer) {
	g_NextRoundHero[iPlayer] = 0
	g_Frags[iPlayer] = 0
}

public reset_frags(iPlayer) {
	g_Frags[iPlayer] = 0
}

public hero_command(iPlayer) {
	if (g_Frags[iPlayer] >= NEADED_FRAGS) {
	        client_cmd(iPlayer,"spk buttons/blip2")
		ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		g_Frags[iPlayer] -= NEADED_FRAGS
		g_NextRoundHero[iPlayer] = HERO_ROUNDS
	}
	else {
		client_cmd(iPlayer,"spk buttons/blip1")
		ChatColor(iPlayer, "%s !yYou have %d frags, you need 20 frags to activate!", PREFIX, NEADED_FRAGS - g_Frags[iPlayer])
	}
}

public Ham_PlayerKilled_Post(iVictim, iAttacker)
{
	if (is_user_connected(iVictim) && is_user_connected(iAttacker)) {
		g_Frags[iAttacker] += 1
	}
}

public Ham_Spawn_Post(iPlayer) {
	if (g_NextRoundHero[iPlayer] > 0) {
		set_user_flags(iPlayer, read_flags(g_szHeroFlag));

		set_pev(iPlayer, pev_health, float(HERO_HEALTH))
		
		switch (cs_get_user_team(iPlayer))
		{
			case CS_TEAM_CT:fm_set_rendering(iPlayer, kRenderFxGlowShell, random_num(0, 100), random_num(50, 180), 255, kRenderNormal, 15)
			case CS_TEAM_T: fm_set_rendering(iPlayer, kRenderFxGlowShell, 255, random_num(0, 150), random_num(0, 200), kRenderNormal, 15)
		}
		
		g_NextRoundHero[iPlayer] -= 1
		
		if(g_NextRoundHero[iPlayer] == 0)
		{
			client_cmd(iPlayer,"spk buttons/blip1")
			ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		}
	}
	else {
		// Remove glow
		remove_user_flags(iPlayer, read_flags(g_szHeroFlag));
    	        fm_set_rendering(iPlayer)
	}
}

public plugin_precache()
{
precache_sound( "buttons/blip1.wav" );
precache_sound( "buttons/blip2.wav" );
}

stock ChatColor(const id, const input[], any:...) {
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!t", "^3") // Team Color

	if (id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if (is_user_connected(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
				write_byte(players[i])
				write_string(msg)
				message_end()
			}
		}
	}
}

Код за потвърждение: Избери целия код

		if(g_NextRoundHero[iPlayer] == 0)
		{
			client_cmd(iPlayer,"spk buttons/blip1")
			ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		}
I give up if that's not what you want! Try google transle .. bulgarian

Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

I can't add sound

Мнение от USA_CA » 19 Авг 2020, 10:16

gadinkata написа: 19 Авг 2020, 01:30 I added a sound in the last round of the bonus

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>

#define PREFIX "!y[!tHERO!y]"
#define NEADED_FRAGS 20
#define HERO_ROUNDS 3

#define HERO_HEALTH 130
#define HERO_SPEED 1500

new const g_szHeroFlag[] = "b";


new g_NextRoundHero[33]
new g_Frags[33]

public plugin_init() {
	register_plugin("Hero mode", "1.0", "Ds")
	register_clcmd("say /hero", "hero_command")
	register_clcmd("say_team /hero", "hero_command")

	register_clcmd("say /rs", "reset_frags")
	register_clcmd("say_team /rs", "reset_frags")

	RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled_Post", 1)
}

public client_putinserver(iPlayer) {
	g_NextRoundHero[iPlayer] = 0
	g_Frags[iPlayer] = 0
}

public reset_frags(iPlayer) {
	g_Frags[iPlayer] = 0
}

public hero_command(iPlayer) {
	if (g_Frags[iPlayer] >= NEADED_FRAGS) {
	        client_cmd(iPlayer,"spk buttons/blip2")
		ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		g_Frags[iPlayer] -= NEADED_FRAGS
		g_NextRoundHero[iPlayer] = HERO_ROUNDS
	}
	else {
		client_cmd(iPlayer,"spk buttons/blip1")
		ChatColor(iPlayer, "%s !yYou have %d frags, you need 20 frags to activate!", PREFIX, NEADED_FRAGS - g_Frags[iPlayer])
	}
}

public Ham_PlayerKilled_Post(iVictim, iAttacker)
{
	if (is_user_connected(iVictim) && is_user_connected(iAttacker)) {
		g_Frags[iAttacker] += 1
	}
}

public Ham_Spawn_Post(iPlayer) {
	if (g_NextRoundHero[iPlayer] > 0) {
		set_user_flags(iPlayer, read_flags(g_szHeroFlag));

		set_pev(iPlayer, pev_health, float(HERO_HEALTH))
		
		switch (cs_get_user_team(iPlayer))
		{
			case CS_TEAM_CT:fm_set_rendering(iPlayer, kRenderFxGlowShell, random_num(0, 100), random_num(50, 180), 255, kRenderNormal, 15)
			case CS_TEAM_T: fm_set_rendering(iPlayer, kRenderFxGlowShell, 255, random_num(0, 150), random_num(0, 200), kRenderNormal, 15)
		}
		
		g_NextRoundHero[iPlayer] -= 1
		
		if(g_NextRoundHero[iPlayer] == 0)
		{
			client_cmd(iPlayer,"spk buttons/blip1")
			ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		}
	}
	else {
		// Remove glow
		remove_user_flags(iPlayer, read_flags(g_szHeroFlag));
    	        fm_set_rendering(iPlayer)
	}
}

public plugin_precache()
{
precache_sound( "buttons/blip1.wav" );
precache_sound( "buttons/blip2.wav" );
}

stock ChatColor(const id, const input[], any:...) {
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!t", "^3") // Team Color

	if (id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if (is_user_connected(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
				write_byte(players[i])
				write_string(msg)
				message_end()
			}
		}
	}
}

Код за потвърждение: Избери целия код

		if(g_NextRoundHero[iPlayer] == 0)
		{
			client_cmd(iPlayer,"spk buttons/blip1")
			ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		}
I give up if that's not what you want! Try google transle .. bulgarian
трябва, когато свърши вече

Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

I can't add sound

Мнение от USA_CA » 19 Авг 2020, 11:09

I did this f(g_NextRoundHero[iPlayer] == 2) when the player is given
but how do I do it when it's taken away

how else to do that if you were given bonuses for 3 spawns the player did not count frags in these 3 spawns but only at the end of bonuses? and the player again at the end immediately writes /hero

Аватар
gadinkata
Извън линия
Потребител
Потребител
Мнения: 259
Регистриран на: 21 Мар 2018, 12:33
Местоположение: Враца
Се отблагодари: 25 пъти
Получена благодарност: 7 пъти
Обратна връзка:

I can't add sound

Мнение от gadinkata » 19 Авг 2020, 15:32

give the code you wrote, I gave you the code at the end of the last round

Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

I can't add sound

Мнение от USA_CA » 19 Авг 2020, 15:44

gadinkata написа: 19 Авг 2020, 15:32 give the code you wrote, I gave you the code at the end of the last round
I made a message when receiving bonuses, and now I need when they end, for example: a new spawn at the end and a message to me that the bonuses are over

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>

#define PREFIX "!y[!tHERO!y]"
#define NEADED_FRAGS 1
#define HERO_ROUNDS 3

#define HERO_HEALTH 130
#define HERO_SPEED 1500

new const g_szHeroFlag[] = "b";


new g_NextRoundHero[33]
new g_Frags[33]

public plugin_init() {
	register_plugin("Hero mode", "1.0", "Dorus")
	register_clcmd("say /hero", "hero_command")
	register_clcmd("say_team /hero", "hero_command")

	register_clcmd("say /rs", "reset_frags")
	register_clcmd("say_team /rs", "reset_frags")

	RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled_Post", 1)
}

public client_putinserver(iPlayer) {
	g_NextRoundHero[iPlayer] = 0
	g_Frags[iPlayer] = 0
}

public reset_frags(iPlayer) {
	g_Frags[iPlayer] = 0
}

public hero_command(iPlayer) {
	if (g_Frags[iPlayer] >= NEADED_FRAGS) {
	        client_cmd(iPlayer,"spk buttons/blip2")
		ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		g_Frags[iPlayer] -= NEADED_FRAGS
		g_NextRoundHero[iPlayer] = HERO_ROUNDS
	}
	else {
	        client_cmd(iPlayer,"spk buttons/blip1")
		ChatColor(iPlayer, "%s !yYou have %d frags, you need 20 frags to activate!", PREFIX, NEADED_FRAGS - g_Frags[iPlayer])
	}
}

public Ham_PlayerKilled_Post(iVictim, iAttacker)
{
	if (is_user_connected(iVictim) && is_user_connected(iAttacker)) {
		g_Frags[iAttacker] += 1
	}
}

public Ham_Spawn_Post(iPlayer) {
	if (g_NextRoundHero[iPlayer] > 0) {
		set_user_flags(iPlayer, read_flags(g_szHeroFlag));

		set_pev(iPlayer, pev_health, float(HERO_HEALTH))
		
		switch (cs_get_user_team(iPlayer))
		{
			case CS_TEAM_CT:fm_set_rendering(iPlayer, kRenderFxGlowShell, random_num(0, 100), random_num(50, 180), 255, kRenderNormal, 15)
			case CS_TEAM_T: fm_set_rendering(iPlayer, kRenderFxGlowShell, 255, random_num(0, 150), random_num(0, 200), kRenderNormal, 15)
		}

		g_NextRoundHero[iPlayer] -= 1
		
		new name[33]
        get_user_name(iPlayer, name, 32)
		if(g_NextRoundHero[iPlayer] == 2)
		{
			client_cmd(0,"spk buttons/blip2")
			ChatColor(0, "%s !yplayer !t%s !ybecame !ga hero!", PREFIX, name)
		}
	}
	else {
		// Remove glow
		remove_user_flags(iPlayer, read_flags(g_szHeroFlag));
    	        fm_set_rendering(iPlayer)
	}
}

public plugin_precache()
{
precache_sound( "buttons/blip1.wav" );
precache_sound( "buttons/blip2.wav" );
}

stock ChatColor(const id, const input[], any:...) {
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!t", "^3") // Team Color

	if (id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if (is_user_connected(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
				write_byte(players[i])
				write_string(msg)
				message_end()
			}
		}
	}
}

Аватар
gadinkata
Извън линия
Потребител
Потребител
Мнения: 259
Регистриран на: 21 Мар 2018, 12:33
Местоположение: Враца
Се отблагодари: 25 пъти
Получена благодарност: 7 пъти
Обратна връзка:

I can't add sound

Мнение от gadinkata » 19 Авг 2020, 21:23

Sound and message at the beginning of the bonus.
Sound and message at the end of the last bonus.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>

#define PREFIX "!y[!tHERO!y]"
#define NEADED_FRAGS 1
#define HERO_ROUNDS 3

#define HERO_HEALTH 130
#define HERO_SPEED 1500

new const g_szHeroFlag[] = "b";


new g_NextRoundHero[33]
new g_Frags[33]

public plugin_init() {
	register_plugin("Hero mode", "1.0", "Dorus")
	register_clcmd("say /hero", "hero_command")
	register_clcmd("say_team /hero", "hero_command")

	register_clcmd("say /rs", "reset_frags")
	register_clcmd("say_team /rs", "reset_frags")

	RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled_Post", 1)
}

public client_putinserver(iPlayer) {
	g_NextRoundHero[iPlayer] = 0
	g_Frags[iPlayer] = 0
}

public reset_frags(iPlayer) {
	g_Frags[iPlayer] = 0
}

public hero_command(iPlayer) {
	if (g_Frags[iPlayer] >= NEADED_FRAGS) {
	        client_cmd(iPlayer,"spk buttons/blip2")
		ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)

		g_Frags[iPlayer] -= NEADED_FRAGS
		g_NextRoundHero[iPlayer] = HERO_ROUNDS
	}
	else {
	        client_cmd(iPlayer,"spk buttons/blip1")
		ChatColor(iPlayer, "%s !yYou have %d frags, you need 20 frags to activate!", PREFIX, NEADED_FRAGS - g_Frags[iPlayer])
	}
}

public Ham_PlayerKilled_Post(iVictim, iAttacker)
{
	if (is_user_connected(iVictim) && is_user_connected(iAttacker)) {
		g_Frags[iAttacker] += 1
	}
}

public Ham_Spawn_Post(iPlayer) {
	if (g_NextRoundHero[iPlayer] > 0) {
		set_user_flags(iPlayer, read_flags(g_szHeroFlag));

		set_pev(iPlayer, pev_health, float(HERO_HEALTH))
		
		switch (cs_get_user_team(iPlayer))
		{
			case CS_TEAM_CT:fm_set_rendering(iPlayer, kRenderFxGlowShell, random_num(0, 100), random_num(50, 180), 255, kRenderNormal, 15)
			case CS_TEAM_T: fm_set_rendering(iPlayer, kRenderFxGlowShell, 255, random_num(0, 150), random_num(0, 200), kRenderNormal, 15)
		}
		
		new name[33]
		get_user_name(iPlayer, name, 32)
		if(g_NextRoundHero[iPlayer] == 3)
		{
			client_cmd(0,"spk buttons/blip2")
			ChatColor(0, "%s !yplayer !t%s !ybecame !ga hero!", PREFIX, name)
		}
		
		g_NextRoundHero[iPlayer] -= 1
		if(g_NextRoundHero[iPlayer] == 0)
		{
			client_cmd(iPlayer,"spk buttons/blip2")
			ChatColor(iPlayer, "%s !yplayer !t%s !ylast-bonus-round !ga hero!", PREFIX, name)
		}
	}
	else {
		// Remove glow
		remove_user_flags(iPlayer, read_flags(g_szHeroFlag));
    	        fm_set_rendering(iPlayer)
	}
}

public plugin_precache()
{
precache_sound( "buttons/blip1.wav" );
precache_sound( "buttons/blip2.wav" );
}

stock ChatColor(const id, const input[], any:...) {
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!t", "^3") // Team Color

	if (id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if (is_user_connected(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
				write_byte(players[i])
				write_string(msg)
				message_end()
			}
		}
	}
}


Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

I can't add sound

Мнение от USA_CA » 19 Авг 2020, 21:34

Thank you friend

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Поддръжка / Помощ”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 7 госта