Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Jak wylaczyc ten dzwiek.


  • Zamknięty Temat jest zamknięty
16 odpowiedzi w tym temacie

#1 cyber2hot

    Pomocny

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:58
Offline

Napisano 15.09.2008 15:51

Chcialbym wylaczyc ten dzwiek, zaleznie z ktora stron zwyciezy - Terrorist Win, CT Win. Mam krotkie dzwieki z roundsound.amxx i sa zagluszane przez te wlasnie beznadziejne T Win, Ct Win. Jakas komenda? Bardzo proszę.
  • +
  • -
  • 0

#2 Gość__*

  • Gość

Reputacja: 0

Offline

Napisano 15.09.2008 15:54

Chcialbym wylaczyc ten dzwiek, zaleznie z ktora stron zwyciezy - Terrorist Win, CT Win. Mam krotkie dzwieki z roundsound.amxx i sa zagluszane przez te wlasnie beznadziejne T Win, Ct Win. Jakas komenda? Bardzo proszę.

Wejdź w pulugins.ini i dodaj średnik do
miscstats.amxx


#3 cyber2hot

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 0
zer0.

  • Postów:58
Offline

Napisano 15.09.2008 16:04

mam to (standardowo wylaczone) i dzwieki terro win, ct win nadal sie pojawiaja :/
  • +
  • -
  • 0

#4 choyrack

    Wszechpomocny

  • Użytkownik

Reputacja: 64
Pomocny

  • Postów:369
  • GG:
  • Lokalizacja:Wrocław
Offline

Napisano 16.09.2008 10:10

A te dźwięki to nie są standardowe w CSie :?:
  • +
  • -
  • 0

#5 darkman

    Wszechwiedzący

  • Przyjaciel

Reputacja: 85
Zaawansowany

  • Postów:553
  • Lokalizacja:inactive
Offline

Napisano 17.09.2008 14:28

wiem o co ci chodzi, podaj sma pluginu.
  • +
  • -
  • 0

#6 pawlik

    Wszechwiedzący

  • Użytkownik

Reputacja: 86
Zaawansowany

  • Postów:579
  • Steam:steam
  • Lokalizacja:Podkarpacie
Offline

Napisano 24.09.2008 17:33

też proszę o pomoc w tej sprawie
moje .sma pluginu miscstats:

/* AMX Mod X
*   Misc. Stats Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation, 
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve, 
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>
#include <csx>
#include <cstrike>

public MultiKill
public MultiKillSound
public BombPlanting
public BombDefusing
public BombPlanted
public BombDefused
public BombFailed
public BombPickUp
public BombDrop
public BombCountVoice
public BombCountDef
public BombReached
public ItalyBonusKill
public EnemyRemaining
public LastMan
public KnifeKill
public KnifeKillSound
public GrenadeKill
public GrenadeSuicide
public HeadShotKill
public HeadShotKillSound
public RoundCounterSound
public RoundCounter
public KillingStreak
public KillingStreakSound
public DoubleKill
public DoubleKillSound
public PlayerName
public FirstBloodSound

new g_streakKills[33][2]
new g_multiKills[33][2]
new g_C4Timer
new g_Defusing
new g_Planter 
new Float:g_LastOmg
new g_LastAnnounce
new g_roundCount
new Float:g_doubleKill
new g_doubleKillId
new g_friend[33]
new g_firstBlood
new g_center1_sync
new g_announce_sync
new g_status_sync
new g_left_sync
new g_bottom_sync
new g_he_sync

new g_MultiKillMsg[7][] =
{
	"Multi-Kill! %s^n%L %d %L (%d %L)", 
	"Ultra-Kill!!! %s^n%L %d %L (%d %L)", 
	"%s IS ON A KILLING SPREE!!!^n%L %d %L (%d %L)", 
	"RAMPAGE!!! %s^n%L %d %L (%d hs)", 
	"%s IS UNSTOPPABLE!!!^n%L %d %L (%d %L)", 
	"%s IS A MONSTER!^n%L %d %L (%d %L)", 
	"%s IS GODLIKE!!!!^n%L %d %L (%d %L)"
}

new g_Sounds[7][] =
{
	"multikill", 
	"ultrakill", 
	"killingspree", 
	"rampage", 
	"unstoppable", 
	"monsterkill", 
	"godlike"
}
new g_KillingMsg[7][] =
{
	"%s: Multi-Kill!", 
	"%s: Ultra-Kill!!!", 
	"%s IS ON A KILLING SPREE!!!", 
	"%s: RAMPAGE!!!", 
	"%s IS UNSTOPPABLE!!!", 
	"%s IS A MONSTER!", 
	"%s IS GODLIKE!!!"
}

new g_KinfeMsg[4][] =
{
	"KNIFE_MSG_1", 
	"KNIFE_MSG_2", 
	"KNIFE_MSG_3", 
	"KNIFE_MSG_4"
}

new g_LastMessages[4][] =
{
	"LAST_MSG_1", 
	"LAST_MSG_2", 
	"LAST_MSG_3", 
	"LAST_MSG_4"
}

new g_HeMessages[4][] =
{
	"HE_MSG_1", 
	"HE_MSG_2", 
	"HE_MSG_3", 
	"HE_MSG_4"
}

new g_SHeMessages[4][] =
{
	"SHE_MSG_1", 
	"SHE_MSG_2", 
	"SHE_MSG_3", 
	"SHE_MSG_4"
}

new g_HeadShots[7][] =
{
	"HS_MSG_1", 
	"HS_MSG_2", 
	"HS_MSG_3", 
	"HS_MSG_4", 
	"HS_MSG_5", 
	"HS_MSG_6", 
	"HS_MSG_7"
}

new g_teamsNames[4][] =
{
	"TERRORIST", 
	"CT", 
	"TERRORISTS", 
	"CTS"
}

public plugin_init()
{
	register_plugin("CS Misc. Stats", AMXX_VERSION_STR, "AMXX Dev Team")
	register_dictionary("miscstats.txt")
	register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w")
	register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
	register_event("RoundTime", "eNewRound", "bc")
	register_event("StatusValue", "setTeam", "be", "1=1")
	register_event("StatusValue", "showStatus", "be", "1=2", "2!0")
	register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")

	new mapname[32]
	get_mapname(mapname, 31)

	if (equali(mapname, "de_", 3) || equali(mapname, "csde_", 5))
	{
		register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4")
		register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb")
		register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d")
	}
	else if (equali(mapname, "cs_italy"))
	{
		register_event("23", "chickenKill", "a", "1=108", /*"12=106", */ "15=4")
		register_event("23", "radioKill", "a", "1=108", /*"12=294", */ "15=2")
	}
	
	g_center1_sync = CreateHudSyncObj()
	g_announce_sync = CreateHudSyncObj()
	g_status_sync = CreateHudSyncObj()
	g_left_sync = CreateHudSyncObj()
	g_bottom_sync = CreateHudSyncObj()
	g_he_sync = CreateHudSyncObj()
}

public plugin_cfg()
{
	new g_addStast[] = "amx_statscfg add ^"%s^" %s"
	
	server_cmd(g_addStast, "ST_MULTI_KILL", "MultiKill")
	server_cmd(g_addStast, "ST_MULTI_KILL_SOUND", "MultiKillSound")
	server_cmd(g_addStast, "ST_BOMB_PLANTING", "BombPlanting")
	server_cmd(g_addStast, "ST_BOMB_DEFUSING", "BombDefusing")
	server_cmd(g_addStast, "ST_BOMB_PLANTED", "BombPlanted")
	server_cmd(g_addStast, "ST_BOMB_DEF_SUCC", "BombDefused")
	server_cmd(g_addStast, "ST_BOMB_DEF_FAIL", "BombFailed")
	server_cmd(g_addStast, "ST_BOMB_PICKUP", "BombPickUp")
	server_cmd(g_addStast, "ST_BOMB_DROP", "BombDrop")
	server_cmd(g_addStast, "ST_BOMB_CD_VOICE", "BombCountVoice")
	server_cmd(g_addStast, "ST_BOMB_CD_DEF", "BombCountDef")
	server_cmd(g_addStast, "ST_BOMB_SITE", "BombReached")
	server_cmd(g_addStast, "ST_ITALY_BONUS", "ItalyBonusKill")
	server_cmd(g_addStast, "ST_LAST_MAN", "LastMan")
	server_cmd(g_addStast, "ST_KNIFE_KILL", "KnifeKill")
	server_cmd(g_addStast, "ST_KNIFE_KILL_SOUND", "KnifeKillSound")
	server_cmd(g_addStast, "ST_HE_KILL", "GrenadeKill")
	server_cmd(g_addStast, "ST_HE_SUICIDE", "GrenadeSuicide")
	server_cmd(g_addStast, "ST_HS_KILL", "HeadShotKill")
	server_cmd(g_addStast, "ST_HS_KILL_SOUND", "HeadShotKillSound")
	server_cmd(g_addStast, "ST_ROUND_CNT", "RoundCounter")
	server_cmd(g_addStast, "ST_ROUND_CNT_SOUND", "RoundCounterSound")
	server_cmd(g_addStast, "ST_KILL_STR", "KillingStreak")
	server_cmd(g_addStast, "ST_KILL_STR_SOUND", "KillingStreakSound")
	server_cmd(g_addStast, "ST_ENEMY_REM", "EnemyRemaining")
	server_cmd(g_addStast, "ST_DOUBLE_KILL", "DoubleKill")
	server_cmd(g_addStast, "ST_DOUBLE_KILL_SOUND", "DoubleKillSound")
	server_cmd(g_addStast, "ST_PLAYER_NAME", "PlayerName")
	server_cmd(g_addStast, "ST_FIRST_BLOOD_SOUND", "FirstBloodSound")
}

public client_putinserver(id)
{
	g_multiKills[id] = {0, 0}
	g_streakKills[id] = {0, 0}
}

