Cerere plugin sunet

Cereri de pluginuri noi, skinuri in CS, etc.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Stai..Ce?
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 03 Jun 2017, 18:56
Detinator Steam: Da
CS Status: N/A
Detinator server CS: FUN.LALEAGANE.RO
SteamID: jetski_fun
Fond eXtream: 0
Location: str. îngustă, nr. sub fustă.

10 Jul 2017, 14:58

Salut. Vreau un plugin care sa execute un sunet pus de mine in sound/misc. Ca sa fiu mai explicit despre ceea ce doresc :
- Cand schimb mapa acel sunet sa se activeze.
- Atentie, format-ul sunet-ului este .mp3.
RoyalServer 2
*Or!g!naL*
Fost moderator
Fost moderator
Posts: 0
Joined: 16 Feb 2014, 16:28
Detinator Steam: Nu
CS Status: N-avem!
Detinator server CS: Zm.Darkcs.ro
Reputatie: Fost moderator ajutator
Has thanked: 3 times
Been thanked: 1 time

10 Jul 2017, 19:34

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

new PLUGIN[]="Mapend Sounds"
new AUTHOR[]="ntfs"
new VERSION[]="1.33"
new soundfile[128]
new cached

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_cvar("mapend_sounds", VERSION, FCVAR_SERVER)
	set_task(1.0, "exec_sound", 0, "", 1, "d", 1)
	register_cvar("amx_mapend_sounds_advert", "1")
}

public plugin_precache()
{
	new txtlen
	new loop
	new line
	new config[64]
	get_configsdir(config, 63)
	format(config, 63, "%s/Mapend-Sounds.cfg", config)
	new lines = file_size(config, 1)	

	if (file_exists(config))
	{
		while(cached != 1 && loop < 10)		// run until a sound was found(cached),
		{ 					// or the maximum numbers of loops 
			line = random_num(0,lines)	// has been reached
			
			read_file(config,line,soundfile,128,txtlen)
			
			if(containi(soundfile,".wav") != -1)
			{
				if((file_exists(soundfile) == 1) && (equal(soundfile[0],";",1) != 1))
				{
					precache_generic(soundfile)
					server_print("[AMXX] Mapend-Sounds: Caching ^"%s^".", soundfile)
					cached = 1
				}
				else
				{
					server_print("[AMXX] Mapend-Sounds: Skipping ^"%s^".", soundfile)
				}
			}
			loop += 1
		}
	}
	else
	{
		write_file(config,"",-1)
	}
}

public exec_sound()
{
	if(cached == 1)
	{
		client_cmd(0, "spk %s", soundfile)
		server_print("[AMXX] Mapend-Sounds: Playing ^"%s^".", soundfile)
		if(get_cvar_num("amx_mapend_sounds_advert") == 1)
		{
			set_hudmessage(42, 42, 255, -1.0, 0.8, 0, 6.0, 12.0, 0.2, 0.2, -1)
			show_hudmessage(0, "- [AMXX] Mapend-Sounds: Playing Sound -")
			client_print(0, print_chat, "- [AMXX] Mapend-Sounds: Playing Sound -")
		}
	}
	else
	{
		server_print("[AMXX] Mapend-Sounds: No Soundfile!!!")
	}
}
Image
User avatar
Stai..Ce?
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 03 Jun 2017, 18:56
Detinator Steam: Da
CS Status: N/A
Detinator server CS: FUN.LALEAGANE.RO
SteamID: jetski_fun
Fond eXtream: 0
Location: str. îngustă, nr. sub fustă.

17 Jul 2017, 13:25

*Or!g!naL* wrote:
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

new PLUGIN[]="Mapend Sounds"
new AUTHOR[]="ntfs"
new VERSION[]="1.33"
new soundfile[128]
new cached

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_cvar("mapend_sounds", VERSION, FCVAR_SERVER)
	set_task(1.0, "exec_sound", 0, "", 1, "d", 1)
	register_cvar("amx_mapend_sounds_advert", "1")
}

public plugin_precache()
{
	new txtlen
	new loop
	new line
	new config[64]
	get_configsdir(config, 63)
	format(config, 63, "%s/Mapend-Sounds.cfg", config)
	new lines = file_size(config, 1)	

	if (file_exists(config))
	{
		while(cached != 1 && loop < 10)		// run until a sound was found(cached),
		{ 					// or the maximum numbers of loops 
			line = random_num(0,lines)	// has been reached
			
			read_file(config,line,soundfile,128,txtlen)
			
			if(containi(soundfile,".wav") != -1)
			{
				if((file_exists(soundfile) == 1) && (equal(soundfile[0],";",1) != 1))
				{
					precache_generic(soundfile)
					server_print("[AMXX] Mapend-Sounds: Caching ^"%s^".", soundfile)
					cached = 1
				}
				else
				{
					server_print("[AMXX] Mapend-Sounds: Skipping ^"%s^".", soundfile)
				}
			}
			loop += 1
		}
	}
	else
	{
		write_file(config,"",-1)
	}
}

public exec_sound()
{
	if(cached == 1)
	{
		client_cmd(0, "spk %s", soundfile)
		server_print("[AMXX] Mapend-Sounds: Playing ^"%s^".", soundfile)
		if(get_cvar_num("amx_mapend_sounds_advert") == 1)
		{
			set_hudmessage(42, 42, 255, -1.0, 0.8, 0, 6.0, 12.0, 0.2, 0.2, -1)
			show_hudmessage(0, "- [AMXX] Mapend-Sounds: Playing Sound -")
			client_print(0, print_chat, "- [AMXX] Mapend-Sounds: Playing Sound -")
		}
	}
	else
	{
		server_print("[AMXX] Mapend-Sounds: No Soundfile!!!")
	}
}
Edit: Nu merge.


Last bumped by Stai..Ce? on 17 Jul 2017, 13:25.
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests