REMusic [Round End Music | End Round Sounds]

Одобрените от нас плъгини. Моля, докладвайте ако забележите бъг с някой от плъгините в този раздел.
Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

REMusic [Round End Music | End Round Sounds]

Мнение от OciXCrom » 04 Ное 2018, 21:24

Написал ли си .wav или .mp3 в края на имената, тъй като не го виждам в грешките?

Аватар
MadNESs
Извън линия
Потребител
Потребител
Мнения: 207
Регистриран на: 21 Мар 2017, 21:43
Местоположение: Sofia
Се отблагодари: 16 пъти
Получена благодарност: 11 пъти
Обратна връзка:

REMusic [Round End Music | End Round Sounds]

Мнение от MadNESs » 04 Ное 2018, 21:33

OciXCrom™ написа: 04 Ное 2018, 21:24 Написал ли си .wav или .mp3 в края на имената, тъй като не го виждам в грешките?
Според мен поблема е следния че, името на песните има space
Това са част от песните които са в REMusic.ini

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

Best-Servers/Drama Queen.wav
Best-Servers/In Your Head.wav
 ! Съобщение от: MadNESs
Това беше проблема !

Аватар
antonstoqnovv
Извън линия
Потребител
Потребител
Мнения: 213
Регистриран на: 15 Окт 2017, 10:40
Се отблагодари: 9 пъти
Получена благодарност: 2 пъти

REMusic [Round End Music | End Round Sounds]

Мнение от antonstoqnovv » 18 Ное 2018, 11:24

А може ли да се направи пак така да взима от там песните обаче всеки да може да си ги пуска да си по време на игра не само след края на рунд
:dance: connect 88.99.12.243:27019 :dance:

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

REMusic [Round End Music | End Round Sounds]

Мнение от OciXCrom » 18 Ное 2018, 14:52

Това е коренно различно от идеята на този плъгин. Може да се направи отделен плъгин за тази цел който ще взима песните от същия файл. Пусни си заявка в раздела ако искаш.

Аватар
tarsis
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 19 Дек 2018, 11:08

REMusic [Round End Music | End Round Sounds]

Мнение от tarsis » 19 Дек 2018, 11:27

hey ocixcrom, nice job as always, finally registered on your forum!

can you make an edit on this plugin so i can use it on my server?

i want to show the name of the artist and sound when playing, but in cz tutor, like the other code from your rank system, in config it would be like this?

misc/nameofsong.wav "David Guetta - Track Name"
in cz tutor:

Now Playing: David Guetta - Track Name

this is the code you had done for the rank plugin to show in tutor:

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

#include <amxmodx> 
#include <crxranks> 

const Float:TUTOR_FREQ = 1.0 
const MAX_TUTOR_LENGTH = 128 

new g_bShow[33], g_iTutorText, g_iTutorClose 

public plugin_init() 
{ 
    register_plugin("CRXRanks: Tutor Info", "1.0", "OciXCrom") 
    g_iTutorText = get_user_msgid("TutorText") 
    g_iTutorClose = get_user_msgid("TutorClose") 
} 

public client_putinserver(id) 
{ 
    g_bShow[id] = true 
    set_task(TUTOR_FREQ, "ShowTutor", id) 
} 

public client_disconnected(id) 
    remove_task(id) 

public ShowTutor(id) 
{ 
    if(g_bShow[id]) 
    { 
        static szTutor[MAX_TUTOR_LENGTH], szRank[CRXRANKS_MAX_RANK_LENGTH] 
        crxranks_get_user_rank(id, szRank, charsmax(szRank)) 
        formatex(szTutor, charsmax(szTutor), "Rank: %s^nXP: %i", szRank, crxranks_get_user_xp(id)) 

        message_begin(MSG_ONE_UNRELIABLE, g_iTutorText, _, id) 
        write_string(szTutor) 
        write_byte(0) 
        write_short(0) 
        write_short(0) 
        write_short(1<<0) 
        message_end() 
    } 
    else 
    { 
        message_begin(MSG_ONE_UNRELIABLE, g_iTutorClose, _, id) 
        message_end() 
    } 

    g_bShow[id] = !g_bShow[id] 
}  

players are always asking the name of the song that is playing, is nice to show them instead of having to respond everytime

thanks very much

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

REMusic [Round End Music | End Round Sounds]

Мнение от OciXCrom » 19 Дек 2018, 14:47

Thanks for registering. Here's the edited plugin:

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

#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN_VERSION "2.3.1+tutor"

#if defined client_disconnected
	#define client_disconnect client_disconnected
#endif

const MAX_TUTOR_LENGTH = 128 
const Float:TUTOR_DURATION = 5.0
new const g_szPrefix[] = "!g[REMusic]!n"
new g_iTutorText, g_iTutorClose
new bool:g_bTutorActive[33]

new Array:g_aSounds,
	Array:g_aNames,
	g_iMaxSounds,
	g_iVault,
	g_iSound,
	g_pRandom,
	g_iSayText
	
new bool:g_bBlocked[33]

enum
{
	TYPE_INVALID = 0,
	TYPE_WAV,
	TYPE_MP3
}

enum
{
	VAULT_READ = 0,
	VAULT_WRITE
}

public plugin_init()
{
	register_plugin("Round End Music", PLUGIN_VERSION, "OciXCrom")
	register_cvar("CRXReMusic", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	register_dictionary("REMusic.txt")
	
	register_event("SendAudio", "OnRoundEnd", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
	register_clcmd("say /ers", "cmdMute")
	register_clcmd("say_team /ers", "cmdMute")
	
	g_pRandom = register_cvar("remusic_random", "1")
	g_iSayText = get_user_msgid("SayText")
	g_iTutorText = get_user_msgid("TutorText") 
	g_iTutorClose = get_user_msgid("TutorClose") 
	g_iVault = nvault_open("REMusic")
}

public plugin_precache()
{
	g_aSounds = ArrayCreate(32, 1)
	g_aNames = ArrayCreate(32, 1)
	ReadFile()
}

public plugin_end()
{
	ArrayDestroy(g_aSounds)
	ArrayDestroy(g_aNames)
}

public client_putinserver(id)
{
	g_bBlocked[id] = false
	g_bTutorActive[id] = false
	UseVault(id, VAULT_READ)
}

public client_disconnect(id)
	UseVault(id, VAULT_WRITE)

UseVault(id, iType)
{
	if(!IsValidSteam(id))
		return
	
	new szAuthId[35], szData[2]
	get_user_authid(id, szAuthId, charsmax(szAuthId))
	
	switch(iType)
	{
		case VAULT_WRITE:
		{
			num_to_str(g_bBlocked[id], szData, charsmax(szData))
			nvault_set(g_iVault, szAuthId, szData)
		}
		case VAULT_READ:
		{
			nvault_get(g_iVault, szAuthId, szData, charsmax(szData))
			g_bBlocked[id] = str_to_num(szData) == 1 ? true : false
		}
	}
}
	
public OnRoundEnd()
{
	new szSound[32], iPlayers[32], iPnum, blRandom = get_pcvar_num(g_pRandom) == 1
	new iSound = blRandom ? random(g_iMaxSounds) : g_iSound

	ArrayGetString(g_aSounds, iSound, szSound, charsmax(szSound))
	get_players(iPlayers, iPnum)
	
	static szName[MAX_TUTOR_LENGTH]
	ArrayGetString(g_aNames, iSound, szName, charsmax(szName))

	new iType = get_sound_type(szSound)
	
	for(new i, iPlayer; i < iPnum; i++)
	{
		iPlayer = iPlayers[i]
		
		if(!g_bBlocked[iPlayer])
		{
			g_bTutorActive[iPlayer] = true
			client_cmd(iPlayer, "%s %s", iType == TYPE_WAV ? "spk" : "mp3 play", szSound)

			message_begin(MSG_ONE_UNRELIABLE, g_iTutorText, _, iPlayer)
			write_string(szName)
			write_byte(0)
			write_short(0)
			write_short(0)
			write_short(1<<0)
			message_end()

			set_task(TUTOR_DURATION, "RemoveTutor", iPlayer)
		}
	}
	
	if(!blRandom)
		g_iSound = (g_iSound == g_iMaxSounds - 1) ? 0 : (g_iSound + 1)
}

public RemoveTutor(id)
{
	if(!is_user_connected(id) || !g_bTutorActive[id])
		return

	message_begin(MSG_ONE_UNRELIABLE, g_iTutorClose, _, id)
	message_end()

	g_bTutorActive[id] = false
}  

public cmdMute(id)
{
	g_bBlocked[id] = g_bBlocked[id] ? false : true
	ColorChat(id, "%L", id, g_bBlocked[id] ? "REMUSIC_OFF" : "REMUSIC_ON")
	return PLUGIN_HANDLED
}

ReadFile()
{
	new szConfigsName[256], szFilename[256]
	get_configsdir(szConfigsName, charsmax(szConfigsName))
	formatex(szFilename, charsmax(szFilename), "%s/REMusic.ini", szConfigsName)
	new iFilePointer = fopen(szFilename, "rt")
	
	if(iFilePointer)
	{
		new szData[128], szSound[64], szName[64]
		
		while(!feof(iFilePointer))
		{
			fgets(iFilePointer, szData, charsmax(szData))
			trim(szData)

			switch(szData[0])
			{
				case EOS, ';': continue
				default:
				{
					strtok(szData, szSound, charsmax(szSound), szName, charsmax(szName), '=')
					trim(szSound); trim(szName)

					switch(get_sound_type(szSound))
					{
						case TYPE_WAV: precache_sound(szSound)
						case TYPE_MP3:
						{
							format(szSound, charsmax(szSound), "sound/%s", szSound)
							precache_generic(szSound)
						}
						case TYPE_INVALID: continue
					}
					
					ArrayPushString(g_aSounds, szSound)
					ArrayPushString(g_aNames, szName)
					g_iMaxSounds++
				}
			}
		}
		
		fclose(iFilePointer)
		
		if(!g_iMaxSounds)
			set_fail_state("No music files were added in the configuration file.")
	}
}

bool:IsValidSteam(id)
{
    new szAuthId[35]
    get_user_authid(id, szAuthId, charsmax(szAuthId))
    
    if(!equali(szAuthId, "STEAM_", 6) || equal(szAuthId, "STEAM_ID_LAN") || equal(szAuthId, "STEAM_ID_PENDING"))
        return false
    
    return true
}

get_sound_type(szSound[])
{
	switch(szSound[strlen(szSound) - 1])
	{
		case 'v', 'V': return TYPE_WAV
		case '3': return TYPE_MP3
	}
	
	return TYPE_INVALID
}

ColorChat(const id, const szInput[], any:...)
{
	new iPlayers[32], iCount = 1
	static szMessage[191]
	vformat(szMessage, charsmax(szMessage), szInput, 3)
	format(szMessage[0], charsmax(szMessage), "%s %s", g_szPrefix, szMessage)
	
	replace_all(szMessage, charsmax(szMessage), "!g", "^4")
	replace_all(szMessage, charsmax(szMessage), "!n", "^1")
	replace_all(szMessage, charsmax(szMessage), "!t", "^3")
	
	if(id)
		iPlayers[0] = id
	else
		get_players(iPlayers, iCount, "ch")
	
	for(new i, iPlayer; i < iCount; i++)
	{
		iPlayer = iPlayers[i]
		
		if(is_user_connected(iPlayer))
		{
			message_begin(MSG_ONE_UNRELIABLE, g_iSayText, _, iPlayer)
			write_byte(iPlayer)
			write_string(szMessage)
			message_end()
		}
	}
}
Add the songs like this in the configuration file:

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

misc/nameofsong.wav = David Guetta - Track Name
I didn't have a chance to test it, so let me know if there are any issues.

Аватар
tarsis
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 19 Дек 2018, 11:08

REMusic [Round End Music | End Round Sounds]

Мнение от tarsis » 19 Дек 2018, 16:43

the plugin compiles ok, but its not running, and i'm not getting any errors on log, this is my REmusic.ini

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

jaca_fm/ct01.mp3 = Wiz Khalifa - See You Again ft. Charlie Puth
jaca_fm/ct02.mp3 = Malik Mustache, N.E.O.N, Vinne - Rock U
jaca_fm/ct03.mp3 = Marshmello - Alone
jaca_fm/ct04.mp3 = Sick Individuals & Holl & Rush - Helix
jaca_fm/ct05.mp3 = The Chainsmokers & Coldplay - Something Just Like This
jaca_fm/tr01.mp3 = Dr. Dre Feat. Snoop Dogg - The Next Episode
jaca_fm/tr02.mp3 = Alok, Bruno Martini feat. Zeeba - Hear Me Now
jaca_fm/tr03.mp3 = Byob (Feat. Sevenn) - Alok
jaca_fm/tr04.mp3 = MC Neguinho do ITR e MC Digu - Forte Pra Dar Sorte
jaca_fm/tr05.mp3 = TC - Get Down Low
CZ Tutor Messages unknown cztutor.amxx running unknown unknown unknown crx_remusic.amxx error

this is strange

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

REMusic [Round End Music | End Round Sounds]

Мнение от OciXCrom » 19 Дек 2018, 21:15

You should get a full error when the server starts. Find it and copy it here. A common reason for this kind of error is compiling under a newer AMXX version than your server or forgetting to add the .amxx file in the plugins folder. Check the error to see what's going on exactly. My modifications can't cause this.

Аватар
tarsis
Извън линия
Foreigner
Foreigner
Мнения: 5
Регистриран на: 19 Дек 2018, 11:08

REMusic [Round End Music | End Round Sounds]

Мнение от tarsis » 19 Дек 2018, 22:40

unfortunally, i'm renting my servers and don't have access to the server console, so i can't see the error on loading, and i get nothing on logs, i compiled on the same version of the amxmodx installed on my server, the lastest amxmodx 1.9 package

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

REMusic [Round End Music | End Round Sounds]

Мнение от OciXCrom » 19 Дек 2018, 23:41

I edited the code. Try now.

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

Обратно към “Одобрени плъгини”

Кой е на линия

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