View Single Post
Author Message
Mankled
Senior Member
Join Date: Oct 2019
Old 10-29-2020 , 00:54   Unreachable code
Reply With Quote #1

getting unreachable code on line 4854, how do i fix that ?

PHP Code:
public menu_mode(idmenuiditem)
{
    
// Player wants to exit the menu
    
if (item == MENU_EXIT)
    {
        
menu_destroy(menuid)
        
show_menu3_admin(id)
        return 
PLUGIN_HANDLED;
    }
    
    
// Create some necassary vars
    
static buffer[2], dummy gameid
    
    
// Retrieve the id of the game mode which was chosen
    
menu_item_getinfo(menuiditemdummybuffercharsmax(buffer), __dummy)
    
gameid buffer[0]
    
    
// Check users access level
    
if (get_user_flags(id) & ArrayGetCell(g_gamemode_flag, (gameid MAX_GAME_MODES)))
    {
        
// Only allow the game mode to proceed after some checks
        
if (allowed_custom_game())
            
command_custom_game(gameidid)
        else
            
zp_colored_print(id"^x04[ZP]^x01 %L"id"CMD_NOT")
            
        
// Show the menu again
        
show_menu_game_mode(id)
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
// Player deosnt haves the required access level
        
zp_colored_print(id"^x04[ZP]^x01 %L"id"CMD_NOT_ACCESS")
        
        
// Show the menu again
        
show_menu_game_mode(id)
        return 
PLUGIN_HANDLED;
    }
    
    
menu_destroy(menuid)
    return 
PLUGIN_HANDLED;

line 4854
PHP Code:
menu_destroy(menuid
if i remove this line, the error goes to the next line "return PLUGIN_HANDLED;"


And Im having this problem in this line as well:
PHP Code:
public setview(idkeymenu)
{
    if(
key == 0) {
         
set_view(idCAMERA_3RDPERSON)
         return 
PLUGIN_HANDLED
    
}

    if(
key == 1) {
         
set_view(idCAMERA_TOPDOWN)
         return 
PLUGIN_HANDLED
    
}

    if(
key == 2) {
         
set_view(idCAMERA_NONE)
         return 
PLUGIN_HANDLED
    
}

    else {
         return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_HANDLED

line 52 ( the last PLUGIN_HANDLED)
PHP Code:
return PLUGIN_HANDLED 

Last edited by Mankled; 10-29-2020 at 02:11.
Mankled is offline