Page 1 of 1

Admin Menu [ Make Human & Zombie ]

Posted: 21 Aug 2017, 17:43
by Donistroy
hello , does anyone can make a plugin for zombie escape that can make zombies & humans with a menu ( Like zombie Plague ) ? .

Re: Admin Menu [ Make Human & Zombie ]

Posted: 21 Aug 2017, 22:39
by Raheem
I was think about this but the problem is it need alot of work as there is alot of cases and need edits for core as if someone make before infection.

Maybe if you need i can make a menu for infection but will be vaild only after zombies appear, Which mean to convert Humans to Zombies only. The other case need some work inside the core and i don't need to do..

Re: Admin Menu [ Make Human & Zombie ]

Posted: 22 Aug 2017, 08:46
by Donistroy
ah yes it need time , anyway , just make a infection menu as zombie plague , turn to human and zombie only , no need other case ... and thank you ;) .

Re: Admin Menu [ Make Human & Zombie ]

Posted: 22 Aug 2017, 22:51
by Raheem
Ok, I make it it's Infection Menu. This will allow admin with the specific flag in the plugin to convert:
  • Zombie --> Human
  • Human --> Zombie
To note that you can only use the menu after zombies have been released. Also if there is only one player in one team and you try make him to another it won't be done.

Write in the console: ze_infec_menu and the menu will appear to you.

Code:
  • Code: Select all

    #include <zombie_escape>
    
    #define ACCESS ADMIN_RCON
    
    new bool:g_bActivate
    
    public plugin_init()
    {
    	register_plugin("[ZE] Infection Menu", "1.0", "Raheem")
    	register_clcmd("ze_infec_menu","Infection_Menu");
    }
    
    public ze_game_started()
    {
    	g_bActivate = false
    }
    
    public ze_zombie_release()
    {
    	g_bActivate = true
    }
    
    public Infection_Menu(id)
    {
    	new menu = menu_create( "\yInfection Menu\w:", "menu_handler" );
    	
    	new iPlayers[32], iNum
    	get_players(iPlayers, iNum, "c")
    	
    	new szName[32], szUserId[32], szData[200];
    	
    	for (new i = 0;i < iNum;i++)
    	{
    		if (!is_user_alive(i))
    			continue
    		
    		get_user_name(iPlayers[i], szName, charsmax(szName))
    		formatex(szUserId, charsmax(szUserId), "%d", get_user_userid(iPlayers[i]));
    		formatex(szData, charsmax(szData), "%s	%s", szName, ze_is_user_zombie(i) ? "\d[\rZombie\d]" : "\d[\rHuman\d]");
    		
    		menu_additem(menu, szData, szUserId, 0)
    	}
    	
    	if(get_user_flags(id) & ACCESS)
    	{
    		menu_display(id, menu, 0)
    	}
    	else
    	{
    		client_print(id, print_console, "[Infection Menu] You have no access to that command.")
    	}
    }
    
    public menu_handler(id, menu, item)
    {
    	if(item == MENU_EXIT || !g_bActivate || GetAlivePlayersNum(CsTeams:TEAM_CT) < 2 || GetAlivePlayersNum(CsTeams:TEAM_TERRORIST) < 2)
    	{
    		menu_destroy(menu);
    		return PLUGIN_HANDLED;
    	}
    	
    	new szData[6], szName[64];
    	new iaccess, item_callback;
    	
    	menu_item_getinfo(menu, item, iaccess, szData, charsmax(szData), szName, charsmax(szName), item_callback);
    	
    	new userid = str_to_num(szData);
    	new player = find_player("k", userid);
    	
    	if (ze_is_user_zombie(player))
    	{
    		ze_set_user_human(player)
    	}
    	else
    	{
    		ze_set_user_zombie(player)
    	}
    
    	set_task(0.1, "menu_again", id);
    	
    	menu_destroy(menu)
    	return PLUGIN_HANDLED;
    }
    
    public menu_again(id)
    {
    	client_cmd(id, "ze_infec_menu")
    }

Re: Admin Menu [ Make Human & Zombie ]

Posted: 23 Aug 2017, 08:43
by Donistroy
Thank You Bro For Your Help ;)

Re: Admin Menu [ Make Human & Zombie ]

Posted: 06 Dec 2021, 12:21
by Amnesia
Raheem wrote: 6 years ago Ok, I make it it's Infection Menu. This will allow admin with the specific flag in the plugin to convert:
  • Zombie --> Human
  • Human --> Zombie
To note that you can only use the menu after zombies have been released. Also if there is only one player in one team and you try make him to another it won't be done.

Write in the console: ze_infec_menu and the menu will appear to you.

Code:
  • Code: Select all

    #include <zombie_escape>
    
    #define ACCESS ADMIN_RCON
    
    new bool:g_bActivate
    
    public plugin_init()
    {
    	register_plugin("[ZE] Infection Menu", "1.0", "Raheem")
    	register_clcmd("ze_infec_menu","Infection_Menu");
    }
    
    public ze_game_started()
    {
    	g_bActivate = false
    }
    
    public ze_zombie_release()
    {
    	g_bActivate = true
    }
    
    public Infection_Menu(id)
    {
    	new menu = menu_create( "\yInfection Menu\w:", "menu_handler" );
    	
    	new iPlayers[32], iNum
    	get_players(iPlayers, iNum, "c")
    	
    	new szName[32], szUserId[32], szData[200];
    	
    	for (new i = 0;i < iNum;i++)
    	{
    		if (!is_user_alive(i))
    			continue
    		
    		get_user_name(iPlayers[i], szName, charsmax(szName))
    		formatex(szUserId, charsmax(szUserId), "%d", get_user_userid(iPlayers[i]));
    		formatex(szData, charsmax(szData), "%s	%s", szName, ze_is_user_zombie(i) ? "\d[\rZombie\d]" : "\d[\rHuman\d]");
    		
    		menu_additem(menu, szData, szUserId, 0)
    	}
    	
    	if(get_user_flags(id) & ACCESS)
    	{
    		menu_display(id, menu, 0)
    	}
    	else
    	{
    		client_print(id, print_console, "[Infection Menu] You have no access to that command.")
    	}
    }
    
    public menu_handler(id, menu, item)
    {
    	if(item == MENU_EXIT || !g_bActivate || GetAlivePlayersNum(CsTeams:TEAM_CT) < 2 || GetAlivePlayersNum(CsTeams:TEAM_TERRORIST) < 2)
    	{
    		menu_destroy(menu);
    		return PLUGIN_HANDLED;
    	}
    	
    	new szData[6], szName[64];
    	new iaccess, item_callback;
    	
    	menu_item_getinfo(menu, item, iaccess, szData, charsmax(szData), szName, charsmax(szName), item_callback);
    	
    	new userid = str_to_num(szData);
    	new player = find_player("k", userid);
    	
    	if (ze_is_user_zombie(player))
    	{
    		ze_set_user_human(player)
    	}
    	else
    	{
    		ze_set_user_zombie(player)
    	}
    
    	set_task(0.1, "menu_again", id);
    	
    	menu_destroy(menu)
    	return PLUGIN_HANDLED;
    }
    
    public menu_again(id)
    {
    	client_cmd(id, "ze_infec_menu")
    }

Code: Select all

	register_plugin("[ZE] Infection Menu", "1.0", "Raheem")
ERROR fix it please