I can't add sound

Въпроси и проблеми свързани с AMXModX.
Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

I can't add sound

Мнение от USA_CA » 18 Авг 2020, 19:04

Hello everyone) I can't add sound to the plugin, I did so but when compiling an error, when I put "0" there are no errors and when I put "id" there is an error, how can I fix it? since I want " id"

error

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

error 017: undefined symbol "id" 
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messag
added so

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

client_cmd(id,"spk buttons/blip2")

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

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

I can't add sound

Мнение от atmax » 18 Авг 2020, 19:09

🙄 Give the full code not just a part of it..
If this sound is for everyone you can use a loop.
Rest in peace my friend I always will remember you! 🖤👊

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

I can't add sound

Мнение от USA_CA » 18 Авг 2020, 19:41

atmax написа: 18 Авг 2020, 19:09 🙄 Give the full code not just a part of it..
If this sound is for everyone you can use a loop.
made, added "iPlayer"
this plugin, when a player gains 20 frags, they can write /hero and get bonuses for 3 spawns
can you do me that when the player was given bonuses, everyone in the chat wrote a message, and when the bonuses were removed, it also wrote a message

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

#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
	}
	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()
			}
		}
	}
}

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

I can't add sound

Мнение от atmax » 18 Авг 2020, 19:53

I can't understand you want a message for everyone when someone receives those gifts?
Rest in peace my friend I always will remember you! 🖤👊

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

I can't add sound

Мнение от USA_CA » 18 Авг 2020, 20:21

atmax написа: 18 Авг 2020, 19:53 I can't understand you want a message for everyone when someone receives those gifts?
Yes, and when did it end

Аватар
JackEyedJones
Извън линия
Потребител
Потребител
Мнения: 399
Регистриран на: 10 Сеп 2018, 17:26
Местоположение: Plovdiv, Bulgaria, Europe, Entire World
Се отблагодари: 4 пъти
Получена благодарност: 69 пъти
Обратна връзка:

I can't add sound

Мнение от JackEyedJones » 18 Авг 2020, 21:09

If you want those around the player to hear the sound, emit_sound is the function.
client_cmd speak will be played only to the player and noone around will here it.

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

I can't add sound

Мнение от USA_CA » 18 Авг 2020, 21:12

JackEyedJones написа: 18 Авг 2020, 21:09 If you want those around the player to hear the sound, emit_sound is the function.
client_cmd speak will be played only to the player and noone around will here it.
client_cmd(iPlayer,
------------->
client_cmd(0,

Аватар
JackEyedJones
Извън линия
Потребител
Потребител
Мнения: 399
Регистриран на: 10 Сеп 2018, 17:26
Местоположение: Plovdiv, Bulgaria, Europe, Entire World
Се отблагодари: 4 пъти
Получена благодарност: 69 пъти
Обратна връзка:

I can't add sound

Мнение от JackEyedJones » 18 Авг 2020, 21:16

With (0 condition every player on the map, no matter the distance with the player will hear it. Even those in the other team. Which will make spam with the sound. As i understood you want only those around to hear the sound.

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

I can't add sound

Мнение от USA_CA » 18 Авг 2020, 21:26

JackEyedJones написа: 18 Авг 2020, 21:16 With (0 condition every player on the map, no matter the distance with the player will hear it. Even those in the other team. Which will make spam with the sound. As i understood you want only those around to hear the sound.
no I just need to add more sound when the bonus is received and the bonus expires

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

I can't add sound

Мнение от atmax » 18 Авг 2020, 21:28

You want that sound for everyone or for the player that received the gifts?..
Rest in peace my friend I always will remember you! 🖤👊

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

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

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 13 госта