Page 1 of 1

Re: Help me in this request please

Posted: 07 Nov 2018, 09:26
by ZombieEscape
Jack GamePlay wrote: 5 years ago
ZombieEscape wrote: 5 years ago Hello,
I mean can you add for me Unstuck in ze_main_menu plugin that you added in your Knife Menu plugin?
Because i failed to do it many times, hope you do it please i really in need it..
Thanks man.
Provide the code you edited.
Hey,
https://www.dropbox.com/s/4ttjx8vfrob7s ... u.sma?dl=0
here is it, and thanks a lot

Re: Help me in this request please

Posted: 07 Nov 2018, 11:53
by Night Fury
ZombieEscape wrote: 5 years ago Hey,
https://www.dropbox.com/s/4ttjx8vfrob7s ... u.sma?dl=0
here is it, and thanks a lot
Provide your code directly next time.
Try:

Code: Select all

#include <zombie_escape>

native ze_open_knife_menu(id)

// Keys
const OFFSET_CSMENUCODE = 205
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

public plugin_init()
{
	register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
	
	// Commands
	register_clcmd("chooseteam", "Cmd_ChooseTeam")
	register_clcmd("say /ze", "Cmd_ChooseTeam")
	register_clcmd("say_team /ze", "Cmd_ChooseTeam")
	
	// Register Menus
	register_menu("Main Menu", KEYSMENU, "Main_Menu")
}

public Cmd_ChooseTeam(id)
{
	if (!is_user_connected(id))
		return PLUGIN_CONTINUE;
	
	if (get_member(id, m_iTeam) == TEAM_TERRORIST || get_member(id, m_iTeam) == TEAM_CT)
	{
		Show_Menu_Main(id)
		return PLUGIN_HANDLED // Kill the Choose Team Command
	}
	
	// Player in Spec? Allow him to open choose team menu so he can join
	return PLUGIN_CONTINUE
}

// Main Menu
public Show_Menu_Main(id)
{
	static szMenu[250]
	new iLen
    
	// Title
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L^n^n", id, "MAIN_MENU_TITLE")
	
	// 1. Buy Weapons
	if (!ze_is_auto_buy_enabled(id)) // AutoBuy not enabled - normal case
	{
		if (is_user_alive(id))
		{
			iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY")
		}
		else
		{
			iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1. %L^n", id, "MENU_WEAPONBUY")
		}
	}
	else
	{
		// Auto-Buy enabled - Re-enable case
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
	}
	
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r %L^n", id, "MENU_EXTRABUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
	}
	
	// 3. Knife menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r Knife menu^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Knife menu^n")
	}

		// 3. Knife menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\rUnstuck^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Unstuck^n")
	}
    
	// 0. Exit
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
    
	// Fix for AMXX custom menus
	set_pdata_int(id, OFFSET_CSMENUCODE, 0)
	show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
}

// Main Menu
public Main_Menu(id, key)
{
	// Player disconnected?
	if (!is_user_connected(id))
		return PLUGIN_HANDLED
    
	switch (key)
	{
		case 0: // Buy Weapons
		{
			if (!ze_is_auto_buy_enabled(id))
			{
				ze_show_weapon_menu(id)
			}
			else
			{
				ze_disable_auto_buy(id)
				Show_Menu_Main(id)
			}
		}
		case 1: // Extra Items
		{
			if (is_user_alive(id))
			{
				ze_show_items_menu(id)
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
		case 2: // Knife menu
		{
			if (is_user_alive(id))
			{
				ze_open_knife_menu(id)
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
		case 2: // Knife menu
		{
			if (is_user_alive(id))
			{
				client_cmd(id, "say /unstuck")
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
	}
	return PLUGIN_HANDLED
}

Re: Help me in this request please

Posted: 07 Nov 2018, 13:36
by ZombieEscape
Jack GamePlay wrote: 5 years ago
ZombieEscape wrote: 5 years ago Hey,
https://www.dropbox.com/s/4ttjx8vfrob7s ... u.sma?dl=0
here is it, and thanks a lot
Provide your code directly next time.
Try:

Code: Select all

#include <zombie_escape>

native ze_open_knife_menu(id)

// Keys
const OFFSET_CSMENUCODE = 205
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

public plugin_init()
{
	register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
	
	// Commands
	register_clcmd("chooseteam", "Cmd_ChooseTeam")
	register_clcmd("say /ze", "Cmd_ChooseTeam")
	register_clcmd("say_team /ze", "Cmd_ChooseTeam")
	
	// Register Menus
	register_menu("Main Menu", KEYSMENU, "Main_Menu")
}

public Cmd_ChooseTeam(id)
{
	if (!is_user_connected(id))
		return PLUGIN_CONTINUE;
	
	if (get_member(id, m_iTeam) == TEAM_TERRORIST || get_member(id, m_iTeam) == TEAM_CT)
	{
		Show_Menu_Main(id)
		return PLUGIN_HANDLED // Kill the Choose Team Command
	}
	
	// Player in Spec? Allow him to open choose team menu so he can join
	return PLUGIN_CONTINUE
}

// Main Menu
public Show_Menu_Main(id)
{
	static szMenu[250]
	new iLen
    
	// Title
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L^n^n", id, "MAIN_MENU_TITLE")
	
	// 1. Buy Weapons
	if (!ze_is_auto_buy_enabled(id)) // AutoBuy not enabled - normal case
	{
		if (is_user_alive(id))
		{
			iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY")
		}
		else
		{
			iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1. %L^n", id, "MENU_WEAPONBUY")
		}
	}
	else
	{
		// Auto-Buy enabled - Re-enable case
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
	}
	
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r %L^n", id, "MENU_EXTRABUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
	}
	
	// 3. Knife menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r Knife menu^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Knife menu^n")
	}

		// 3. Knife menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\rUnstuck^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Unstuck^n")
	}
    
	// 0. Exit
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
    
	// Fix for AMXX custom menus
	set_pdata_int(id, OFFSET_CSMENUCODE, 0)
	show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
}

// Main Menu
public Main_Menu(id, key)
{
	// Player disconnected?
	if (!is_user_connected(id))
		return PLUGIN_HANDLED
    
	switch (key)
	{
		case 0: // Buy Weapons
		{
			if (!ze_is_auto_buy_enabled(id))
			{
				ze_show_weapon_menu(id)
			}
			else
			{
				ze_disable_auto_buy(id)
				Show_Menu_Main(id)
			}
		}
		case 1: // Extra Items
		{
			if (is_user_alive(id))
			{
				ze_show_items_menu(id)
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
		case 2: // Knife menu
		{
			if (is_user_alive(id))
			{
				ze_open_knife_menu(id)
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
		case 2: // Knife menu
		{
			if (is_user_alive(id))
			{
				client_cmd(id, "say /unstuck")
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
	}
	return PLUGIN_HANDLED
}
Hello,
Your code is not compiling you made the new case with same number?
Also there is mistakes on it i corrected it, anyway fixed here is it the working code,
  1. #include <zombie_escape>
  2.  
  3. native ze_open_knife_menu(id)
  4.  
  5. // Keys
  6. const OFFSET_CSMENUCODE = 205
  7. 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
  8.  
  9. public plugin_init()
  10. {
  11.     register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
  12.    
  13.     // Commands
  14.     register_clcmd("chooseteam", "Cmd_ChooseTeam")
  15.     register_clcmd("say /ze", "Cmd_ChooseTeam")
  16.     register_clcmd("say_team /ze", "Cmd_ChooseTeam")
  17.    
  18.     // Register Menus
  19.     register_menu("Main Menu", KEYSMENU, "Main_Menu")
  20. }
  21.  
  22. public Cmd_ChooseTeam(id)
  23. {
  24.     if (!is_user_connected(id))
  25.         return PLUGIN_CONTINUE;
  26.    
  27.     if (get_member(id, m_iTeam) == TEAM_TERRORIST || get_member(id, m_iTeam) == TEAM_CT)
  28.     {
  29.         Show_Menu_Main(id)
  30.         return PLUGIN_HANDLED // Kill the Choose Team Command
  31.     }
  32.    
  33.     // Player in Spec? Allow him to open choose team menu so he can join
  34.     return PLUGIN_CONTINUE
  35. }
  36.  
  37. // Main Menu
  38. public Show_Menu_Main(id)
  39. {
  40.     static szMenu[250]
  41.     new iLen
  42.    
  43.     // Title
  44.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L^n^n", id, "MAIN_MENU_TITLE")
  45.    
  46.     // 1. Buy Weapons
  47.     if (!ze_is_auto_buy_enabled(id)) // AutoBuy not enabled - normal case
  48.     {
  49.         if (is_user_alive(id))
  50.         {
  51.             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY")
  52.         }
  53.         else
  54.         {
  55.             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1. %L^n", id, "MENU_WEAPONBUY")
  56.         }
  57.     }
  58.     else
  59.     {
  60.         // Auto-Buy enabled - Re-enable case
  61.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
  62.     }
  63.    
  64.     // 2. Extra Items
  65.     if (is_user_alive(id))
  66.     {
  67.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r %L^n", id, "MENU_EXTRABUY")
  68.     }
  69.     else
  70.     {
  71.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
  72.     }
  73.    
  74.     // 3. Knife menu
  75.     if (is_user_alive(id))
  76.     {
  77.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r Knife menu^n")
  78.     }
  79.     else
  80.     {
  81.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Knife menu^n")
  82.     }
  83.  
  84.         // 4. Unstuck
  85.     if (is_user_alive(id))
  86.     {
  87.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w4.\r Unstuck^n")
  88.     }
  89.     else
  90.     {
  91.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d4. Unstuck^n")
  92.     }
  93.    
  94.     // 0. Exit
  95.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
  96.    
  97.     // Fix for AMXX custom menus
  98.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  99.     show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
  100. }
  101.  
  102. // Main Menu
  103. public Main_Menu(id, key)
  104. {
  105.     // Player disconnected?
  106.     if (!is_user_connected(id))
  107.         return PLUGIN_HANDLED
  108.    
  109.     switch (key)
  110.     {
  111.         case 0: // Buy Weapons
  112.         {
  113.             if (!ze_is_auto_buy_enabled(id))
  114.             {
  115.                 ze_show_weapon_menu(id)
  116.             }
  117.             else
  118.             {
  119.                 ze_disable_auto_buy(id)
  120.                 Show_Menu_Main(id)
  121.             }
  122.         }
  123.         case 1: // Extra Items
  124.         {
  125.             if (is_user_alive(id))
  126.             {
  127.                 ze_show_items_menu(id)
  128.             }
  129.             else
  130.             {
  131.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  132.             }
  133.         }
  134.         case 2: // Knife menu
  135.         {
  136.             if (is_user_alive(id))
  137.             {
  138.                 ze_open_knife_menu(id)
  139.             }
  140.             else
  141.             {
  142.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  143.             }
  144.         }
  145.         case 3: // Unstuck
  146.         {
  147.             if (is_user_alive(id))
  148.             {
  149.                 client_cmd(id, "say /unstuck")
  150.             }
  151.             else
  152.             {
  153.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  154.             }
  155.         }
  156.     }
  157.     return PLUGIN_HANDLED
  158. }
Now i will thank you only for showing me the method and i will continue the rest, Thanks a lot!