Solved Main Menu Compilation Error.

Coding Help/Re-API Supported
Post Reply
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

Main Menu Compilation Error.

#1

Post by Spir0x » 5 years ago

hello all i've coded my own main menu with latest update ze v1.3.
it give some errors please fix it with me.

code:

Code: Select all

#include <ze_vip>
#include <ze_unstuck>

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 /zemenu", "Cmd_ChooseTeam")
	register_clcmd("say_team /zemenu", "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, "\y1.\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, "\y1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
	}
	
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y2. \r%L^n", id, "MENU_EXTRABUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
	}
    
	// 3. Unstuck
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y3. \r%L^n^n", id, "MENU_UNSTUCK")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. %L^n^n", id, "MENU_UNSTUCK")
	}
	
	// 4. Sound Menu
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y4. \rSound Menu^n")
	
	// 5. Camer View
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y5. \rCamera View^n")

	// 6. Daily Golds
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y6. \rDaily Golds^n^n")
	
	// 7. Random Prizes
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y7. \rRandom Prizes^n")
	
	// 8. Knife Menu
	if (ze_get_vip_flags(id) & VIP_A)
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y8. \rKnife Menu \y[\rVIP\y]^n^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d8. Knife Menu [\rVIP\d]^n^n")
	}
	
	// 9. Admin Menu
	if (get_user_flags(id) & ADMIN_KICK)
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y9. \rAdmin Menu^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d9. Admin Menu^n")
	}
	
	// 0. Exit
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\y0.\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: // Unstuck
		{
			if (is_user_alive(id))
			{
				client_cmd(id, "say /unstuck")
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_UNSTUCK")
			}
		}
		case 3: // Sound Menu
		{
			ze_show_sound_menu(id)
		}
		case 4: // Camera View
		{
			client_cmd(id, "say /cam")
		}
		case 5: // Daily Golds
		{
			client_cmd(id, "say /get")
		}
		case 6: // Random Prizes
		{
			client_cmd(id, "say /prize")
		}
		case 7: // Knife Menu 
		{
			if (ze_get_vip_flags(id))
				ze_open_knife_menu(id)
			else
				ze_colored_print(id, "!tYou are not !gVIP!y.")
		}
		case 8: // Admin Menu
		{
			if (get_user_flags(id) & ADMIN_KICK)
			{
				client_cmd(id, "amxmodmenu")
			}
			else
			{
				ze_colored_print(id, "!tYou are not !gAdmin!y.")
			}
		}
	}
	return PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 5 years ago

Bro post your old one, and tell us what special things you did so we copy to 1.3
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#3

Post by Spir0x » 5 years ago

I juste recoded it. i think you have added new case of re/enable the weapons menu that's it no thing new.

My old main menu:

Code: Select all

#include <ze_vip>
#include <ze_unstuck>

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 /zemenu", "Cmd_ChooseTeam")
	register_clcmd("say_team /zemenu", "Cmd_ChooseTeam")
	
	// Register Menus
	register_menu("Main Menu", KEYSMENU, "Main_Menu")
}

public Cmd_ChooseTeam(id)
{
	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 (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y1. \r%L^n", id, "MENU_WEAPONBUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1. %L^n", id, "MENU_WEAPONBUY")
	}
	
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y2. \r%L^n", id, "MENU_EXTRABUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
	}
    
	// 3. Unstuck
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y3. \r%L^n^n", id, "MENU_UNSTUCK")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. %L^n^n", id, "MENU_UNSTUCK")
	}
	
	// 4. Sound Menu
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y4. \rSound Menu^n")
	
	// 5. Camer View
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y5. \rCamera View^n")

	// 6. Daily Golds
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y6. \rDaily Golds^n^n")
	
	// 7. Random Prizes
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y7. \rRandom Prizes^n")
	
	// 8. Knife Menu
	if (ze_get_vip_flags(id) & VIP_A)
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y8. \rKnife Menu \y[\rVIP\y]^n^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d8. Knife Menu [\rVIP\d]^n^n")
	}
	
	// 9. Admin Menu
	if (get_user_flags(id) & ADMIN_KICK)
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y9. \rAdmin Menu^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d9. Admin Menu^n")
	}
	
	// 0. Exit
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\y0.\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
		{
			client_cmd(id, "guns")
		}
		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: // Unstuck
		{
			if (is_user_alive(id))
			{
				client_cmd(id, "say /unstuck")
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_UNSTUCK")
			}
		}
		case 3: // Sound Menu
		{
			ze_show_sound_menu(id)
		}
		case 4: // Camera View
		{
			client_cmd(id, "say /cam")
		}
		case 5: // Daily Golds
		{
			client_cmd(id, "say /get")
		}
		case 6: // Random Prizes
		{
			client_cmd(id, "say /prize")
		}
		case 7: // Knife Menu 
		{
			if (ze_get_vip_flags(id))
				ze_open_knife_menu(id)
			else
				ze_colored_print(id, "!tYou are not !gVIP!y.")
		}
		case 8: // Admin Menu
		{
			if (get_user_flags(id) & ADMIN_KICK)
			{
				client_cmd(id, "amxmodmenu")
			}
			else
			{
				ze_colored_print(id, "!tYou are not !gAdmin!y.")
			}
		}
	}
	return PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 5 years ago

Here (Use latest ze_vip.inc and latest compiler):
  • Code: Select all

    #include <zombie_escape>
    #include <ze_vip>
    
    native ze_open_knife_menu(id)
    native ze_show_sound_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 /zemenu", "Cmd_ChooseTeam")
    	register_clcmd("say_team /zemenu", "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, "\y1.\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, "\y1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
    	}
    	
    	// 2. Extra Items
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y2. \r%L^n", id, "MENU_EXTRABUY")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
    	}
        
    	// 3. Unstuck
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y3. \r%L^n^n", id, "MENU_UNSTUCK")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. %L^n^n", id, "MENU_UNSTUCK")
    	}
    	
    	// 4. Sound Menu
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y4. \rSound Menu^n")
    	
    	// 5. Camer View
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y5. \rCamera View^n")
    
    	// 6. Daily Golds
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y6. \rDaily Golds^n^n")
    	
    	// 7. Random Prizes
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y7. \rRandom Prizes^n")
    	
    	// 8. Knife Menu
    	if (ze_get_vip_flags(id) & VIP_A)
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y8. \rKnife Menu \y[\rVIP\y]^n^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d8. Knife Menu [\rVIP\d]^n^n")
    	}
    	
    	// 9. Admin Menu
    	if (get_user_flags(id) & ADMIN_KICK)
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y9. \rAdmin Menu^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d9. Admin Menu^n")
    	}
    	
    	// 0. Exit
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\y0.\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: // Unstuck
    		{
    			if (is_user_alive(id))
    			{
    				client_cmd(id, "say /unstuck")
    			}
    			else
    			{
    				ze_colored_print(id, "%L", id, "DEAD_CANT_UNSTUCK")
    			}
    		}
    		case 3: // Sound Menu
    		{
    			ze_show_sound_menu(id)
    		}
    		case 4: // Camera View
    		{
    			client_cmd(id, "say /cam")
    		}
    		case 5: // Daily Golds
    		{
    			client_cmd(id, "say /get")
    		}
    		case 6: // Random Prizes
    		{
    			client_cmd(id, "say /prize")
    		}
    		case 7: // Knife Menu 
    		{
    			if (ze_get_vip_flags(id))
    				ze_open_knife_menu(id)
    			else
    				ze_colored_print(id, "!tYou are not !gVIP!y.")
    		}
    		case 8: // Admin Menu
    		{
    			if (get_user_flags(id) & ADMIN_KICK)
    			{
    				client_cmd(id, "amxmodmenu")
    			}
    			else
    			{
    				ze_colored_print(id, "!tYou are not !gAdmin!y.")
    			}
    		}
    	}
    	return PLUGIN_HANDLED
    }
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#5

Post by Spir0x » 5 years ago

i already use latest compiler and latest ze_vip. what u modified in this code ?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#6

Post by Raheem » 5 years ago

Changes here:
  • Code: Select all

    #include <zombie_escape>
    #include <ze_vip>
    
    native ze_open_knife_menu(id)
    native ze_show_sound_menu(id)
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#7

Post by Spir0x » 5 years ago

Compiling done. but why you removed ze_unstuck ?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 5 years ago

‏‏‎
Because you did not use any native from it, you just used command ant it does not need to include this ze_unstuck.inc.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#9

Post by Spir0x » 5 years ago

okay thanks.

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests