Skocz do zawartości

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

Problem z tagiem eers


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Automatyk

    Profesjonalista

  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 29.11.2015 17:39

Czy może mi ktoś pomóc i zamienić tag amxx na mój własny np. cs-siwo ? Zmieniam w cvarach ustawienia aczkolwiek nadal jest amxx. Oto kod: 

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#include <dhudmessage>
#include <colorchat>

#define PLUGIN "EERS - Easy End Round Sounds"
#define VERSION "0.2"
#define AUTHOR "DarkGL"

enum ( *=2 ){
	INFORMATION_CENTER = 1,
	INFORMATION_HUD,
	INFORMATION_STATUSTEXT,
	INFORMATION_DHUD,
	INFORMATION_CHAT
}

new Array:ctSounds,
	Array:ttSounds;

new PrefixMessages[ 64 ];

new menuPlayList,
	menuRoundSound;

new pCvarPlayList,
	pCvarRoundSound,
	pCvarRandom;

new showFlags;

new bool:playSoundOn[ 33 ];

new maxPlayers;

new ttCurrentSong;
new ctCurrentSong;

new gmsgStatusText;

new pCvarHudColor,
	pCvarHudPosX,
	pCvarHudPosY;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);

	if( ArraySize( ttSounds ) - 1 >= 0 ){
		register_event( "SendAudio", "T_win" , "a", "2&%!MRAD_terwin");
	}

	if( ArraySize( ctSounds ) - 1 >= 0 ){
		register_event( "SendAudio", "CT_win", "a", "2&%!MRAD_ctwin");
	}
	
	new iValue = 0;

	if( ( iValue = get_cvar_num( "roundsound_information_show" ) ) > 0 ){
		set_task( float( iValue ) ,"information_show", .flags = "b" );
	}
	
	gmsgStatusText = get_user_msgid( "StatusText" );
	
	maxPlayers = get_maxplayers();
}

public plugin_end(){
	ArrayDestroy( ctSounds );
	ArrayDestroy( ttSounds );
}

public registerCvars(){
	pCvarRandom = register_cvar("roundsound_mode","0");
	
	register_cvar("roundsound_information_show","300");

	register_cvar("roundsound_tag","AMXX.PL");

	register_cvar("roundsound_information_play","d");
	
	register_cvar("roundsound_ct_path","misc/CT")
	register_cvar("roundsound_tt_path","misc/TT")

	pCvarPlayList = register_cvar("roundsound_playlist_on","1");
	pCvarRoundSound = register_cvar("roundsound_roundsound_on","1");

	pCvarHudColor	=	register_cvar( "roundsound_hud_color" , "0 255 42")

	pCvarHudPosX	=	register_cvar( "roundsound_hud_pos_x" , "-1.0" );
	pCvarHudPosY	=	register_cvar( "roundsound_hud_pos_y" , "0.2" );
}

public execCvars(){
	new szPathConfigFile[ 256 ],
		iLen = get_configsdir( szPathConfigFile,charsmax( szPathConfigFile ) );
	
	formatex( szPathConfigFile[ iLen ] , charsmax( szPathConfigFile ) - iLen , "/roundsound.cfg" );

	if( !file_exists( szPathConfigFile ) ){
		write_file( szPathConfigFile , "//tag widoczny przy komunikatach wysyłanych przez plugin" , -1 );
		write_file( szPathConfigFile , "roundsound_tag AMXX.PL" , -1 );
		write_file( szPathConfigFile , "//w jaki sposob ma wysylac informacje o granym utworze a - center b - hud c - status text d - dhud e - chat mozna laczyc np ab - pokaże w hudzie i center jeśli podamy nic nie wyświetli sie nigdzie" , -1 );
		write_file( szPathConfigFile , "roundsound_information_play d" , -1 );
		write_file( szPathConfigFile , "//jak czesto ma sie pojawiac info o dostepnych komendach ustawienie na 0 wyłącza pokazywanie informacji" , -1 );
		write_file( szPathConfigFile , "roundsound_information_show 300" , -1 );
		write_file( szPathConfigFile , "//sciezka do folderu z muzyka dla CT podajemy bez sound/ wazna jest wielkosc liter" , -1 );
		write_file( szPathConfigFile , "roundsound_ct_path misc/CT" , -1 );
		write_file( szPathConfigFile , "//sciezka do folderu z muzyka dla TT podajemy bez sound/ wazna jest wielkosc liter" , -1 );
		write_file( szPathConfigFile , "roundsound_tt_path misc/TT" , -1 );
		write_file( szPathConfigFile , "// 0 - nie mozna uzyc komendy /playlista 1 - mozna plugin sam generuje playliste 2 - mozna admin musi stworzyc playliste (folder configs pliki ctplaylist.txt i ttplaylist.txt)" , -1 );
		write_file( szPathConfigFile , "roundsound_playlist_on 1" , -1 );
		write_file( szPathConfigFile , "//czy mozna uzyc komendy /roundsound pozwalajace na graczowi na wylaczenie/wlaczenie dla siebie roundsounda" , -1 );
		write_file( szPathConfigFile , "roundsound_roundsound_on 1" , -1 );
		write_file( szPathConfigFile , "//ma odgrywac utwory po kolei czy losowo 0 - po kolei 1 - losowo" , -1 );
		write_file( szPathConfigFile , "roundsound_mode 0" , -1 );
		write_file( szPathConfigFile , "//kolor wiadomosci hud" , -1 );
		write_file( szPathConfigFile , "roundsound_hud_color ^"0 255 42^"" , -1 );
		write_file( szPathConfigFile , "//pozycja wiadomosci hud" , -1 );
		write_file( szPathConfigFile , "roundsound_hud_pos_x -1.0" , -1 );
		write_file( szPathConfigFile , "roundsound_hud_pos_y 0.2" , -1 );
	}
	
	server_cmd("exec ^"%s^"",szPathConfigFile );
	server_exec();
}


public plugin_cfg(){
	new flagsBuffer[ 33 ];

	get_cvar_string( "roundsound_information_play" , flagsBuffer, charsmax( flagsBuffer ) );

	get_cvar_string( "roundsound_tag", PrefixMessages , charsmax( PrefixMessages ) );

	showFlags	=	read_flags( flagsBuffer );
	
	if( get_pcvar_num( pCvarPlayList ) ){
		registerPlayListCommands();
		createPlayListMenu();
	}

	if( get_pcvar_num( pCvarRoundSound ) ){
		registerRoundSoundCommands();
		registerRoundSoundMenu();
	}
}

public client_connect( id ){
	playSoundOn[ id ] = true;
}

public roundsound_on( id ){
	menu_display( id , menuRoundSound );

	return PLUGIN_HANDLED;
}

public roundsound_handle( id , menu , item ){

	if( item == MENU_EXIT ){
		return PLUGIN_CONTINUE;
	}

	switch( item ){
		case 0:
		{
			ColorChat(id,GREEN,"[%s] Wlaczyles roundsounda",PrefixMessages)
			playSoundOn[id] = true;
		}
		case 1:
		{
			ColorChat(id,GREEN,"[%s] Wylaczyles roundsounda",PrefixMessages)
			playSoundOn[id] = false;
		}
	}

	return PLUGIN_CONTINUE;
}

public playlist_show(id){
	menu_display( id , menuPlayList );
	
	return PLUGIN_HANDLED;
}

public information_show(id){
	static send = 0;

	switch(send){
		case 0:
		{
			if( !get_pcvar_num( pCvarPlayList ) ) {
				if( get_pcvar_num( pCvarRoundSound ) ){
					ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",PrefixMessages)
				}
			}
			else
			{
				ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",PrefixMessages)
				send++;
			}
		}
		case 1:
		{
			send--;
			if( !get_pcvar_num( pCvarRoundSound ) ){
				if( get_pcvar_num( pCvarPlayList ) ){
					ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",PrefixMessages)
				}
			}
			else
			{
				ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",PrefixMessages)
			}
			
		}
	}
}

public playlist_show_handle( id , menu , item ){

	if( item == MENU_EXIT){
		return PLUGIN_CONTINUE;
	}
	
	new szConfDir[128];
	get_configsdir(szConfDir,charsmax(szConfDir));
	switch(item){
		case 0:
		{
			format(szConfDir,charsmax(szConfDir),"%s/ctplaylist.txt",szConfDir);
			show_motd(id,szConfDir,"PlayLista CT")
		}
		case 1:
		{
			format(szConfDir,charsmax(szConfDir),"%s/ttplaylist.txt",szConfDir);
			show_motd(id,szConfDir,"PlayLista TT")
		}
	}

	playlist_show( id );

	return PLUGIN_CONTINUE;
}

public T_win(){
	new szPath[256];
	
	if( get_pcvar_num( pCvarRandom ) ){
		ArrayGetString( ttSounds , random_num( 0 , ArraySize( ttSounds ) - 1 ),szPath, charsmax( szPath ) );
	}
	else{
		if( ttCurrentSong >= ArraySize( ttSounds ) - 1 ){
			ttCurrentSong = 0;
		}
		ArrayGetString( ttSounds , ttCurrentSong++ , szPath , charsmax( szPath ) );
	}
	
	playSound( szPath );
}

public CT_win(){
	new szPath[256];
	
	if( get_pcvar_num( pCvarRandom ) ){
		ArrayGetString( ctSounds,random_num( 0, ArraySize( ctSounds ) - 1 ),szPath, charsmax( szPath ) );
	}
	else{
		if( ctCurrentSong >= ArraySize( ctSounds ) - 1 ){
			ctCurrentSong = 0;
		}
	
		ArrayGetString( ctSounds , ctCurrentSong++ , szPath , charsmax( szPath ) );
	}

	playSound( szPath );
}

public registerPlayListCommands(){
	register_clcmd("say /playlist","playlist_show")
	register_clcmd("say playlist","playlist_show")
	register_clcmd("say_team /playlist","playlist_show")
	register_clcmd("say_team playlist","playlist_show")
	register_clcmd("say /playlista","playlist_show")
	register_clcmd("say playlista","playlist_show")
	register_clcmd("say_team /playlista","playlist_show")
	register_clcmd("say_team playlista","playlist_show")
}

public createPlayListMenu(){
	menuPlayList = menu_create( "Playlista" , "playlist_show_handle" );

	menu_additem( menuPlayList , "PlayLista CT" );
	menu_additem( menuPlayList , "PlayLista TT" );
	menu_setprop( menuPlayList , MPROP_EXITNAME , "Wyjscie" );
	menu_setprop( menuPlayList , MPROP_NUMBER_COLOR , "\r" );

	}

public registerRoundSoundCommands(){
	register_clcmd("say /roundsound","roundsound_on")
	register_clcmd("say roundsound","roundsound_on")
	register_clcmd("say_team /roundsound","roundsound_on")
	register_clcmd("say_team roundsound","roundsound_on")
}

public registerRoundSoundMenu(){
	new menuTitle[256];
	formatex( menuTitle,charsmax( menuTitle ), "[%s] Easy End Round Sound" , PrefixMessages );

	menuRoundSound = menu_create( menuTitle , "roundsound_handle" );
		
	menu_additem( menuRoundSound , "Wlacz roundsound" );
	menu_additem( menuRoundSound , "wyłącz roundsound" );

	menu_setprop( menuRoundSound , MPROP_EXITNAME , "Wyjscie" )
	menu_setprop( menuRoundSound , MPROP_NUMBER_COLOR , "\r" );
	
}

public loadCTSongs(){
	new szPath[ 256 ] ,
		szFullDir[ 256 ],
		szFile[ 256 ],
		szConfDir[ 256 ],
		szFullPath[ 256 ];

	if( get_pcvar_num( pCvarPlayList ) == 1 ){
		get_configsdir(szConfDir,charsmax(szConfDir));

		formatex( szConfDir[ strlen( szConfDir ) ],charsmax( szConfDir ) - strlen( szConfDir ),"/ctplaylist.txt");

		if(file_exists( szConfDir ) ){
			delete_file( szConfDir );
		}

		write_file(szConfDir,"<html><head><title>PlayLista CT</title></head><body bgcolor='black'><font color='white'>",-1)
	}

	get_cvar_string("roundsound_ct_path",szPath,charsmax(szPath))

	formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath)
	
	new dp = open_dir(szFullDir, szFile, charsmax(szFile));
	
	if( !dp ){
		log_amx("Brak folderu z muzyka dla ct: %s" , szFullDir );

		set_fail_state( "" );
	}

	while( next_file(dp, szFile, charsmax( szFile ) ) ){ 
			
		if( strlen( szFile ) < 5 ){
			continue;
		}

		if( !isValid( szFile ) ){

			log_amx( "Nie zaladowano: %s" , szFile );

			continue;
		}

		formatex( szFullPath , charsmax( szFullPath ) , "%s/%s" , szFullDir , szFile );

		isWav( szFile ) ? precache_sound( szFullPath[ 6 ] ) : precache_generic( szFullPath );

		ArrayPushString( ctSounds , szFullPath )

		log_amx("Zaladowano : %s", szFullPath );
		
		if( get_pcvar_num( pCvarPlayList ) == 1 ){
			clean_path( szFile );
			write_file( szConfDir , szFile );
			write_file( szConfDir , "<br />" );
		}
	}

	write_file( szConfDir , "</font></body></html>" , -1 )

	close_dir( dp );
}

