Solved Main Menu HELP.

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 HELP.

#1

Post by Spir0x » 6 years ago

Hello all guys please help me when i change map or map changed or player join the server, he can't choose team menu with this main menu code

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 (get_member(id, m_iTeam) != TEAM_SPECTATOR)
	{
		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[\rBraZZerS \y| \rZombie \y| \rEscape\w]^n", id, "MAIN_MENU_TITLE")
         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\rUPDATE\w] \y==> \rWinter Special\y.^n^n", id, "MAIN_MENU_TITLE")
	 
	// 1. Buy Weapons
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r1\w].\y %L^n", id, "MENU_WEAPONBUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[1].\y %L^n", id, "MENU_WEAPONBUY")
	}
	
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r2\w].\y %L^n", id, "MENU_EXTRABUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[2].\y %L^n", id, "MENU_EXTRABUY")
	}
         
	// 3. Unstuck
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r3\w].\y Unstuck^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[3].\y Unstuck^n")
	}
	
	// 4. Camera View
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r4\w].\y Camera View^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[4].\y Camera View^n")
	}
	
	// 5. Knife Menu
	if (ze_get_vip_flags(id) & VIP_A)
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r5\w].\y Knife Menu \w[\rVIP\w]^n^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[5].\y Knife Menu \d[\rVIP\d]^n^n")
	}
	
	// 0. Exit
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w[\r0\w].\y %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, "!tYou can't use !gUnstuck !tyourself while you are dead!y!")
			}
		}
		case 3: // Camera View
		{
			client_cmd(id, "say /cam")
		}
		case 4:
		{
			if (ze_get_vip_flags(id))
				ze_open_knife_menu(id)
			else
				ze_colored_print(id, "!gKnife menu!y, !tallowed only for !gVIPs!y!")
		}
	}
	return PLUGIN_HANDLED
}

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

#2

Post by Spir0x » 6 years ago

So i removed
return PLUGIN_HANDLED // Kill the Choose Team Command

and why ? becuz when someone press "M" or "?" he see main menu and Choose Team menu both so i wanted to disable it and make this one.

Guys Please help me to make this one in main menu to help player to choose team

1. Buy Weapons
2. Extra Items
3. Unstuck
and now i just wanna make new one to choose team like this
4. Choose Team
So when player press 4 he can join. hope u understand me

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

#3

Post by Spir0x » 6 years ago

anyone here ? [mention]Raheem[/mention] , [mention]Jack GamePlay[/mention] , [mention]sam_bhosale4[/mention] [mention]TheWhitesmith[/mention]

User avatar
TheWhitesmith
Member
Member
Morocco
Posts: 33
Joined: 6 years ago
Location: Temara/Rabat
Contact:

#4

Post by TheWhitesmith » 6 years ago

I'm working on one, but by the way, souldn't that TEAM_SPECTATOR be TEAM_UNASSIGNED? Because at first players are not spectators.
[SYA] CSGO-Mod for CS 1.6 [ Cases/Keys/Rank ][/size]
IP: 149.202.251.74:27016

User avatar
TheWhitesmith
Member
Member
Morocco
Posts: 33
Joined: 6 years ago
Location: Temara/Rabat
Contact:

#5

Post by TheWhitesmith » 6 years ago

    Try this one, although I'm not sure it is the best way to do so.

    Code: Select all

    #include <ze_vip>
    #include <ze_unstuck>
    
    
    native ze_open_knife_menu(id)
    
    new bool:g_bCanChange[33]
    // 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_SPECTATOR && get_member(id, m_iTeam) != TEAM_UNASSIGNED && !g_bCanChange[id])
    	{
    		Show_Menu_Main(id)
    		return PLUGIN_HANDLED // Kill the Choose Team Command
    	}
    	g_bCanChange[id] = false
    	
    	// 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[\rBraZZerS \y| \rZombie \y| \rEscape\w]^n", id, "MAIN_MENU_TITLE")
             iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\rUPDATE\w] \y==> \rWinter Special\y.^n^n", id, "MAIN_MENU_TITLE")
    	 
    	// 1. Buy Weapons
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r1\w].\y %L^n", id, "MENU_WEAPONBUY")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[1].\y %L^n", id, "MENU_WEAPONBUY")
    	}
    	
    	// 2. Extra Items
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r2\w].\y %L^n", id, "MENU_EXTRABUY")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[2].\y %L^n", id, "MENU_EXTRABUY")
    	}
             
    	// 3. Unstuck
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r3\w].\y Unstuck^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[3].\y Unstuck^n")
    	}
    	
    	// 4. Camera View
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r4\w].\y Camera View^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[4].\y Camera View^n")
    	}
    	
    	// 5. Knife Menu
    	if (ze_get_vip_flags(id) & VIP_A)
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r5\w].\y Knife Menu \w[\rVIP\w]^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[5].\y Knife Menu \d[\rVIP\d]^n")
    	}
    	
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\r6\w].\y ChangeTeam^n^n")
    	
    	// 0. Exit
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w[\r0\w].\y %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, "!tYou can't use !gUnstuck !tyourself while you are dead!y!")
    			}
    		}
    		case 3: // Camera View
    		{
    			client_cmd(id, "say /cam")
    		}
    		case 4:
    		{
    			if (ze_get_vip_flags(id))
    				ze_open_knife_menu(id)
    			else
    				ze_colored_print(id, "!gKnife menu!y, !tallowed only for !gVIPs!y!")
    		}
    		case 5:
    		{
    			g_bCanChange[id] = true
    			client_cmd(id, "chooseteam")
    		}
    	}
    	return PLUGIN_HANDLED
    }
    [SYA] CSGO-Mod for CS 1.6 [ Cases/Keys/Rank ][/size]
    IP: 149.202.251.74:27016

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

    #6

    Post by Spir0x » 6 years ago

    Thanks so much bro ! now working fine :D

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

    #7

    Post by Spir0x » 6 years ago

    White Bro idk why when i added some things on main menu won't appear exampe i added
    4. sound menu
    5. daily award
    6. random prize
    7. camera view
    8. knife menu
    then i can see only Daily awar and random prize & knife menu won't appear on main menu i think there's a problem in cases or what ?
    and on another servers using this mod have +9 Cases

    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 (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, "%L^n^n", id, "MAIN_MENU_TITLE")
    	
    	// 1. Buy Weapons
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y1\w]\d. \r%L^n", id, "MENU_WEAPONBUY")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[1]. %L^n", id, "MENU_WEAPONBUY")
    	}
    	
    	// 2. Extra Items
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y2\w]\d. \r%L^n", id, "MENU_EXTRABUY")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[2]. %L^n", id, "MENU_EXTRABUY")
    	}
        
    	// 3. Unstuck
    	if (is_user_alive(id))
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y3\w]\d. \rUnstuck^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[3]. Unstuck^n")
    	}
    	
    	// 4. Sound Menu
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y4\w]\d. \rSound Menu^n")
    	
    	// 5. Daily Award
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y5\w]\d. \rDaily Award^n")
    	
    	// 6. Random Prizes
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y6\w]\d. \rRandom Prize^n")
    	
    	// 7. Camera View
    	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y7\w]\d. \rCamera View^n")
    	
    	// 8. Knife Menu
    	if (ze_get_vip_flags(id) & VIP_A)
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w[\y8\w]\d. \rKnife Menu \w[\rVIP\w]^n^n")
    	}
    	else
    	{
    		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[8]. Knife Menu [\rVIP\d]^n^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
    		{
    			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: // Daily Award
    		{
    			client_cmd(id, "say /get")
    		}
    		case 5: // Random Prize
    		{
    			client_cmd(id, "say /prize")
    		}
    		case 6: // Camera View
    		{
    			client_cmd(id, "say /cam")
    		}
    		case 7: // Knife Menu
    		{
    			ze_open_knife_menu(id)
    		}
    	}
    	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:

    #8

    Post by Raheem » 6 years ago

    This problem still need solution?
    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 » 6 years ago

    No solved i remove all the braquets [1.] [2]. into 1. 2. Solved.

    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 11 guests