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 1ov1qdv7molh7 dodana przez dasiek, 16.08.2013 20:05
Typ:



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.
/*================================================================================
 
	----------------------
	-*- [ZP] Main Menu -*-
	----------------------
 
	This plugin is part of Zombie Plague Mod and is distributed under the
	terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
 
================================================================================*/
 
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define LIBRARY_BUYMENUS "zp50_buy_menus"
#include <zp50_buy_menus>
#define LIBRARY_ZOMBIECLASSES "zp50_class_zombie"
#include <zp50_class_zombie>
#define LIBRARY_HUMANCLASSES "zp50_class_human"
#include <zp50_class_human>
#define LIBRARY_ITEMS "zp50_items"
#include <zp50_items>
#define LIBRARY_ADMIN_MENU "zp50_admin_menu"
#include <zp50_admin_menu>
#include <zp50_colorchat>
 
#define TASK_WELCOMEMSG 100
 
// CS Player PData Offsets (win32)
const OFFSET_CSMENUCODE = 205
 
// Menu keys
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
 
#define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
#define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
#define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
#define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))
 
new g_ChooseTeamOverrideActive
 
new cvar_buy_custom_primary, cvar_buy_custom_secondary, cvar_buy_custom_grenades
 
public plugin_init()
{
	register_plugin("[ZP] Main Menu", ZP_VERSION_STRING, "ZP Dev Team")
 
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
 
	register_clcmd("chooseteam", "clcmd_chooseteam")
 
	register_clcmd("say /zpmenu", "clcmd_zpmenu")
	register_clcmd("say zpmenu", "clcmd_zpmenu")
 
	// Menus
	register_menu("Main Menu", KEYSMENU, "menu_main")
}
 
public plugin_natives()
{
	set_module_filter("module_filter")
	set_native_filter("native_filter")
}
public module_filter(const module[])
{
	if (equal(module, LIBRARY_BUYMENUS) || equal(module, LIBRARY_ZOMBIECLASSES) || equal(module, LIBRARY_HUMANCLASSES) || equal(module, LIBRARY_ITEMS) || equal(module, LIBRARY_ADMIN_MENU))
		return PLUGIN_HANDLED;
 
	return PLUGIN_CONTINUE;
}
public native_filter(const name[], index, trap)
{
	if (!trap)
		return PLUGIN_HANDLED;
 
	return PLUGIN_CONTINUE;
}
 
public plugin_cfg()
{
	cvar_buy_custom_primary = get_cvar_pointer("zp_buy_custom_primary")
	cvar_buy_custom_secondary = get_cvar_pointer("zp_buy_custom_secondary")
	cvar_buy_custom_grenades = get_cvar_pointer("zp_buy_custom_grenades")
}
 
// Event Round Start
public event_round_start()
{
	// Show main menu message
	remove_task(TASK_WELCOMEMSG)
	set_task(2.0, "task_welcome_msg", TASK_WELCOMEMSG)
}
 
// Welcome Message Task
public task_welcome_msg()
{
	zp_colored_print(0, "^x04Ice-Killers.eu^x01", ZP_VERSION_STR_LONG)
	zp_colored_print(0, "%L", LANG_PLAYER, "NOTICE_INFO1")
}
 
public clcmd_chooseteam(id)
{
	if (flag_get(g_ChooseTeamOverrideActive, id))
	{
		show_menu_main(id)
		return PLUGIN_HANDLED;
	}
 
	flag_set(g_ChooseTeamOverrideActive, id)
	return PLUGIN_CONTINUE;
}
 
public clcmd_zpmenu(id)
{
	show_menu_main(id)
}
 
public client_putinserver(id)
{
	flag_set(g_ChooseTeamOverrideActive, id)
}
 
// Main Menu
show_menu_main(id)
{
	static menu[250]
	new len
 
	// Title
	len += formatex(menu[len], charsmax(menu) - len, "yIce-Killers.eu^n^n", ZP_VERSION_STR_LONG)
 
	// 1. Buy menu
	if (LibraryExists(LIBRARY_BUYMENUS, LibType_Library) && (get_pcvar_num(cvar_buy_custom_primary)
	|| get_pcvar_num(cvar_buy_custom_secondary) || get_pcvar_num(cvar_buy_custom_grenades)) && is_user_alive(id))
		len += formatex(menu[len], charsmax(menu) - len, "r1.w %L^n", id, "MENU_BUY")
	else
		len += formatex(menu[len], charsmax(menu) - len, "d1. %L^n", id, "MENU_BUY")
 
	// 2. Extra Items
	if (LibraryExists(LIBRARY_ITEMS, LibType_Library) && is_user_alive(id))
		len += formatex(menu[len], charsmax(menu) - len, "r2.w %L^n", id, "MENU_EXTRABUY")
	else
		len += formatex(menu[len], charsmax(menu) - len, "d2. %L^n", id, "MENU_EXTRABUY")
 
	// 3. Zombie class
	if (LibraryExists(LIBRARY_ZOMBIECLASSES, LibType_Library) && zp_class_zombie_get_count() > 1)
		len += formatex(menu[len], charsmax(menu) - len, "r3.w %L^n", id, "MENU_ZCLASS")
	else
		len += formatex(menu[len], charsmax(menu) - len, "d3. %L^n", id, "MENU_ZCLASS")
 
	// 4. Human class
	if (LibraryExists(LIBRARY_HUMANCLASSES, LibType_Library) && zp_class_human_get_count() > 1)
		len += formatex(menu[len], charsmax(menu) - len, "r4.w %L^n", id, "MENU_HCLASS")
	else
		len += formatex(menu[len], charsmax(menu) - len, "d4. %L^n", id, "MENU_HCLASS")
 
	// 5. Help
	len += formatex(menu[len], charsmax(menu) - len, "r5.w %L^n^n", id, "MENU_INFO")
 
	// 7. Choose Team
	len += formatex(menu[len], charsmax(menu) - len, "r7.w %L^n^n", id, "MENU_CHOOSE_TEAM")
 
	// 9. Admin menu
	if (LibraryExists(LIBRARY_ADMIN_MENU, LibType_Library) && is_user_admin(id))
		len += formatex(menu[len], charsmax(menu) - len, "r9.w %L", id, "MENU_ADMIN")
	else
		len += formatex(menu[len], charsmax(menu) - len, "d9. %L", id, "MENU_ADMIN")
 
	// 0. Exit
	len += formatex(menu[len], charsmax(menu) - len, "^n^nr0.w %L", id, "MENU_EXIT")
 
	// Fix for AMXX custom menus
	set_pdata_int(id, OFFSET_CSMENUCODE, 0)
	show_menu(id, KEYSMENU, menu, -1, "Main Menu")
}
 
// Main Menu
public menu_main(id, key)
{
	// Player disconnected?
	if (!is_user_connected(id))
		return PLUGIN_HANDLED;
 
	switch (key)
	{
		case 0: // Buy Menu
		{
			// Custom buy menus enabled?
			if (LibraryExists(LIBRARY_BUYMENUS, LibType_Library) && (get_pcvar_num(cvar_buy_custom_primary)
			|| get_pcvar_num(cvar_buy_custom_secondary) || get_pcvar_num(cvar_buy_custom_grenades)))
			{
				// Check whether the player is able to buy anything
				if (is_user_alive(id))
					zp_buy_menus_show(id)
				else
					zp_colored_print(id, "%L", id, "CANT_BUY_WEAPONS_DEAD")
			}
			else
				zp_colored_print(id, "%L", id, "CUSTOM_BUY_DISABLED")
		}
		case 1: // Extra Items
		{
			// Items enabled?
			if (LibraryExists(LIBRARY_ITEMS, LibType_Library))
			{
				// Check whether the player is able to buy anything
				if (is_user_alive(id))
					zp_items_show_menu(id)
				else
					zp_colored_print(id, "%L", id, "CANT_BUY_ITEMS_DEAD")
			}
			else
				zp_colored_print(id, "%L", id, "CMD_NOT_EXTRAS")
		}
		case 2: // Zombie Classes
		{
			if (LibraryExists(LIBRARY_ZOMBIECLASSES, LibType_Library) && zp_class_zombie_get_count() > 1)
				zp_class_zombie_show_menu(id)
			else
				zp_colored_print(id, "%L", id, "CMD_NOT_ZCLASSES")
		}
		case 3: // Human Classes
		{
			if (LibraryExists(LIBRARY_HUMANCLASSES, LibType_Library) && zp_class_human_get_count() > 1)
				zp_class_human_show_menu(id)
			else
				zp_colored_print(id, "%L", id, "CMD_NOT_HCLASSES")
		}
		case 4: // Help Menu
		{
			show_help(id)
		}
		case 6: // Menu override
		{
			flag_unset(g_ChooseTeamOverrideActive, id)
			client_cmd(id, "chooseteam")
		}
		case 8: // Admin Menu
		{
			if (LibraryExists(LIBRARY_ADMIN_MENU, LibType_Library) && is_user_admin(id))
				zp_admin_menu_show(id)
			else
				zp_colored_print(id, "%L", id, "NO_ADMIN_MENU")
		}
	}
 
	return PLUGIN_HANDLED;
}
 
// Help MOTD
show_help(id)
{
	static motd[1024]
	new len
 
	len += formatex(motd[len], charsmax(motd) - len, "%L", id, "MOTD_INFO11", "Ice-Killers.eu", ZP_VERSION_STR_LONG, "ZP Dev Team")
	len += formatex(motd[len], charsmax(motd) - len, "%L", id, "MOTD_INFO12")
 
	show_motd(id, motd)
}

Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011