public loadTTSongs(){
	new szPath[ 256 ] ,
		szFullDir[ 256 ],
		szFile[ 256 ],
		szConfDir[ 256 ],
		szFullPath[ 256 ];

	get_cvar_string( "roundsound_tt_path" ,szPath,charsmax(szPath))
	formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath);

	if(get_pcvar_num( pCvarPlayList ) == 1){

		get_configsdir(szConfDir,charsmax(szConfDir));

		formatex( szConfDir[ strlen( szConfDir ) ],charsmax( szConfDir ) - strlen( szConfDir ), "/ttplaylist.txt" , szConfDir );

		if(file_exists( szConfDir ) ){
			delete_file( szConfDir );
		}

		write_file(szConfDir,"<html><head><title>PlayLista TT</title></head><body bgcolor='black'><font color='white'>",-1)
	}
	
	new dp = open_dir(szFullDir, szFile, charsmax(szFile));

	if( !dp ){
		log_amx("Brak folderu z muzyka dla tt: %s", szFullDir )

		set_fail_state( "" );
	}

	while( next_file( dp , szFile, charsmax( szFile ) ) ){ 
		
		if( strlen( szFile ) < 5){
			continue;
		}
		
		if( !isValid( szFile ) ){

			log_amx( "Nie zaladowano: %s" , szFile );

			continue;
		}

		formatex(szFullPath,charsmax(szFullPath),"%s/%s",szFullDir,szFile)
		
		isWav( szFile ) ? precache_sound( szFullPath[ 6 ] ) : precache_generic( szFullPath );
		
		ArrayPushString( ttSounds , szFullPath )
		
		log_amx( "Zaladowano : %s" ,szFullPath);
		
		if( get_pcvar_num( pCvarPlayList ) == 1 ){
			clean_path( szFile );
			write_file( szConfDir , szFile );
			write_file( szConfDir , "<br />" );
		}
	}

	write_file( szConfDir , "</font></body></html>" , -1 );

	close_dir( dp );
}

public plugin_precache(){
	ctSounds = ArrayCreate( 256 , 1 );
	ttSounds = ArrayCreate( 256 , 1 );

	registerCvars();
	execCvars();

	loadCTSongs();
	loadTTSongs();

	return PLUGIN_CONTINUE;
}

playSound(file[]){
	
	new szCommand[ 256 ];

	formatex( szCommand , charsmax( szCommand ) , "%s%s^"",isWav(file) ? "spk ^"":"mp3 play ^"sound/",file[6] );

	for( new iPlayer = 1 ; iPlayer <= maxPlayers; iPlayer++){
		if( !is_user_connected( iPlayer ) || !playSoundOn[ iPlayer ] ){
			continue;
		}

		client_cmd( iPlayer , szCommand );
	}

	new szFile[ 256 ],
		textShow[ 256 ];
	
	remove_filepath( file , szFile , charsmax( szFile ) );
	clean_path( szFile );

	formatex( textShow , charsmax( textShow ) , "[%s] Obecnie Gramy %s" , PrefixMessages , szFile );

	new flagsShow = getFlags();

	if( flagsShow & INFORMATION_CENTER ){
		showCenter( textShow );
	}
	if( flagsShow & INFORMATION_HUD){
		showHud( textShow );
	}
	if( flagsShow & INFORMATION_STATUSTEXT){
		showStatusText( textShow );
	}
	if( flagsShow & INFORMATION_DHUD ){
		showDhud( textShow );
	}
	if( flagsShow & INFORMATION_CHAT ){
		showChat( textShow );
	}
}

public showCenter(szFile[]){
	for(new iPlayer = 1 ; iPlayer <= maxPlayers ; iPlayer++ ){
		if(!is_user_connected( iPlayer ) || !playSoundOn[ iPlayer ]){
			continue;
		}
		client_print( iPlayer , print_center , szFile );
	}
}

public showHud(szFile[]){
	new szColor[ 12 ], szRGB[ 3 ][ 4 ];
	
	get_pcvar_string( pCvarHudColor, szColor, charsmax( szColor ) );
	
	parse( szColor, szRGB[ 0 ], 3, szRGB[ 1 ], 3, szRGB[ 2 ], 3 );
	
	new iRed   = clamp( str_to_num( szRGB[ 0 ] ), 0, 255 ),
		iGreen = clamp( str_to_num( szRGB[ 1 ] ), 0, 255 ),
		iBlue  = clamp( str_to_num( szRGB[ 2 ] ), 0, 255 );

	for(new iPlayer = 1 ; iPlayer <= maxPlayers ; iPlayer++ ){
		if(!is_user_connected( iPlayer ) || !playSoundOn[ iPlayer ]){
			continue;
		}
		set_hudmessage( iRed , iGreen , iBlue, get_pcvar_float( pCvarHudPosX ), get_pcvar_float( pCvarHudPosY ) , 0, 6.0, 12.0);
		show_hudmessage( iPlayer , szFile)
	}
}

public showStatusText(szFile[]){
	for(new iPlayer = 1 ; iPlayer <= maxPlayers ; iPlayer++ ){
		if(!is_user_connected( iPlayer ) || !playSoundOn[ iPlayer ]){
			continue;
		}

		message_begin(MSG_ONE_UNRELIABLE, gmsgStatusText, {0,0,0}, iPlayer );
		write_byte(0)
		write_string(szFile)
		message_end() 
	}
}

public showDhud( szFile[] ){
	new szColor[ 12 ], szRGB[ 3 ][ 4 ];
	
	get_pcvar_string( pCvarHudColor, szColor, charsmax( szColor ) );
	
	parse( szColor, szRGB[ 0 ], 3, szRGB[ 1 ], 3, szRGB[ 2 ], 3 );
	
	new iRed   = clamp( str_to_num( szRGB[ 0 ] ), 0, 255 ),
		iGreen = clamp( str_to_num( szRGB[ 1 ] ), 0, 255 ),
		iBlue  = clamp( str_to_num( szRGB[ 2 ] ), 0, 255 );

	for(new iPlayer = 1 ; iPlayer <= maxPlayers ; iPlayer++ ){
		if(!is_user_connected( iPlayer ) || !playSoundOn[ iPlayer ]){
			continue;
		}
		
		set_dhudmessage( iRed , iGreen , iBlue , get_pcvar_float( pCvarHudPosX ), get_pcvar_float( pCvarHudPosY ) , 0, 6.0, 12.0 );
		show_dhudmessage( iPlayer , szFile );
	}
}

public showChat( szFile[] ){
	for(new iPlayer = 1 ; iPlayer <= maxPlayers ; iPlayer++ ){
		if(!is_user_connected( iPlayer ) || !playSoundOn[ iPlayer ]){
			continue;
		}
		
		client_print( iPlayer , print_chat,szFile );
	}
}


bool:isWav(file[]){
	new iSize = strlen( file ) - 4;

	if( iSize > 0 ){
		if( equali( file[ iSize ] , ".wav") ){
			return true;
		}
	}

	return false;
}

getFlags(){
	return showFlags;
}

bool:isValid(szFilename[]){
	new iSize = strlen( szFilename ) - 4;
	
	if(iSize > 0){
		if(equali(szFilename[iSize], ".mp3") ||  equali(szFilename[iSize], ".wav")){
			return true;
		}
	}

	return false;
}

clean_path(szFileName[]){
	szFileName[ strlen( szFileName ) - 4 ] = '^0';
}


  • +
  • -
  • 0




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

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