public client_death(killer, victim, wpnindex, hitplace, TK)
{
	if (wpnindex == CSW_C4)
		return

	new headshot = (hitplace == HIT_HEAD) ? 1 : 0
	new selfkill = (killer == victim) ? 1 : 0

	if (g_firstBlood)
	{
		g_firstBlood = 0
		if (FirstBloodSound)
			play_sound("misc/firstblood")
	}

	if ((KillingStreak || KillingStreakSound) && !TK)
	{
		g_streakKills[victim][1]++
		g_streakKills[victim][0] = 0

		if (!selfkill)
		{
			g_streakKills[killer][0]++
			g_streakKills[killer][1] = 0
			
			new a = g_streakKills[killer][0] - 3

			if ((a > -1) && !(a % 2))
			{
				new name[32]
				get_user_name(killer, name, 31)
				
				if ((a >>= 1) > 6)
					a = 6
				
				if (KillingStreak)
				{
					set_hudmessage(0, 100, 255, 0.05, 0.50, 2, 0.02, 6.0, 0.01, 0.1, -1)
					ShowSyncHudMsg(0, g_left_sync, g_KillingMsg[a], name)
				}
				
				if (KillingStreakSound)
				{
					new file[32]
					
					format(file, 31, "misc/%s", g_Sounds[a])
					play_sound(file)
				}
			}
		}
	}

	if (MultiKill || MultiKillSound)
	{
		if (!selfkill && !TK && killer)
		{
			g_multiKills[killer][0]++ 
			g_multiKills[killer][1] += headshot
			
			new param[2]
			
			param[0] = killer
			param[1] = g_multiKills[killer][0]
			set_task(4.0 + float(param[1]), "checkKills", 0, param, 2)
		}
	}

	if (EnemyRemaining && is_user_connected(victim))
	{
		new ppl[32], pplnum = 0, maxplayers = get_maxplayers()
		new epplnum = 0
		new CsTeams:team = cs_get_user_team(victim)
		new CsTeams:other_team
		new CsTeams:enemy_team = (team == CS_TEAM_T) ? CS_TEAM_CT : CS_TEAM_T
		
		if (team == CS_TEAM_T || team == CS_TEAM_CT)
		{
			for (new i=1; i<=maxplayers; i++)
			{
				if (!is_user_connected(i))
				{
					continue
				}
				if (i == victim)
				{
					continue
				}
				other_team = cs_get_user_team(i)
				if (other_team == team && is_user_alive(i))
				{
					epplnum++
				} else if (other_team == enemy_team) {
					ppl[pplnum++] = i
				}
			}
			
			if (pplnum && epplnum)
			{
				new message[128], team_name[32]

				set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, -1)
				
				/* This is a pretty stupid thing to translate, but whatever */
				new _teamname[32]
				if (team == CS_TEAM_T)
				{
					format(_teamname, 31, "TERRORIST%s", (epplnum == 1) ? "" : "S")
				} else if (team == CS_TEAM_CT) {
					format(_teamname, 31, "CT%s", (epplnum == 1) ? "" : "S")
				}

				for (new a = 0; a < pplnum; ++a)
				{
					format(team_name, 31, "%L", ppl[a], _teamname)
					format(message, 127, "%L", ppl[a], "REMAINING", epplnum, team_name)
					ShowSyncHudMsg(ppl[a], g_bottom_sync, "%s", message)
				}
			}
		}
	}

	if (LastMan)
	{
		new cts[32], ts[32], ctsnum, tsnum
		new maxplayers = get_maxplayers()
		new CsTeams:team
		
		for (new i=1; i<=maxplayers; i++)
		{
			if (!is_user_connected(i) || !is_user_alive(i))
			{
				continue
			}
			team = cs_get_user_team(i)
			if (team == CS_TEAM_T)
			{
				ts[tsnum++] = i
			} else if (team == CS_TEAM_CT) {
				cts[ctsnum++] = i
			}
		}
		
		if (ctsnum == 1 && tsnum == 1)
		{
			new ctname[32], tname[32]
			
			get_user_name(cts[0], ctname, 31)
			get_user_name(ts[0], tname, 31)
			
			set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1)
			ShowSyncHudMsg(0, g_center1_sync, "%s vs. %s", ctname, tname)
			
			play_sound("misc/maytheforce")
		}
		else if (!g_LastAnnounce)
		{
			new oposite = 0, _team = 0
			
			if (ctsnum == 1 && tsnum > 1)
			{
				g_LastAnnounce = cts[0]
				oposite = tsnum
				_team = 0
			}
			else if (tsnum == 1 && ctsnum > 1)
			{
				g_LastAnnounce = ts[0]
				oposite = ctsnum
				_team = 1
			}

			if (g_LastAnnounce)
			{
				new name[32]
				
				get_user_name(g_LastAnnounce, name, 31)
				
				set_hudmessage(0, 255, 255, -1.0, 0.38, 0, 6.0, 6.0, 0.5, 0.15, -1)
				ShowSyncHudMsg(0, g_center1_sync, "%s (%d HP) vs. %d %s%s: %L", name, get_user_health(g_LastAnnounce), oposite, g_teamsNames[_team], (oposite == 1) ? "" : "S", LANG_PLAYER, g_LastMessages[random_num(0, 3)])
				
				if (!is_user_connecting(g_LastAnnounce))
				{
					client_cmd(g_LastAnnounce, "spk misc/oneandonly")
				}
			}
		}
	}

	if (wpnindex == CSW_KNIFE && (KnifeKill || KnifeKillSound))
	{
		if (KnifeKill)
		{
			new killer_name[32], victim_name[32]
			
			get_user_name(killer, killer_name, 31)
			get_user_name(victim, victim_name, 31)
			
			set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, -1)
			ShowSyncHudMsg(0, g_he_sync, "%L", LANG_PLAYER, g_KinfeMsg[random_num(0, 3)], killer_name, victim_name)
		}
		
		if (KnifeKillSound)
			play_sound("misc/humiliation")
	}

	if (wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide))
	{
		new killer_name[32], victim_name[32]
		
		get_user_name(killer, killer_name, 31)
		get_user_name(victim, victim_name, 31)
		
		set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, -1)
		
		if (!selfkill)
		{
			if (GrenadeKill)
				ShowSyncHudMsg(0, g_he_sync, "%L", LANG_PLAYER, g_HeMessages[random_num(0, 3)], killer_name, victim_name)
		}
		else if (GrenadeSuicide)
			ShowSyncHudMsg(0, g_he_sync, "%L", LANG_PLAYER, g_SHeMessages[random_num(0, 3)], victim_name)
	}

	if (headshot && (HeadShotKill || HeadShotKillSound))
	{
		if (HeadShotKill && wpnindex)
		{
			new killer_name[32], victim_name[32], weapon_name[32], message[256], players[32], pnum
			
			xmod_get_wpnname(wpnindex, weapon_name, 31)
			get_user_name(killer, killer_name, 31)
			get_user_name(victim, victim_name, 31)
			get_players(players, pnum, "c")
			
			for (new i = 0; i < pnum; i++)
			{
				format(message, sizeof(message)-1, "%L", players[i], g_HeadShots[random_num(0, 6)])
				
				replace(message, sizeof(message)-1, "$vn", victim_name)
				replace(message, sizeof(message)-1, "$wn", weapon_name)
				replace(message, sizeof(message)-1, "$kn", killer_name)
				
				set_hudmessage(100, 100, 255, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1)
				ShowSyncHudMsg(players[i], g_announce_sync, "%s", message)
			}
		}
		
		if (HeadShotKillSound)
		{
			client_cmd(killer, "spk misc/headshot")
			client_cmd(victim, "spk misc/headshot")
		}
	}

	if ((DoubleKill || DoubleKillSound) && !selfkill)
	{
		new Float:nowtime = get_gametime()
		
		if (g_doubleKill == nowtime && g_doubleKillId == killer)
		{
			if (DoubleKill)
			{
				new name[32]
				
				get_user_name(killer, name, 31)
				
				set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1)
				ShowSyncHudMsg(0, g_center1_sync, "%L", LANG_PLAYER, "DOUBLE_KILL", name)
			}
			
			if (DoubleKillSound)
				play_sound("misc/doublekill")
		}
		
		g_doubleKill = nowtime
		g_doubleKillId = killer
	}
}

public hideStatus(id)
{
	if (PlayerName)
	{
		ClearSyncHud(id, g_status_sync)
	}
}

public setTeam(id)
	g_friend[id] = read_data(2)

public showStatus(id)
{
	if(!is_user_bot(id) && is_user_connected(id) && PlayerName) 
	{
		new name[32], pid = read_data(2)
	
		get_user_name(pid, name, 31)
		new color1 = 0, color2 = 0
	
		if (get_user_team(pid) == 1)
			color1 = 255
		else
			color2 = 255
		
		if (g_friend[id] == 1)	// friend
		{
			new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo)
			new wpnname[32]
		
			if (wpnid)
				xmod_get_wpnname(wpnid, wpnname, 31)
		
			set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1)
			ShowSyncHudMsg(id, g_status_sync, "%s -- %d HP / %d AP / %s", name, get_user_health(pid), get_user_armor(pid), wpnname)
		} else {
			set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1)
			ShowSyncHudMsg(id, g_status_sync, "%s", name)
		}
	}
}

public eNewRound()
{
	if (read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor))
	{
		g_firstBlood = 1
		g_C4Timer = 0
		++g_roundCount
		
		if (RoundCounter)
		{
			set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1)
			ShowSyncHudMsg(0, g_announce_sync, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount)
		}
		
		if (RoundCounterSound)
			play_sound("misc/prepare")
		
		if (KillingStreak)
		{
			new appl[32], ppl, i
			get_players(appl, ppl, "ac")
			
			for (new a = 0; a < ppl; ++a)
			{
				i = appl[a]
				
				if (g_streakKills[i][0] >= 2)
					client_print(i, print_chat, "* %L", i, "KILLED_ROW", g_streakKills[i][0])
				else if (g_streakKills[i][1] >= 2)
					client_print(i, print_chat, "* %L", i, "DIED_ROUNDS", g_streakKills[i][1])
			}
		}
	}
}

public eRestart()
{
	eEndRound()
	g_roundCount = 0
	g_firstBlood = 1
}

public eEndRound()
{
	g_C4Timer = -2
	g_LastOmg = 0.0
	remove_task(8038)
	g_LastAnnounce = 0
}

public checkKills(param[])
{
	new id = param[0]
	new a = param[1]
	
	if (a == g_multiKills[id][0])
	{
		a -= 3
		
		if (a > -1)
		{
			if (a > 6)
			{
				a = 6
			}
			
			if (MultiKill)
			{
				new name[32]
				
				get_user_name(id, name, 31)
				set_hudmessage(255, 0, 100, 0.05, 0.50, 2, 0.02, 6.0, 0.01, 0.1, -1)
				
				ShowSyncHudMsg(0, g_left_sync, g_MultiKillMsg[a], name, LANG_PLAYER, "WITH", g_multiKills[id][0], LANG_PLAYER, "KILLS", g_multiKills[id][1], LANG_PLAYER, "HS")
			}
			
			if (MultiKillSound)
			{
				new sound[24]
				format(sound, 23, "misc/%s", g_Sounds[a])
				play_sound(sound)
			}
		}
		g_multiKills[id] = {0, 0}
	}
}

public chickenKill()
{
	if (ItalyBonusKill)
		announceEvent(0, "KILLED_CHICKEN")
}

public radioKill()
{
	if (ItalyBonusKill)
		announceEvent(0, "BLEW_RADIO")
}

announceEvent(id, message[])
{
	new name[32]
	
	get_user_name(id, name, 31)
	set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1)
	ShowSyncHudMsg(0, g_announce_sync, "%L", LANG_PLAYER, message, name)
}

public eBombPickUp(id)
{
	if (BombPickUp)
		announceEvent(id, "PICKED_BOMB")
}

public eBombDrop()
{
	if (BombDrop)
		announceEvent(g_Planter, "DROPPED_BOMB")
}

public eGotBomb(id)
{
	g_Planter = id
	
	if (BombReached && read_data(1) == 2 && g_LastOmg < get_gametime())
	{
		g_LastOmg = get_gametime() + 15.0
		announceEvent(g_Planter, "REACHED_TARGET")
	}
}

public bombTimer()
{
	if (--g_C4Timer > 0)
	{
		if (BombCountVoice)
		{
			if (g_C4Timer == 30 || g_C4Timer == 20)
			{
				new temp[64]
				
				num_to_word(g_C4Timer, temp, 63)
				format(temp, 63, "^"vox/%s seconds until explosion^"", temp)
				play_sound(temp)
			}
			else if (g_C4Timer < 11)
			{
				new temp[64]
				
				num_to_word(g_C4Timer, temp, 63)
				format(temp, 63, "^"vox/%s^"", temp)
				play_sound(temp)
			}
		}
		if (BombCountDef && g_Defusing)
			client_print(g_Defusing, print_center, "%d", g_C4Timer)
	}
	else
		remove_task(8038)
}

public bomb_planted(planter)
{
	g_Defusing = 0
	
	if (BombPlanted)
		announceEvent(planter, "SET_UP_BOMB")
	
	g_C4Timer = get_cvar_num("mp_c4timer")
	set_task(1.0, "bombTimer", 8038, "", 0, "b")
}

public bomb_planting(planter)
{
	if (BombPlanting)
		announceEvent(planter, "PLANT_BOMB")
}

public bomb_defusing(defuser)
{
	if (BombDefusing)
		announceEvent(defuser, "DEFUSING_BOMB")
	
	g_Defusing = defuser
}

public bomb_defused(defuser)
{
	if (BombDefused)
		announceEvent(defuser, "DEFUSED_BOMB")
}

public bomb_explode(planter, defuser)
{
	if (BombFailed && defuser)
		announceEvent(defuser, "FAILED_DEFU")
}

public play_sound(sound[])
{
	new players[32], pnum
	get_players(players, pnum, "c")
	new i
	
	for (i = 0; i < pnum; i++)
	{
		if (is_user_connecting(players[i]))
			continue
		
		client_cmd(players[i], "spk %s", sound)
	}
}

  • +
  • -
  • 0

#7 choyrack

    Wszechpomocny

  • Użytkownik

Reputacja: 64
Pomocny

  • Postów:369
  • GG:
  • Lokalizacja:Wrocław
Offline

Napisano 24.09.2008 19:02

Wywal (lub zakomentuj) tą linijkę:
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")

  • +
  • -
  • 0

#8 darkman

    Wszechwiedzący

  • Przyjaciel

Reputacja: 85
Zaawansowany

  • Postów:553
  • Lokalizacja:inactive
Offline

Napisano 24.09.2008 20:01

#include <amxmodx>

public plugin_init()
{
	register_plugin("winsound stop", "1.0", "darkman")
	register_event("SendAudio", "fwSound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
}

public fwSound(){
	client_cmd(0, "stopsound")
	client_cmd(0, "mp3 stop")
}

Skompilować, wrzucić na serwer. W wypadku kiedy na serwerze RoundSound w funkcjach od eventu SendAudio należy dodać
client_cmd(0, "stopsound")
client_cmd(0, "mp3 stop")


P.S te dźwięki są od początku w grze, więc zakomentowanie tej linijki nic nie da choyrack ;)
  • +
  • -
  • 0

#9 pawlik

    Wszechwiedzący

  • Użytkownik

Reputacja: 86
Zaawansowany

  • Postów:579
  • Steam:steam
  • Lokalizacja:Podkarpacie
Offline

Napisano 25.09.2008 13:28

#include <amxmodx>

public plugin_init()
{
	register_plugin("winsound stop", "1.0", "darkman")
	register_event("SendAudio", "fwSound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
}

public fwSound(){
	client_cmd(0, "stopsound")
	client_cmd(0, "mp3 stop")
}

Skompilować, wrzucić na serwer. W wypadku kiedy na serwerze RoundSound w funkcjach od eventu SendAudio należy dodać
client_cmd(0, "stopsound")
client_cmd(0, "mp3 stop")


P.S te dźwięki są od początku w grze, więc zakomentowanie tej linijki nic nie da choyrack ;)

ale wtedy ni działa mi round sound :help:
  • +
  • -
  • 0

#10 choyrack

    Wszechpomocny

  • Użytkownik

Reputacja: 64
Pomocny

  • Postów:369
  • GG:
  • Lokalizacja:Wrocław
Offline

Napisano 25.09.2008 14:28

Skompilować, wrzucić na serwer. W wypadku kiedy na serwerze RoundSound w funkcjach od eventu SendAudio należy dodać
Kod:
client_cmd(0, "stopsound")
client_cmd(0, "mp3 stop")

Weź te dwie linijki dopisz do sma plugina roundsound, zamiast drugi plugin wrzucać i będzie działał roundsound :-) Jak nie wiesz w które miejsce to wrzuć tu sma roundsounda to Ci ktoś wstawi w dobre :-)
  • +
  • -
  • 0

#11 pawlik

    Wszechwiedzący

  • Użytkownik

Reputacja: 86
Zaawansowany

  • Postów:579
  • Steam:steam
  • Lokalizacja:Podkarpacie
Offline

Napisano 25.09.2008 16:03

alt_end_round_sounds.sma

    /* - - - - - - - - - - -

        AMX Mod X script.
        Copyright (C) 2007 - Arkshine

        Plugin  : 'Alternative End Round Sounds'
        Version :  v2.3b

        Original idea and plugin by PaintLancer.
        Orignal thread : http://forums.alliedmods.net/showthread.php?t=6784
        
        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the
        Free Software Foundation; either version 2 of the License, or (at
        your option) any later version.

        This program is distributed in the hope that it will be useful, but
        WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
        General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software Foundation,
        Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

        In addition, as a special exception, the author gives permission to
        link the code of this program with the Half-Life Game Engine ("HL
        Engine") and Modified Game Libraries ("MODs") developed by Valve,
        L.L.C ("Valve"). You must obey the GNU General Public License in all
        respects for all of the code used other than the HL Engine and MODs
        from Valve. If you modify this file, you may extend this exception
        to your version of the file, but you are not obligated to do so. If
        you do not wish to do so, delete this exception statement from your
        version.

        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
        
        Description :
        - - - - - - -
            Plays random music at the end of a round according to who wins,
            instead of just "Terrorists Win" or "Counter-Terrorists Win".

            
        Features :
        - - - - - -
            * Support for mp3 and wav files
            * Using a file for the sounds
            * Per-map config files supported
            * Per-map prefix config files supported
            * Sounds can be toggle on/off by players
            * Ability to choice x sounds to be precache per map
            * Multilingual support

            
        Requirements :
        - - - - - - - -
            * CS 1.6 / CZ
            * AMX/X 1.7x or higher

            
        Cvars :
        - - - -
            * ers_enabled <iNum
            
                <0|1> Disable/Enable this plugin. 
                (default: 1)
            
            
            * ers_player_toggle <iNum>
            
                <0|1> Disable/Enable the client command /roundsound 
                (default: 1)
                
                
            * erc_time_ads <iTime>
            
                Times in seconds between each ads messages. 0 disable ads. 
                (default: 120)

                
            * erc_random_precache <iMaxTeam or iMax_T-iMax_CT>

                Specify how many sounds by team you want to precache randomly among all sounds.
                This means that x sounds will be choosen randomly among all sounds of each team so to be precache at each map. ( 0 = disable feature )
                
                e.g : erc_random_precache "2"   : 2 sounds will be choosen among all CTs sounds and all Ts sounds
                      erc_random_precache "2-3" : 2 Ts sounds will be choosen randomly among all Ts sounds.
                                                  3 CT sound will be choosen randomly among all CTs sounds.
                                                  /! Don't forget to insert '-' .
                                                  
                /! Map change on cvar change required !

                
        Client command :
        - - - - - - - - 
            * say /roundsound : Give to players the ability to turn on/off the end round sounds

            
        Changelog :
        - - - - - -

            -> Arksine :

             v3.0  - [ 2007-xx-xx ] ( Major update )

                      - Soon. A lot of changes/new features. Huge update. <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/wink.gif' class='bbc_emoticon' alt=';)' />

             v2.3b - [ 2007-11-22 ]
                
                      (!) Fixed a compatibility bug from 2.3a version.
                        
             v2.3a - [ 2007-11-19 ]

                      (+) Added compatibility for Amxx 1.7x.
                      (!) Now 'erc_random_precache' cvar is set to 0 by default.
                      (!) Fixed. At the first start of server, value from 'erc_random_precache' cvar from a config file was not read.
                      (!) Some others minors changes.

             v2.3  - [ 2007-10-29 ]

                      (+) Added 'erc_random_precache' cvar : Specify how many sounds per team you want to precache randomly among all sounds.
                          This means that x sounds will be choosen randomly among all sounds of each team so to be precache at each map. ( request by Arion )
                      (!) Debug mode is enabled by default now.
                      (-) Removed 3 keys languages. No more need.( ERS_LOG_TOTAL_SOUND_LOADED, ERS_LOG_DEBUG_T, ERS_LOG_DEBUG_CT )

             v2.2b - [ 2007-10-28 ]

                      (!) Removed a check. Since trim() is used :
                          Now no need to check space, new line, tabs, carriage returns, etc..

             v2.2a - [ 2007-10-28 ]

                      (!) Changed the method of checking empty file. Now it's more efficient.
                      (!) Added another check to ignore texts which are no comments.
                      (!) Fixed a typo ( key language ).

             v2.2  - [ 2007-10-27 ]

                      (+) Added a check to prevent to get a warning when a team has no sound.
                      (+) Added a check to prevent to not load empty file.
                      (+) Added support for coding-style '//' comments.
                      (!) No longer has a predefined max sounds limit. ( using dynamic array from amxx 1.8.0 )
                      (!) Minors optimizations.
                      (-) Removed useless code.

             v2.1a - [ 2007-07-13 ]

                      (!) Fixed a bug with ML system.
                      (!) Fixed a stupid glitch with formatex().

             v2.1  - [ 2007-07-06 ]

                      (!) Optimize a little.
                      (!) Rewritted loading_file() function.
                      (+) Added ML system & some texts.
                      (+) Added Color in text. ( !g = green ; !t = team color; !n = yellow (normal) )
                      (+) Added #_DEBUG.
                      (+) Added chat command : toggle on/off end round sounds.
                      (+) Added "ers_enabled" cvar : enable/disable plugin
                      (+) Added "ers_player_toggle" cvar : enable/disabled command chat for players
                      (+) Added ads message for chat command
                      (+) Added "erc_time_ads" cvar : control amount of times between 2 messages.

             v2.0b - [ 2007-07-04 ]

                      (!) No features added. Sma reorganized a little and more.

             v2.0a - [ 2007-06-26 ]

                      (!) Fixed. Bug under linux. Some blank lines weren't ignored. (thanks Deejay & NiLuje)

             v2.0  - [ 2007-06-26 ]

                      (!) Totaly rewritted
                      (+) Added support for mp3 files.
                      (+) Added support per file. No more to edit .sma file to add sounds.
                      (+) Added support per-map file.
                      (+) Added support per-map prefix file.

            -> Paintlancer :

             v1.0  :  [ 2004-10-14 ]
                      First release by Paintlancer.
                      Orignal thread : http://forums.alliedmods.net/showthread.php?t=6784

        Credits:
        - - - - - - -
            * PaintLancer : Original idea and plugin.
            * Avalanche   : Inspired color chat function from gungame plugin.
            * Arion       : Random precache idea.
            
            * Languages translation :
                - [fr] : Arkshine
                - [de] : Mordekay
                - [es] : Darkless
        

    - - - - - - - - - - - */

    #include <amxmodx>
    #include <amxmisc>


        new const
    // _________________________________________________

            PLUGIN [] = "Alternative End Round Sounds",
            VERSION[] = "2.3b",
            AUTHOR [] = "Arkshine";
    // _________________________________________________


    #if AMXX_VERSION_NUM < 180
        #define old_amxx
    #endif


    /* ========================= [ "START" AERA FOR CHANGES ] ========================= */


        #define _DEBUG                 // Active debug
        #define MAX_FILE_LENGTH  196   // Max length for files + path.

        #if defined old_amxx
            #define MAX_SOUNDS    25   // Max sounds per team
        #endif

        new const

            g_FileName[]    = "roundsound",     // Name of the main file if no files is found in 'g_FileFolder'.
            g_FileFolder[]  = "round_sound",    // Name of the directory in amxmodx/configs/ for per-map files.
            g_FilePrefix[]  = "ini",            // File extension used for the files.
            g_CmdChat[]     = "/roundsound";    // Chat command for player.


    /* ========================= [ "END" AERA FOR CHANGES ] ========================= */



    // - - - - - - - - - - - - - - - - - - - - - - -

    #define MAX_PLAYERS  32
    #define TASKID_ADS   1333
    #define SIZE_FILE    0
    #define NULL        -1

    new
        bool:g_pHeardSound[ MAX_PLAYERS + 1 ],

        #if !defined old_amxx
            Array:g_lstSoundCT,
            Array:g_lstSoundT,
        #endif

        p_enabled,
        p_player_toggle,
        p_time_ads,
        p_random_precache,

        g_sRp_value[12],
        g_msgSayText;


    enum _:e_Team
    {
        T = 0,
        CT,
    };

    new g_nSnd[ e_Team ];

    #if defined old_amxx
        new g_sTeam_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ];
        #define charsmax(%1)  sizeof( %1 ) - 1
    #endif

    #define _is_wav(%1)  equali( %1[strlen( %1 ) - 4 ], ".wav" )

    // - - - - - - - - - - - - - - - - - - - - - - -


    public plugin_precache()
    {
        register_dictionary( "end_roundsound.txt" );
              
        if( ( p_random_precache = get_cvar_pointer( "erc_random_precache" ) ) )
            get_pcvar_string( p_random_precache, g_sRp_value, charsmax( g_sRp_value ) );

        if( !p_random_precache )
            return;
            
        #if !defined old_amxx
            g_lstSoundCT = ArrayCreate( MAX_FILE_LENGTH );
            g_lstSoundT  = ArrayCreate( MAX_FILE_LENGTH );
        #endif

        loading_file();
    }


    public plugin_init()
    {
        register_plugin( PLUGIN, VERSION, AUTHOR );
        register_cvar( "ers_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );

        register_event( "SendAudio", "eT_win" , "a", "2&%!MRAD_terwin" );
        register_event( "SendAudio", "eCT_win", "a", "2&%!MRAD_ctwin"  );

        p_enabled         = register_cvar( "ers_enabled"        , "1"   );
        p_player_toggle   = register_cvar( "ers_player_toggle"  , "1"   );
        p_time_ads        = register_cvar( "erc_time_ads"       , "120" );

        if( !p_random_precache )
        {
            register_cvar( "erc_random_precache", g_sRp_value );
            server_cmd( "restart" );
        }

        register_clcmd( "say"       , "cmd_Say" );
        register_clcmd( "say_team"  , "cmd_Say" );

        g_msgSayText = get_user_msgid( "SayText" );
    }

 
    public client_authorized( id )
        g_pHeardSound[id] = true;


    public client_disconnect( id )
    {
        g_pHeardSound[id] = true;
        remove_task( id + TASKID_ADS );
    }


    public client_putinserver( id )
    {
        new Float:time = get_pcvar_float( p_time_ads );

        if( !time )
            return;

        remove_task( id + TASKID_ADS );
        set_task( time, "show_ads", id + TASKID_ADS, _, _, "b" );
    }


    public show_ads( taskid )
    {
        new id = taskid - TASKID_ADS;
        ShowPrint( id, "%L", id, "ERS_DISPLAY_ADS", g_CmdChat );
    }


    public cmd_Say( id )
    {
        if( !get_pcvar_num( p_enabled ) )
            return PLUGIN_CONTINUE;

        static sMsg[64];
        read_argv( 1, sMsg, charsmax( sMsg ) );

        if( equali( sMsg, g_CmdChat ) )
        {
            if( !get_pcvar_num( p_player_toggle ) )
            {
                ShowPrint( id, "%L", id, "ERS_CMD_DISABLED" );
                return PLUGIN_HANDLED;
            }

            g_pHeardSound[id] = g_pHeardSound[id] ? false : true;
            ShowPrint( id, "%L", id, g_pHeardSound[id] ? "ERS_SOUND_ENABLED" : "ERS_SOUND_DISABLED" );

            return PLUGIN_HANDLED;
        }

        return PLUGIN_CONTINUE;
    }


    public eT_win()
    {
        if( !g_nSnd[ e_Team:T ] )
            return;

        play_sound( e_Team:T );
    }


    public eCT_win()
    {
        if( !g_nSnd[ e_Team:CT ] )
            return;

        play_sound( e_Team:CT );
    }


    play_sound( iTeam )
    {
        static
    //  - - - - - - - - - - - - - - - -
            sCurSnd[ MAX_FILE_LENGTH ];
    //  - - - - - - - - - - - - - - - -

        new iRand;

        if( g_nSnd[ iTeam ] > 1 )
            iRand = random( g_nSnd[ iTeam ] );

        #if defined old_amxx
            copy( sCurSnd, MAX_FILE_LENGTH - 1, g_sTeam_sounds[ iRand ][ iTeam ] );
        #else
            ArrayGetString( iTeam == CT ? g_lstSoundCT : g_lstSoundT, iRand, sCurSnd, MAX_FILE_LENGTH - 1 );
        #endif

        _is_wav( sCurSnd ) ?

             format( sCurSnd, MAX_FILE_LENGTH - 1, "spk %s", sCurSnd[6] ) :
             format( sCurSnd, MAX_FILE_LENGTH - 1, "mp3 play %s", sCurSnd );

        if( get_pcvar_num( p_player_toggle ) )
        {
            static
        //  - - - - - - - - - - -
                iPlayers[32],
                iNum, pid;
        //  - - - - - - - - - - -

            get_players( iPlayers, iNum, "c" );

            for( new i; i < iNum; i++ )
            {
                pid = iPlayers[i];

                if( !g_pHeardSound[pid] || is_user_bot( pid ) )
                    continue;

                client_cmd( pid, "%s", sCurSnd );
            }
        }
        else
            client_cmd( 0, "%s", sCurSnd );
    }


    get_prefix( sMap[], iLen_map, sMapType[], iLen_type )
    {
        new
    //  - - - - - - - - -
            sRest[32];
    //  - - - - - - - - -

        get_mapname( sMap, iLen_map );
        strtok( sMap, sMapType, iLen_type, sRest, charsmax( sRest ), '_', 1 );
    }


    loading_file()
    {
        static
    //  - - - - - - - - - - - - - - - - -
            sPath[ MAX_FILE_LENGTH ],
    //      |
            sConfigsDir[64],
            sPrefix[6],
            sMap[32];
    //  - - - - - - - - - - - - - - - - -

        get_prefix( sMap, charsmax( sMap ), sPrefix, charsmax( sPrefix ) );
        get_configsdir( sConfigsDir, charsmax( sConfigsDir ) );


        new bool:bFound;

        for( new i = 1; i <= 3; i++ )
        {
            switch( i )
            {
                case 1 : formatex( sPath, charsmax( sPath ), "%s/%s/prefix-%s.%s", sConfigsDir, g_FileFolder, sPrefix, g_FilePrefix );
                case 2 : formatex( sPath, charsmax( sPath ), "%s/%s/%s.%s", sConfigsDir, g_FileFolder, sMap, g_FilePrefix );
                case 3 : formatex( sPath, charsmax( sPath ), "%s/%s.%s", sConfigsDir, g_FileName, g_FilePrefix );

                default : break;
            }

            if( !CheckFile( sPath ) )
                continue;

            bFound = true;
            break;
        }

        log_amx( "---" );

        bFound ?
            log_amx( "%L", LANG_SERVER, "ERS_LOG_LOADING", sPath ) :
            log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_FILES_FOUND" );

        load_sound( sPath );
    }

    
    load_sound( const file[] )
    {
        new
    //  - - - - - - - - - - - - - - -
            sBuffer[256],
    //      |
            sLeft[ MAX_FILE_LENGTH ],
            sRight[4],
            sExt[6],
    //      |
            eTeam;
    //  - - - - - - - - - - - - - - -

        new fp = fopen( file, "rt" );

        while( !feof( fp ) )
        {
            fgets( fp, sBuffer, charsmax( sBuffer ) );

            trim( sBuffer );

            if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) )
                continue;

            if( sBuffer[0] != '"' || strlen( sBuffer  ) < 11 )
                continue;

            parse( sBuffer, sLeft, charsmax( sLeft ), sRight, charsmax( sRight ) );
            formatex( sExt, charsmax( sExt ), sLeft[ strlen( sLeft ) - 4 ] );

            if( equali( sExt, ".mp3" ) == -1 || equali( sExt, ".wav" ) == -1 )
            {
                log_amx( "%L", LANG_SERVER, "ERS_LOG_UNKNOW_EXTENSION", sExt );
                continue;
            }

            if( !file_exists( sLeft ) )
            {
                log_amx( "%L", LANG_SERVER, "ERS_LOG_INEXISTENT_FILE", sLeft );
                continue;
            }

            eTeam = NULL;

            if( equali( sRight, "CT" ) )
                eTeam = CT;

            else if( equali( sRight, "T" ) )
                eTeam = T;

            if( eTeam == NULL )
            {
                log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_TEAM_SOUND", sLeft );
                continue;
            }

            #if defined old_amxx
                copy( g_sTeam_sounds[ g_nSnd[ eTeam ] ][ eTeam ], MAX_FILE_LENGTH - 1, sLeft );
            #else
                ArrayPushString( eTeam == CT ? g_lstSoundCT : g_lstSoundT, sLeft );
            #endif

            ++g_nSnd[ eTeam ];
        }
        fclose( fp );

        if( g_nSnd[ e_Team:T ] > 1 || g_nSnd[ e_Team:CT ] > 1 )
        {
                new iMax_t, iMax_ct;
                GetPrecacheValue( iMax_t, iMax_ct );

                #if defined old_amxx
                    UpdateArray( iMax_t, e_Team:T );
                    UpdateArray( iMax_ct, e_Team:CT );
                #else
                    p_DeleteRandomItem( iMax_t , e_Team:T , g_lstSoundT  );
                    p_DeleteRandomItem( iMax_ct, e_Team:CT, g_lstSoundCT );
                #endif
        }

        log_amx( "---" );

        #if defined _DEBUG
            log_amx( "[ Loading %d CTs Sounds ]", g_nSnd[ e_team:CT ] );
        #endif
        #if defined old_amxx
            PrecacheSounds( e_Team:CT );
        #else
            PrecacheSounds_n( g_lstSoundCT );
        #endif

        #if defined _DEBUG
             log_amx( "[ Loading %d Ts Sounds ]", g_nSnd[ e_team:T ] );
        #endif
        #if defined old_amxx
            PrecacheSounds( e_Team:T );
        #else
            PrecacheSounds_n( g_lstSoundT );
        #endif
    }


    GetPrecacheValue( &iMax_t, &iMax_ct )
    {
        trim( g_sRp_value );
        new pos = contain( g_sRp_value, "-" );

        if( pos > 0 )
        {
            iMax_ct = str_to_num( g_sRp_value[ pos + 1 ] )
            g_sRp_value[ pos ] = '^0';
            iMax_t = str_to_num( g_sRp_value );
        }
        else
        {
            iMax_t  = str_to_num( g_sRp_value );
            iMax_ct = iMax_t;
        }
    }

    
    stock UpdateArray( iMax, iTeam )
    {
        new const iCnt_sound = g_nSnd[ iTeam ];
            
        if( !iMax || iMax == iCnt_sound )
            return;

        if( iMax >= iCnt_sound )
            iMax = iCnt_sound - 1;

        static
            sTmp_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ],
            iLast_number[ MAX_SOUNDS ];

        new i, iRand;
        for( i = 0; i < iCnt_sound; i++ )
        {
            copy( sTmp_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, g_sTeam_sounds[i][ iTeam ] );
            g_sTeam_sounds[i][ iTeam ][0] = '^0';
        }

        arrayset( iLast_number, 0, charsmax( iLast_number ) );

        i = 0;
        while( i != iMax )
        {
            check:
            iRand = random( iCnt_sound );

            if( iLast_number[ iRand ] )
                goto check;

            copy( g_sTeam_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, sTmp_sounds[ iRand ][ iTeam ] );
            ++i;
                
            iLast_number[ iRand ] = 1;
        }

        g_nSnd[ iTeam ] = iMax;
    }
    

    stock p_DeleteRandomItem( iMax, iTeam, Array:sSound_a )
    {
        new const iCnt_sound = g_nSnd[ iTeam ];
            
        if( !iMax || iMax == iCnt_sound )
            return;

        if( iMax >= iCnt_sound )
            iMax = iCnt_sound - 1;

        DeleteRandomItem( iCnt_sound - iMax, sSound_a );
        g_nSnd[ iTeam ] = iMax;
    }


    stock DeleteRandomItem( iRandom_n, Array:sSound_a )
        {
            new i;

            while( i++ != iRandom_n )
                ArrayDeleteItem( sSound_a, random( ArraySize( sSound_a ) ) );
        }

        
    stock PrecacheSounds( iTeam )
    {
        for( new i; i < g_nSnd[ iTeam ]; i++ )
        {
            PrecacheFile( g_sTeam_sounds[i][ iTeam ] );

            #if defined _DEBUG
                log_amx( "   - %s", g_sTeam_sounds[i][ iTeam ] );
            #endif
        }

        log_amx( "---" );
    }


    stock PrecacheSounds_n( Array:sSound_a )
    {
        static
    //  - - - - - - - - - - - - - - - - - - -
            sFile[ MAX_FILE_LENGTH ],
            iFileLen = charsmax( sFile );
    //  - - - - - - - - - - - - - - - - - - -

        for( new i; i < ArraySize( sSound_a ); i++ )
        {
            ArrayGetString( sSound_a, i, sFile, iFileLen );
            PrecacheFile( sFile );

            #if defined _DEBUG
                log_amx( "   - %s", sFile );
            #endif
        }

         log_amx( "---" );
    }


    PrecacheFile( const sound[] )
    {
        _is_wav( sound ) ?

            precache_sound( sound[6] ) :
            precache_generic( sound );
    }


    ShowPrint( id, const sMsg[], { Float, Sql, Result, _ }:... )
    {
        static
    //  - - - - - - - - -
            newMsg[191],
            message[191],
    //      |
            tNewMsg;
    //  - - - - - - - - -

        tNewMsg = charsmax( newMsg );
        vformat( newMsg, tNewMsg, sMsg, 3 );

        replace_all( newMsg, tNewMsg, "!t", "^3" );
        replace_all( newMsg, tNewMsg, "!g", "^4" );
        replace_all( newMsg, tNewMsg, "!n", "^1" );

        formatex( message, charsmax( message ), "^4[ERS]^1 %s", newMsg );

        emessage_begin( MSG_ONE, g_msgSayText, _, id );
        ewrite_byte( id );
        ewrite_string( message );
        emessage_end();
    }
    
    
    bool:CheckFile( const file[] )
    {
        new
    //  - - - - - - - - - - - - - - - - -
            sBuffer[256],
            fp = fopen( file, "rt" );
    //  - - - - - - - - - - - - - - - - -

        if( !fp )
            return false;

        while( !feof( fp ) )
        {
            fgets( fp, sBuffer, charsmax( sBuffer ) );

            trim( sBuffer );

            if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) || sBuffer[0] != '"' )
                continue;

            if( ( contain( sBuffer, ".mp3^"" ) != -1 || contain( sBuffer, ".wav^"" ) != -1 ) && ( contain( sBuffer, "^"T^"" ) != -1 || contain( sBuffer, "^"CT^"" ) != -1 ) )
                return true;
        }
        fclose( fp );

        return false;
    }

  • +
  • -
  • 0

