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
 

Wklejka 135462374128331 dodana przez k4x4z5, 04.12.2012 13:22
Typ:


135462374128331
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
 
#define PLUGIN "Easy End Round Sounds"
#define VERSION "0.1"
#define AUTHOR "DarkGL"
 
enum (+=200){
	TASK_SHOW=200,
	TASK_INFORMATION,
	TASK_TUT
}
 
#define INFORMATION_CENTER 1
#define INFORMATION_HUD 2
#define INFORMATION_STATUSTEXT 4
 
new Array:ct_sounds;
new Array:tt_sounds;
new bool:all_ok = true;
new TAG[64];
new pinf;
new menuplaylist;
new playlist
new roundsound;
new bool:play[33];
new g_max_players;
new plosowo;
new tt_ktora;
new ct_ktora;
new menuroundsound;
new gmsgStatusText;
 
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	if(!all_ok){
		return PLUGIN_CONTINUE;
	}
	register_event( "SendAudio", "T_win" , "a", "2&%!MRAD_terwin");
	register_event( "SendAudio", "CT_win", "a", "2&%!MRAD_ctwin");
 
	plosowo = register_cvar("roundsound_mode","0")
 
	new sinf = register_cvar("roundsound_information_show","300");
	if(get_pcvar_num(sinf)){
		set_task(float(get_pcvar_num(sinf)),"information_show",TASK_INFORMATION,_,_,"b")
	}
 
	gmsgStatusText = get_user_msgid("StatusText")
 
	g_max_players = get_maxplayers();
	return PLUGIN_CONTINUE;
}
 
public client_connect(id)
{
	play[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",TAG)
			play[id] = true;
		}
		case 1:
		{
			play[id] = false;
			ColorChat(id,GREEN,"[%s] Wylaczyles roundsounda",TAG)
		}
	}
	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(playlist)){
				if(get_pcvar_num(roundsound)){
					ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",TAG)
				}
			}
			else
			{
				ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",TAG)
				send++;
			}
		}
		case 1:
		{
			send--;
			if(!get_pcvar_num(roundsound)){
				if(get_pcvar_num(playlist)){
					ColorChat(0,TEAM_COLOR,"[%s] Jesli chcesz przejrzec playliste napisz na czacie /playlista",TAG)
				}
			}
			else
			{
				ColorChat(0,TEAM_COLOR,"[%s] W celu wlaczenia/wylaczenie roundsounda napisz na czacie /roundsound",TAG)
			}
 
		}
	}
}
 
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(){
	if(ArraySize(tt_sounds)-1 >= 0){
		new szPath[256];
		if(get_pcvar_num(plosowo)){
			ArrayGetString(tt_sounds,random_num(0,ArraySize(tt_sounds)-1),szPath,sizeof szPath)
		}
		else
		{
			if(tt_ktora>=ArraySize(tt_sounds)-1){
				tt_ktora = 0;
			}
			ArrayGetString(tt_sounds,tt_ktora++,szPath,charsmax(szPath))
		}
		play_sound(szPath)
	}
}
 
public CT_win(){
	if(ArraySize(ct_sounds)-1 >= 0){
		new szPath[256];
		if(get_pcvar_num(plosowo)){
			ArrayGetString(ct_sounds,random_num(0,ArraySize(ct_sounds)-1),szPath,sizeof szPath)
		}
		else
		{
			if(ct_ktora>=ArraySize(tt_sounds)-1){
				ct_ktora = 0;
			}
			ArrayGetString(ct_sounds,ct_ktora++,szPath,charsmax(szPath))
		}
		play_sound(szPath)
	}
}
 
public plugin_precache(){
	ct_sounds = ArrayCreate(256,1)
	tt_sounds = ArrayCreate(256,1)
	new ptag = register_cvar("roundsound_tag","AMXX.PL");
	pinf = register_cvar("roundsound_information_play","abc"); // a - center b - hud c - statustext
	new ct = register_cvar("roundsound_ct_path","komandosi_jail/jb_ct_grudzien")
	new tt = register_cvar("roundsound_tt_path","komandosi_jail/jb_tt_grudzien")
	playlist = register_cvar("roundsound_playlist_on","1");
	roundsound = register_cvar("roundsound_roundsound_on","1");
	get_pcvar_string(ptag,TAG,charsmax(TAG))
	if(get_pcvar_num(playlist)){
		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")
		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")
	}
	if(get_pcvar_num(roundsound)){
		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")
		new formats[256];
		formatex(formats,charsmax(formats),"[%s] Easy End Round Sound",TAG);
		menuroundsound = menu_create(formats,"roundsound_handle");
		menu_additem(menuroundsound,"Wlacz roundsound")
		menu_additem(menuroundsound,"Wylacz roundsound")
		menu_setprop(menuroundsound,MPROP_EXITNAME,"Wyjscie")
		menu_setprop(menuroundsound,MPROP_NUMBER_COLOR,"\r")
	}
	new bool:track = false
	new szPath[128],szFullPath[256],szFullDir[256],szConfDir[128]
	new szFile[64];
	if(get_pcvar_num(playlist) == 1){
		get_configsdir(szConfDir,charsmax(szConfDir));
		format(szConfDir,charsmax(szConfDir),"%s/ctplaylist.txt",szConfDir);
		if(file_exists(szConfDir)){
			delete_file(szConfDir);
		}
	}
	get_pcvar_string(ct,szPath,charsmax(szPath))
	formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath)
	new dp = open_dir(szFullDir, szFile, charsmax(szFile));
	if(dp){
		if(get_pcvar_num(playlist) == 1){
			write_file(szConfDir,"<html><head><title>PlayLista CT</title></head><body bgcolor='black'><font color='white'>",-1)
		}
		while(next_file(dp, szFile, charsmax(szFile))){ 
			if(strlen(szFile) < 5){
				continue;
			}
			if(is_valid(szFile) ){
				track = true;
				formatex(szFullPath,charsmax(szFullPath),"%s/%s",szFullDir,szFile)
				is_wav(szFile) ? precache_sound(szFullPath[6]) : precache_generic(szFullPath);
				ArrayPushString(ct_sounds,szFullPath)
				log_amx("Zaladowano : %s",szFullPath);
				if(get_pcvar_num(playlist) == 1){
					clean_path(szFile)
					write_file(szConfDir,szFile)
					write_file(szConfDir,"<br />")
				}
			}
		}
		write_file(szConfDir,"</font></body></html>",-1)
	}
	else
	{
		all_ok = false;
		log_amx("Brak folderu z muzyka dla ct")
		log_amx("%s",szPath)
 
	}
	close_dir(dp);
	if(!track){
		all_ok = false;
		return PLUGIN_CONTINUE;
	}
	track = false;
	get_pcvar_string(tt,szPath,charsmax(szPath))
	formatex(szFullDir,charsmax(szFullDir),"sound/%s",szPath)
	if(get_pcvar_num(playlist) == 1){
		get_configsdir(szConfDir,charsmax(szConfDir));
		format(szConfDir,charsmax(szConfDir),"%s/ttplaylist.txt",szConfDir);
		if(file_exists(szConfDir)){
			delete_file(szConfDir);
		}
	}
	dp = open_dir(szFullDir, szFile, charsmax(szFile));
	if(dp){
		if(get_pcvar_num(playlist) == 1){
			write_file(szConfDir,"<html><head><title>PlayLista TT</title></head><body bgcolor='black'><font color='white'>",-1)
		}
		while(next_file(dp, szFile, charsmax(szFile))){ 
			if(strlen(szFile) < 5){
				continue;
			}
			if(is_valid(szFile) ){
				track = true;
				formatex(szFullPath,charsmax(szFullPath),"%s/%s",szFullDir,szFile)
				is_wav(szFile) ? precache_sound(szFullPath[6]) : precache_generic(szFullPath);
				ArrayPushString(tt_sounds,szFullPath)
				log_amx("Zaladowano : %s",szFullPath);
				if(get_pcvar_num(playlist) == 1){
					clean_path(szFile)
					write_file(szConfDir,szFile)
					write_file(szConfDir,"<br />")
				}
			}
		}
		write_file(szConfDir,"</font></body></html>",-1)
	}
	else
	{
		all_ok = false;
		log_amx("Brak folderu z muzyka dla tt")
 
	}
	close_dir(dp);
	if(!track){
		all_ok = false;
		return PLUGIN_CONTINUE;
	}
	return PLUGIN_CONTINUE;
}
 
play_sound(file[]){
	for(new i = 1;i<=g_max_players;i++){
		if(!is_user_connected(i) || !play[i]){
			continue;
		}
		client_cmd(i,"%s%s^"",is_wav(file) ? "spk ^"":"mp3 play ^"sound/",file[6])
	}
	new szFile[256]
	remove_filepath(file,szFile,charsmax(szFile))
	clean_path(szFile)
	new formats[256];
	formatex(formats,charsmax(formats),"[%s] Obecnie Gramy %s",TAG,szFile)
	if(getFlags()&INFORMATION_CENTER){
		set_task(1.0,"show_center",TASK_SHOW,formats,sizeof(formats))
	}
	if(getFlags()&INFORMATION_HUD){
		show_hud(formats);
	}
	if(getFlags()&INFORMATION_STATUSTEXT){
		show_statustext(formats);
	}
}
 
public show_center(szFile[]){
	for(new i = 1;i<=g_max_players;i++){
		if(!is_user_connected(i) || !play[i]){
			continue;
		}
		client_print(i,print_center,szFile)
	}
}
 
public show_hud(szFile[]){
	for(new i = 1;i<=g_max_players;i++){
		if(!is_user_connected(i) || !play[i]){
			continue;
		}
		set_hudmessage(0, 255, 42, -1.0, 0.2, 0, 6.0, 12.0)
		show_hudmessage(i, szFile)
	}
}
 
public show_statustext(szFile[]){
	for(new i = 1;i<=g_max_players;i++){
		if(!is_user_connected(i) || !play[i]){
			continue;
		}
		message_begin(MSG_ONE_UNRELIABLE, gmsgStatusText, {0,0,0}, i)
		write_byte(0)
		write_string(szFile)
		message_end() 
	}
}
 
 
bool:is_wav(file[]){
	new iSize = strlen(file) - 4;
	if(iSize > 0 ){
		if(equali(file[iSize], ".wav")){
			return true;
		}
	}
	return false;
}
 
getFlags()
{
static flags[27]
 
get_pcvar_string(pinf, flags, 26)
 
return read_flags(flags)
}
 
bool:is_valid(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[]){
for(new iPos = strlen(szFileName)-4;iPos < strlen(szFileName);iPos++){
	szFileName[iPos] = ' ';
}
}