#12 choyrack

    Wszechpomocny

  • Użytkownik

Reputacja: 64
Pomocny

  • Postów:369
  • GG:
  • Lokalizacja:Wrocław
Offline

Napisano 25.09.2008 16:13

Powinno być OK :-)
    #include <amxmodx>
    #include <amxmisc>


        new const
    // _________________________________________________

            PLUGIN [] = "Alternative End Round Sounds",
            VERSION[] = "2.3b",
            AUTHOR [] = "Arkshine";
    // _________________________________________________


    #if AMXX_VERSION_NUM < 180
        #define old_amxx
    #endif


    /* ========================= [ "START" AERA FOR CHANGES ] ========================= */


        #define _DEBUG                 // Active debug
        #define MAX_FILE_LENGTH  196   // Max length for files + path.

        #if defined old_amxx
            #define MAX_SOUNDS    25   // Max sounds per team
        #endif

        new const

            g_FileName[]    = "roundsound",     // Name of the main file if no files is found in 'g_FileFolder'.
            g_FileFolder[]  = "round_sound",    // Name of the directory in amxmodx/configs/ for per-map files.
            g_FilePrefix[]  = "ini",            // File extension used for the files.
            g_CmdChat[]     = "/roundsound";    // Chat command for player.


    /* ========================= [ "END" AERA FOR CHANGES ] ========================= */



    // - - - - - - - - - - - - - - - - - - - - - - -

    #define MAX_PLAYERS  32
    #define TASKID_ADS   1333
    #define SIZE_FILE    0
    #define NULL        -1

    new
        bool:g_pHeardSound[ MAX_PLAYERS + 1 ],

        #if !defined old_amxx
            Array:g_lstSoundCT,
            Array:g_lstSoundT,
        #endif

        p_enabled,
        p_player_toggle,
        p_time_ads,
        p_random_precache,

        g_sRp_value[12],
        g_msgSayText;


    enum _:e_Team
    {
        T = 0,
        CT,
    };

    new g_nSnd[ e_Team ];

    #if defined old_amxx
        new g_sTeam_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ];
        #define charsmax(%1)  sizeof( %1 ) - 1
    #endif

    #define _is_wav(%1)  equali( %1[strlen( %1 ) - 4 ], ".wav" )

    // - - - - - - - - - - - - - - - - - - - - - - -


    public plugin_precache()
    {
        register_dictionary( "end_roundsound.txt" );
             
        if( ( p_random_precache = get_cvar_pointer( "erc_random_precache" ) ) )
            get_pcvar_string( p_random_precache, g_sRp_value, charsmax( g_sRp_value ) );

        if( !p_random_precache )
            return;
           
        #if !defined old_amxx
            g_lstSoundCT = ArrayCreate( MAX_FILE_LENGTH );
            g_lstSoundT  = ArrayCreate( MAX_FILE_LENGTH );
        #endif

        loading_file();
    }


    public plugin_init()
    {
        register_plugin( PLUGIN, VERSION, AUTHOR );
        register_cvar( "ers_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );

        register_event( "SendAudio", "eT_win" , "a", "2&%!MRAD_terwin" );
        register_event( "SendAudio", "eCT_win", "a", "2&%!MRAD_ctwin"  );

        p_enabled         = register_cvar( "ers_enabled"        , "1"   );
        p_player_toggle   = register_cvar( "ers_player_toggle"  , "1"   );
        p_time_ads        = register_cvar( "erc_time_ads"       , "120" );

        if( !p_random_precache )
        {
            register_cvar( "erc_random_precache", g_sRp_value );
            server_cmd( "restart" );
        }

        register_clcmd( "say"       , "cmd_Say" );
        register_clcmd( "say_team"  , "cmd_Say" );

        g_msgSayText = get_user_msgid( "SayText" );
    }

 
    public client_authorized( id )
        g_pHeardSound[id] = true;


    public client_disconnect( id )
    {
        g_pHeardSound[id] = true;
        remove_task( id + TASKID_ADS );
    }


    public client_putinserver( id )
    {
        new Float:time = get_pcvar_float( p_time_ads );

        if( !time )
            return;

        remove_task( id + TASKID_ADS );
        set_task( time, "show_ads", id + TASKID_ADS, _, _, "b" );
    }


    public show_ads( taskid )
    {
        new id = taskid - TASKID_ADS;
        ShowPrint( id, "%L", id, "ERS_DISPLAY_ADS", g_CmdChat );
    }


    public cmd_Say( id )
    {
        if( !get_pcvar_num( p_enabled ) )
            return PLUGIN_CONTINUE;

        static sMsg[64];
        read_argv( 1, sMsg, charsmax( sMsg ) );

        if( equali( sMsg, g_CmdChat ) )
        {
            if( !get_pcvar_num( p_player_toggle ) )
            {
                ShowPrint( id, "%L", id, "ERS_CMD_DISABLED" );
                return PLUGIN_HANDLED;
            }

            g_pHeardSound[id] = g_pHeardSound[id] ? false : true;
            ShowPrint( id, "%L", id, g_pHeardSound[id] ? "ERS_SOUND_ENABLED" : "ERS_SOUND_DISABLED" );

            return PLUGIN_HANDLED;
        }

        return PLUGIN_CONTINUE;
    }


    public eT_win()
    {
        if( !g_nSnd[ e_Team:T ] )
            return;

        play_sound( e_Team:T );
    }


    public eCT_win()
    {
        if( !g_nSnd[ e_Team:CT ] )
            return;

        play_sound( e_Team:CT );
    }


    play_sound( iTeam )
    {
    client_cmd(0, "stopsound")
    client_cmd(0, "mp3 stop")          
static
    //  - - - - - - - - - - - - - - - -
            sCurSnd[ MAX_FILE_LENGTH ];
    //  - - - - - - - - - - - - - - - -

        new iRand;

        if( g_nSnd[ iTeam ] > 1 )
            iRand = random( g_nSnd[ iTeam ] );

        #if defined old_amxx
            copy( sCurSnd, MAX_FILE_LENGTH - 1, g_sTeam_sounds[ iRand ][ iTeam ] );
        #else
            ArrayGetString( iTeam == CT ? g_lstSoundCT : g_lstSoundT, iRand, sCurSnd, MAX_FILE_LENGTH - 1 );
        #endif

        _is_wav( sCurSnd ) ?

             format( sCurSnd, MAX_FILE_LENGTH - 1, "spk %s", sCurSnd[6] ) :
             format( sCurSnd, MAX_FILE_LENGTH - 1, "mp3 play %s", sCurSnd );

        if( get_pcvar_num( p_player_toggle ) )
        {
            static
        //  - - - - - - - - - - -
                iPlayers[32],
                iNum, pid;
        //  - - - - - - - - - - -

            get_players( iPlayers, iNum, "c" );

            for( new i; i < iNum; i++ )
            {
                pid = iPlayers[i];

                if( !g_pHeardSound[pid] || is_user_bot( pid ) )
                    continue;

                client_cmd( pid, "%s", sCurSnd );
            }
        }
        else
            client_cmd( 0, "%s", sCurSnd );
    }


    get_prefix( sMap[], iLen_map, sMapType[], iLen_type )
    {
        new
    //  - - - - - - - - -
            sRest[32];
    //  - - - - - - - - -

        get_mapname( sMap, iLen_map );
        strtok( sMap, sMapType, iLen_type, sRest, charsmax( sRest ), '_', 1 );
    }


    loading_file()
    {
        static
    //  - - - - - - - - - - - - - - - - -
            sPath[ MAX_FILE_LENGTH ],
    //      |
            sConfigsDir[64],
            sPrefix[6],
            sMap[32];
    //  - - - - - - - - - - - - - - - - -

        get_prefix( sMap, charsmax( sMap ), sPrefix, charsmax( sPrefix ) );
        get_configsdir( sConfigsDir, charsmax( sConfigsDir ) );


        new bool:bFound;

        for( new i = 1; i <= 3; i++ )
        {
            switch( i )
            {
                case 1 : formatex( sPath, charsmax( sPath ), "%s/%s/prefix-%s.%s", sConfigsDir, g_FileFolder, sPrefix, g_FilePrefix );
                case 2 : formatex( sPath, charsmax( sPath ), "%s/%s/%s.%s", sConfigsDir, g_FileFolder, sMap, g_FilePrefix );
                case 3 : formatex( sPath, charsmax( sPath ), "%s/%s.%s", sConfigsDir, g_FileName, g_FilePrefix );

                default : break;
            }

            if( !CheckFile( sPath ) )
                continue;

            bFound = true;
            break;
        }

        log_amx( "---" );

        bFound ?
            log_amx( "%L", LANG_SERVER, "ERS_LOG_LOADING", sPath ) :
            log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_FILES_FOUND" );

        load_sound( sPath );
    }

   
    load_sound( const file[] )
    {
        new
    //  - - - - - - - - - - - - - - -
            sBuffer[256],
    //      |
            sLeft[ MAX_FILE_LENGTH ],
            sRight[4],
            sExt[6],
    //      |
            eTeam;
    //  - - - - - - - - - - - - - - -

        new fp = fopen( file, "rt" );

        while( !feof( fp ) )
        {
            fgets( fp, sBuffer, charsmax( sBuffer ) );

            trim( sBuffer );

            if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) )
                continue;

            if( sBuffer[0] != '"' || strlen( sBuffer  ) < 11 )
                continue;

            parse( sBuffer, sLeft, charsmax( sLeft ), sRight, charsmax( sRight ) );
            formatex( sExt, charsmax( sExt ), sLeft[ strlen( sLeft ) - 4 ] );

            if( equali( sExt, ".mp3" ) == -1 || equali( sExt, ".wav" ) == -1 )
            {
                log_amx( "%L", LANG_SERVER, "ERS_LOG_UNKNOW_EXTENSION", sExt );
                continue;
            }

            if( !file_exists( sLeft ) )
            {
                log_amx( "%L", LANG_SERVER, "ERS_LOG_INEXISTENT_FILE", sLeft );
                continue;
            }

            eTeam = NULL;

            if( equali( sRight, "CT" ) )
                eTeam = CT;

            else if( equali( sRight, "T" ) )
                eTeam = T;

            if( eTeam == NULL )
            {
                log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_TEAM_SOUND", sLeft );
                continue;
            }

            #if defined old_amxx
                copy( g_sTeam_sounds[ g_nSnd[ eTeam ] ][ eTeam ], MAX_FILE_LENGTH - 1, sLeft );
            #else
                ArrayPushString( eTeam == CT ? g_lstSoundCT : g_lstSoundT, sLeft );
            #endif

            ++g_nSnd[ eTeam ];
        }
        fclose( fp );

        if( g_nSnd[ e_Team:T ] > 1 || g_nSnd[ e_Team:CT ] > 1 )
        {
                new iMax_t, iMax_ct;
                GetPrecacheValue( iMax_t, iMax_ct );

                #if defined old_amxx
                    UpdateArray( iMax_t, e_Team:T );
                    UpdateArray( iMax_ct, e_Team:CT );
                #else
                    p_DeleteRandomItem( iMax_t , e_Team:T , g_lstSoundT  );
                    p_DeleteRandomItem( iMax_ct, e_Team:CT, g_lstSoundCT );
                #endif
        }

        log_amx( "---" );

        #if defined _DEBUG
            log_amx( "[ Loading %d CTs Sounds ]", g_nSnd[ e_team:CT ] );
        #endif
        #if defined old_amxx
            PrecacheSounds( e_Team:CT );
        #else
            PrecacheSounds_n( g_lstSoundCT );
        #endif

        #if defined _DEBUG
             log_amx( "[ Loading %d Ts Sounds ]", g_nSnd[ e_team:T ] );
        #endif
        #if defined old_amxx
            PrecacheSounds( e_Team:T );
        #else
            PrecacheSounds_n( g_lstSoundT );
        #endif
    }


    GetPrecacheValue( &iMax_t, &iMax_ct )
    {
        trim( g_sRp_value );
        new pos = contain( g_sRp_value, "-" );

        if( pos > 0 )
        {
            iMax_ct = str_to_num( g_sRp_value[ pos + 1 ] )
            g_sRp_value[ pos ] = '^0';
            iMax_t = str_to_num( g_sRp_value );
        }
        else
        {
            iMax_t  = str_to_num( g_sRp_value );
            iMax_ct = iMax_t;
        }
    }

   
    stock UpdateArray( iMax, iTeam )
    {
        new const iCnt_sound = g_nSnd[ iTeam ];
           
        if( !iMax || iMax == iCnt_sound )
            return;

        if( iMax >= iCnt_sound )
            iMax = iCnt_sound - 1;

        static
            sTmp_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ],
            iLast_number[ MAX_SOUNDS ];

        new i, iRand;
        for( i = 0; i < iCnt_sound; i++ )
        {
            copy( sTmp_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, g_sTeam_sounds[i][ iTeam ] );
            g_sTeam_sounds[i][ iTeam ][0] = '^0';
        }

        arrayset( iLast_number, 0, charsmax( iLast_number ) );

        i = 0;
        while( i != iMax )
        {
            check:
            iRand = random( iCnt_sound );

            if( iLast_number[ iRand ] )
                goto check;

            copy( g_sTeam_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, sTmp_sounds[ iRand ][ iTeam ] );
            ++i;
               
            iLast_number[ iRand ] = 1;
        }

        g_nSnd[ iTeam ] = iMax;
    }
   

    stock p_DeleteRandomItem( iMax, iTeam, Array:sSound_a )
    {
        new const iCnt_sound = g_nSnd[ iTeam ];
           
        if( !iMax || iMax == iCnt_sound )
            return;

        if( iMax >= iCnt_sound )
            iMax = iCnt_sound - 1;

        DeleteRandomItem( iCnt_sound - iMax, sSound_a );
        g_nSnd[ iTeam ] = iMax;
    }


    stock DeleteRandomItem( iRandom_n, Array:sSound_a )
        {
            new i;

            while( i++ != iRandom_n )
                ArrayDeleteItem( sSound_a, random( ArraySize( sSound_a ) ) );
        }

       
    stock PrecacheSounds( iTeam )
    {
        for( new i; i < g_nSnd[ iTeam ]; i++ )
        {
            PrecacheFile( g_sTeam_sounds[i][ iTeam ] );

            #if defined _DEBUG
                log_amx( "   - %s", g_sTeam_sounds[i][ iTeam ] );
            #endif
        }

        log_amx( "---" );
    }


    stock PrecacheSounds_n( Array:sSound_a )
    {
        static
    //  - - - - - - - - - - - - - - - - - - -
            sFile[ MAX_FILE_LENGTH ],
            iFileLen = charsmax( sFile );
    //  - - - - - - - - - - - - - - - - - - -

        for( new i; i < ArraySize( sSound_a ); i++ )
        {
            ArrayGetString( sSound_a, i, sFile, iFileLen );
            PrecacheFile( sFile );

            #if defined _DEBUG
                log_amx( "   - %s", sFile );
            #endif
        }

         log_amx( "---" );
    }


    PrecacheFile( const sound[] )
    {
        _is_wav( sound ) ?

            precache_sound( sound[6] ) :
            precache_generic( sound );
    }


    ShowPrint( id, const sMsg[], { Float, Sql, Result, _ }:... )
    {
        static
    //  - - - - - - - - -
            newMsg[191],
            message[191],
    //      |
            tNewMsg;
    //  - - - - - - - - -

        tNewMsg = charsmax( newMsg );
        vformat( newMsg, tNewMsg, sMsg, 3 );

        replace_all( newMsg, tNewMsg, "!t", "^3" );
        replace_all( newMsg, tNewMsg, "!g", "^4" );
        replace_all( newMsg, tNewMsg, "!n", "^1" );

        formatex( message, charsmax( message ), "^4[ERS]^1 %s", newMsg );

        emessage_begin( MSG_ONE, g_msgSayText, _, id );
        ewrite_byte( id );
        ewrite_string( message );
        emessage_end();
    }
   
   
    bool:CheckFile( const file[] )
    {
        new
    //  - - - - - - - - - - - - - - - - -
            sBuffer[256],
            fp = fopen( file, "rt" );
    //  - - - - - - - - - - - - - - - - -

        if( !fp )
            return false;

        while( !feof( fp ) )
        {
            fgets( fp, sBuffer, charsmax( sBuffer ) );

            trim( sBuffer );

            if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) || sBuffer[0] != '"' )
                continue;

            if( ( contain( sBuffer, ".mp3^"" ) != -1 || contain( sBuffer, ".wav^"" ) != -1 ) && ( contain( sBuffer, "^"T^"" ) != -1 || contain( sBuffer, "^"CT^"" ) != -1 ) )
                return true;
        }
        fclose( fp );

        return false;
    }       

  • +
  • -
  • 0

#13 pawlik

    Wszechwiedzący

  • Użytkownik

Reputacja: 86
Zaawansowany

  • Postów:579
  • Steam:steam
  • Lokalizacja:Podkarpacie
Offline

Napisano 25.09.2008 16:25

nie ma ani muzyczki pod koniec rundy, ani dźwięku TT win, ani Headshot
  • +
  • -
  • 0

#14 choyrack

    Wszechpomocny

  • Użytkownik

Reputacja: 64
Pomocny

  • Postów:369
  • GG:
  • Lokalizacja:Wrocław
Offline

Napisano 25.09.2008 16:27

A zobacz jak jest tak:

    #include <amxmodx>

    #include <amxmisc>





        new const

    // _________________________________________________



            PLUGIN [] = "Alternative End Round Sounds",

            VERSION[] = "2.3b",

            AUTHOR [] = "Arkshine";

    // _________________________________________________





    #if AMXX_VERSION_NUM < 180

        #define old_amxx

    #endif





    /* ========================= [ "START" AERA FOR CHANGES ] ========================= */





        #define _DEBUG                 // Active debug

        #define MAX_FILE_LENGTH  196   // Max length for files + path.



        #if defined old_amxx

            #define MAX_SOUNDS    25   // Max sounds per team

        #endif



        new const



            g_FileName[]    = "roundsound",     // Name of the main file if no files is found in 'g_FileFolder'.

            g_FileFolder[]  = "round_sound",    // Name of the directory in amxmodx/configs/ for per-map files.

            g_FilePrefix[]  = "ini",            // File extension used for the files.

            g_CmdChat[]     = "/roundsound";    // Chat command for player.





    /* ========================= [ "END" AERA FOR CHANGES ] ========================= */







    // - - - - - - - - - - - - - - - - - - - - - - -



    #define MAX_PLAYERS  32

    #define TASKID_ADS   1333

    #define SIZE_FILE    0

    #define NULL        -1



    new

        bool:g_pHeardSound[ MAX_PLAYERS + 1 ],



        #if !defined old_amxx

            Array:g_lstSoundCT,

            Array:g_lstSoundT,

        #endif



        p_enabled,

        p_player_toggle,

        p_time_ads,

        p_random_precache,



        g_sRp_value[12],

        g_msgSayText;





    enum _:e_Team

    {

        T = 0,

        CT,

    };



    new g_nSnd[ e_Team ];



    #if defined old_amxx

        new g_sTeam_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ];

        #define charsmax(%1)  sizeof( %1 ) - 1

    #endif



    #define _is_wav(%1)  equali( %1[strlen( %1 ) - 4 ], ".wav" )



    // - - - - - - - - - - - - - - - - - - - - - - -





    public plugin_precache()

    {

        register_dictionary( "end_roundsound.txt" );

             

        if( ( p_random_precache = get_cvar_pointer( "erc_random_precache" ) ) )

            get_pcvar_string( p_random_precache, g_sRp_value, charsmax( g_sRp_value ) );



        if( !p_random_precache )

            return;

           

        #if !defined old_amxx

            g_lstSoundCT = ArrayCreate( MAX_FILE_LENGTH );

            g_lstSoundT  = ArrayCreate( MAX_FILE_LENGTH );

        #endif



        loading_file();

    }





    public plugin_init()

    {

        register_plugin( PLUGIN, VERSION, AUTHOR );

        register_cvar( "ers_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );



        register_event( "SendAudio", "eT_win" , "a", "2&%!MRAD_terwin" );

        register_event( "SendAudio", "eCT_win", "a", "2&%!MRAD_ctwin"  );



        p_enabled         = register_cvar( "ers_enabled"        , "1"   );

        p_player_toggle   = register_cvar( "ers_player_toggle"  , "1"   );

        p_time_ads        = register_cvar( "erc_time_ads"       , "120" );



        if( !p_random_precache )

        {

            register_cvar( "erc_random_precache", g_sRp_value );

            server_cmd( "restart" );

        }



        register_clcmd( "say"       , "cmd_Say" );

        register_clcmd( "say_team"  , "cmd_Say" );



        g_msgSayText = get_user_msgid( "SayText" );

    }



 

    public client_authorized( id )

        g_pHeardSound[id] = true;





    public client_disconnect( id )

    {

        g_pHeardSound[id] = true;

        remove_task( id + TASKID_ADS );

    }





    public client_putinserver( id )

    {

        new Float:time = get_pcvar_float( p_time_ads );



        if( !time )

            return;



        remove_task( id + TASKID_ADS );

        set_task( time, "show_ads", id + TASKID_ADS, _, _, "b" );

    }





    public show_ads( taskid )

    {

        new id = taskid - TASKID_ADS;

        ShowPrint( id, "%L", id, "ERS_DISPLAY_ADS", g_CmdChat );

    }





    public cmd_Say( id )

    {

        if( !get_pcvar_num( p_enabled ) )

            return PLUGIN_CONTINUE;



        static sMsg[64];

        read_argv( 1, sMsg, charsmax( sMsg ) );



        if( equali( sMsg, g_CmdChat ) )

        {

            if( !get_pcvar_num( p_player_toggle ) )

            {

                ShowPrint( id, "%L", id, "ERS_CMD_DISABLED" );

                return PLUGIN_HANDLED;

            }



            g_pHeardSound[id] = g_pHeardSound[id] ? false : true;

            ShowPrint( id, "%L", id, g_pHeardSound[id] ? "ERS_SOUND_ENABLED" : "ERS_SOUND_DISABLED" );



            return PLUGIN_HANDLED;

        }



        return PLUGIN_CONTINUE;

    }





    public eT_win()

    {

    client_cmd(0, "stopsound")

    client_cmd(0, "mp3 stop")        

 if( !g_nSnd[ e_Team:T ] )

            return;



        play_sound( e_Team:T );

    }





    public eCT_win()

    {

    client_cmd(0, "stopsound")

    client_cmd(0, "mp3 stop") 

if( !g_nSnd[ e_Team:CT ] )

            return;



        play_sound( e_Team:CT );

    }





    play_sound( iTeam )

    {        

static

    //  - - - - - - - - - - - - - - - -

            sCurSnd[ MAX_FILE_LENGTH ];

    //  - - - - - - - - - - - - - - - -



        new iRand;



        if( g_nSnd[ iTeam ] > 1 )

            iRand = random( g_nSnd[ iTeam ] );



        #if defined old_amxx

            copy( sCurSnd, MAX_FILE_LENGTH - 1, g_sTeam_sounds[ iRand ][ iTeam ] );

        #else

            ArrayGetString( iTeam == CT ? g_lstSoundCT : g_lstSoundT, iRand, sCurSnd, MAX_FILE_LENGTH - 1 );

        #endif



        _is_wav( sCurSnd ) ?



             format( sCurSnd, MAX_FILE_LENGTH - 1, "spk %s", sCurSnd[6] ) :

             format( sCurSnd, MAX_FILE_LENGTH - 1, "mp3 play %s", sCurSnd );



        if( get_pcvar_num( p_player_toggle ) )

        {

            static

        //  - - - - - - - - - - -

                iPlayers[32],

                iNum, pid;

        //  - - - - - - - - - - -



            get_players( iPlayers, iNum, "c" );



            for( new i; i < iNum; i++ )

            {

                pid = iPlayers[i];



                if( !g_pHeardSound[pid] || is_user_bot( pid ) )

                    continue;



                client_cmd( pid, "%s", sCurSnd );

            }

        }

        else

            client_cmd( 0, "%s", sCurSnd );

    }





    get_prefix( sMap[], iLen_map, sMapType[], iLen_type )

    {

        new

    //  - - - - - - - - -

            sRest[32];

    //  - - - - - - - - -



        get_mapname( sMap, iLen_map );

        strtok( sMap, sMapType, iLen_type, sRest, charsmax( sRest ), '_', 1 );

    }





    loading_file()

    {

        static

    //  - - - - - - - - - - - - - - - - -

            sPath[ MAX_FILE_LENGTH ],

    //      |

            sConfigsDir[64],

            sPrefix[6],

            sMap[32];

    //  - - - - - - - - - - - - - - - - -



        get_prefix( sMap, charsmax( sMap ), sPrefix, charsmax( sPrefix ) );

        get_configsdir( sConfigsDir, charsmax( sConfigsDir ) );





        new bool:bFound;



        for( new i = 1; i <= 3; i++ )

        {

            switch( i )

            {

                case 1 : formatex( sPath, charsmax( sPath ), "%s/%s/prefix-%s.%s", sConfigsDir, g_FileFolder, sPrefix, g_FilePrefix );

                case 2 : formatex( sPath, charsmax( sPath ), "%s/%s/%s.%s", sConfigsDir, g_FileFolder, sMap, g_FilePrefix );

                case 3 : formatex( sPath, charsmax( sPath ), "%s/%s.%s", sConfigsDir, g_FileName, g_FilePrefix );



                default : break;

            }



            if( !CheckFile( sPath ) )

                continue;



            bFound = true;

            break;

        }



        log_amx( "---" );



        bFound ?

            log_amx( "%L", LANG_SERVER, "ERS_LOG_LOADING", sPath ) :

            log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_FILES_FOUND" );



        load_sound( sPath );

    }



   

    load_sound( const file[] )

    {

        new

    //  - - - - - - - - - - - - - - -

            sBuffer[256],

    //      |

            sLeft[ MAX_FILE_LENGTH ],

            sRight[4],

            sExt[6],

    //      |

            eTeam;

    //  - - - - - - - - - - - - - - -



        new fp = fopen( file, "rt" );



        while( !feof( fp ) )

        {

            fgets( fp, sBuffer, charsmax( sBuffer ) );



            trim( sBuffer );



            if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) )

                continue;



            if( sBuffer[0] != '"' || strlen( sBuffer  ) < 11 )

                continue;



            parse( sBuffer, sLeft, charsmax( sLeft ), sRight, charsmax( sRight ) );

            formatex( sExt, charsmax( sExt ), sLeft[ strlen( sLeft ) - 4 ] );



            if( equali( sExt, ".mp3" ) == -1 || equali( sExt, ".wav" ) == -1 )

            {

                log_amx( "%L", LANG_SERVER, "ERS_LOG_UNKNOW_EXTENSION", sExt );

                continue;

            }



            if( !file_exists( sLeft ) )

            {

                log_amx( "%L", LANG_SERVER, "ERS_LOG_INEXISTENT_FILE", sLeft );

                continue;

            }



            eTeam = NULL;



            if( equali( sRight, "CT" ) )

                eTeam = CT;



            else if( equali( sRight, "T" ) )

                eTeam = T;



            if( eTeam == NULL )

            {

                log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_TEAM_SOUND", sLeft );

                continue;

            }



            #if defined old_amxx

                copy( g_sTeam_sounds[ g_nSnd[ eTeam ] ][ eTeam ], MAX_FILE_LENGTH - 1, sLeft );

            #else

                ArrayPushString( eTeam == CT ? g_lstSoundCT : g_lstSoundT, sLeft );

            #endif



            ++g_nSnd[ eTeam ];

        }

        fclose( fp );



        if( g_nSnd[ e_Team:T ] > 1 || g_nSnd[ e_Team:CT ] > 1 )

        {

                new iMax_t, iMax_ct;

                GetPrecacheValue( iMax_t, iMax_ct );



                #if defined old_amxx

                    UpdateArray( iMax_t, e_Team:T );

                    UpdateArray( iMax_ct, e_Team:CT );

                #else

                    p_DeleteRandomItem( iMax_t , e_Team:T , g_lstSoundT  );

                    p_DeleteRandomItem( iMax_ct, e_Team:CT, g_lstSoundCT );

                #endif

        }



        log_amx( "---" );



        #if defined _DEBUG

            log_amx( "[ Loading %d CTs Sounds ]", g_nSnd[ e_team:CT ] );

        #endif

        #if defined old_amxx

            PrecacheSounds( e_Team:CT );

        #else

            PrecacheSounds_n( g_lstSoundCT );

        #endif



        #if defined _DEBUG

             log_amx( "[ Loading %d Ts Sounds ]", g_nSnd[ e_team:T ] );

        #endif

        #if defined old_amxx

            PrecacheSounds( e_Team:T );

        #else

            PrecacheSounds_n( g_lstSoundT );

        #endif

    }





    GetPrecacheValue( &iMax_t, &iMax_ct )

    {

        trim( g_sRp_value );

        new pos = contain( g_sRp_value, "-" );



        if( pos > 0 )

        {

            iMax_ct = str_to_num( g_sRp_value[ pos + 1 ] )

            g_sRp_value[ pos ] = '^0';

            iMax_t = str_to_num( g_sRp_value );

        }

        else

        {

            iMax_t  = str_to_num( g_sRp_value );

            iMax_ct = iMax_t;

        }

    }



   

    stock UpdateArray( iMax, iTeam )

    {

        new const iCnt_sound = g_nSnd[ iTeam ];

           

        if( !iMax || iMax == iCnt_sound )

            return;



        if( iMax >= iCnt_sound )

            iMax = iCnt_sound - 1;



        static

            sTmp_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ],

            iLast_number[ MAX_SOUNDS ];



        new i, iRand;

        for( i = 0; i < iCnt_sound; i++ )

        {

            copy( sTmp_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, g_sTeam_sounds[i][ iTeam ] );

            g_sTeam_sounds[i][ iTeam ][0] = '^0';

        }



        arrayset( iLast_number, 0, charsmax( iLast_number ) );



        i = 0;

        while( i != iMax )

        {

            check:

            iRand = random( iCnt_sound );



            if( iLast_number[ iRand ] )

                goto check;



            copy( g_sTeam_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, sTmp_sounds[ iRand ][ iTeam ] );

            ++i;

               

            iLast_number[ iRand ] = 1;

        }



        g_nSnd[ iTeam ] = iMax;

    }

   



    stock p_DeleteRandomItem( iMax, iTeam, Array:sSound_a )

    {

        new const iCnt_sound = g_nSnd[ iTeam ];

           

        if( !iMax || iMax == iCnt_sound )

            return;



        if( iMax >= iCnt_sound )

            iMax = iCnt_sound - 1;



        DeleteRandomItem( iCnt_sound - iMax, sSound_a );

        g_nSnd[ iTeam ] = iMax;

    }





    stock DeleteRandomItem( iRandom_n, Array:sSound_a )

        {

            new i;



            while( i++ != iRandom_n )

                ArrayDeleteItem( sSound_a, random( ArraySize( sSound_a ) ) );

        }



       

    stock PrecacheSounds( iTeam )

    {

        for( new i; i < g_nSnd[ iTeam ]; i++ )

        {

            PrecacheFile( g_sTeam_sounds[i][ iTeam ] );



            #if defined _DEBUG

                log_amx( "   - %s", g_sTeam_sounds[i][ iTeam ] );

            #endif

        }



        log_amx( "---" );

    }





    stock PrecacheSounds_n( Array:sSound_a )

    {

        static

    //  - - - - - - - - - - - - - - - - - - -

            sFile[ MAX_FILE_LENGTH ],

            iFileLen = charsmax( sFile );

    //  - - - - - - - - - - - - - - - - - - -



        for( new i; i < ArraySize( sSound_a ); i++ )

        {

            ArrayGetString( sSound_a, i, sFile, iFileLen );

            PrecacheFile( sFile );



            #if defined _DEBUG

                log_amx( "   - %s", sFile );

            #endif

        }



         log_amx( "---" );

    }





    PrecacheFile( const sound[] )

    {

        _is_wav( sound ) ?



            precache_sound( sound[6] ) :

            precache_generic( sound );

    }





    ShowPrint( id, const sMsg[], { Float, Sql, Result, _ }:... )

    {

        static

    //  - - - - - - - - -

            newMsg[191],

            message[191],

    //      |

            tNewMsg;

    //  - - - - - - - - -



        tNewMsg = charsmax( newMsg );

        vformat( newMsg, tNewMsg, sMsg, 3 );



        replace_all( newMsg, tNewMsg, "!t", "^3" );

        replace_all( newMsg, tNewMsg, "!g", "^4" );

        replace_all( newMsg, tNewMsg, "!n", "^1" );



        formatex( message, charsmax( message ), "^4[ERS]^1 %s", newMsg );



        emessage_begin( MSG_ONE, g_msgSayText, _, id );

        ewrite_byte( id );

        ewrite_string( message );

        emessage_end();

    }

   

   

    bool:CheckFile( const file[] )

    {

        new

    //  - - - - - - - - - - - - - - - - -

            sBuffer[256],

            fp = fopen( file, "rt" );

    //  - - - - - - - - - - - - - - - - -



        if( !fp )

            return false;



        while( !feof( fp ) )

        {

            fgets( fp, sBuffer, charsmax( sBuffer ) );



            trim( sBuffer );



            if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) || sBuffer[0] != '"' )

                continue;



            if( ( contain( sBuffer, ".mp3^"" ) != -1 || contain( sBuffer, ".wav^"" ) != -1 ) && ( contain( sBuffer, "^"T^"" ) != -1 || contain( sBuffer, "^"CT^"" ) != -1 ) )

                return true;

        }

        fclose( fp );



        return false;

    }

  • +
  • -
  • 0

#15 pawlik

    Wszechwiedzący

  • Użytkownik

Reputacja: 86
Zaawansowany

  • Postów:579
  • Steam:steam
  • Lokalizacja:Podkarpacie
Offline

Napisano 25.09.2008 16:58

Jest tak, że nie ma w ogóle muzyczek, nagle pojawiają się headshot, później 1 runda roundsound i później dalej nie ma. Próbowałem już robić reinstalla ale nic. OK jak chcesz to napisz co i jak. Do jutra.
  • +
  • -
  • 0

#16 darkman

    Wszechwiedzący

  • Przyjaciel

Reputacja: 85
Zaawansowany

  • Postów:553
  • Lokalizacja:inactive
Offline

Napisano 26.09.2008 19:36

choyrack dawaj te pliki na jakis hosting, albo do zalacznika bo strona tak sie rozjezdza ze ciezko cokolwiek przeczytac.
  • +
  • -
  • 0

#17 choyrack

    Wszechpomocny

  • Użytkownik

Reputacja: 64
Pomocny

  • Postów:369
  • GG:
  • Lokalizacja:Wrocław
Offline

Napisano 26.09.2008 20:39

Może zrobimy jeden temat: http://amxx.pl/viewtopic.php?t=3672
  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych