Solved ZE Main Menu Help

Coding Help/Re-API Supported
Post Reply
johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

ZE Main Menu Help

#1

Post by johnnysins2000 » 7 years ago

Here i have been trying from last night to fix it but compilation error comes

What is the Problem ?

The Problem is case 2:

on case 2 it says loosing indentation so it won't compile Can Somebody Help To fix it ?


Here is the Code :-

Code: Select all

#include <zombie_escape>
 
// 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)
{
    Show_Menu_Main(id)
    return PLUGIN_HANDLED // Kill the Choose Team Command
}
 
// Main Menu
public Show_Menu_Main(id)
{
    static szMenu[500]
    new iLen
   
    // Title
    iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\yZombie Escape 1.0^n^n", id, "MAIN_MENU_TITLE")
   
    // 1. Buy Weapons
    if (is_user_alive(id))
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
    }
    else
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
    }
   
    // 2. Extra Items
    if (is_user_alive(id))
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
    }
    else
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
    }
   
    // 3. Camera Menu
    if (is_user_alive(id))
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
    }
    else
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
    }
   
    // 4. Unstuck
    if (is_user_alive(id))
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
    }
    else
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
    }
   
    // 5. Rules
    if (is_user_alive(id))
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
    }
    else
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
    }
   
    // 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: // Camera Menu
        {
	client_cmd(id, "say /cam")  
        }
        case 3: // Unstuck
        {
            client_cmd(id, "say /unstuck")
        }
        case 4: // Rules
        {
            client_cmd(id, "say /rules")      
        }
    }
   
    return PLUGIN_HANDLED;
}
Nobody Is That Busy If They Make Time :roll:

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#2

Post by johnnysins2000 » 7 years ago

And i also want to add the Join Spectators Option in this menu i am sure of the code that is why not yet tried ... If Somebody knows can he add that too ?
Nobody Is That Busy If They Make Time :roll:

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

#3

Post by Raheem » 7 years ago

I told you before that loose indentation not error it's just warning you get it because your indentation not same this is the fix:

  1. #include <zombie_escape>
  2.  
  3. // Keys
  4. const OFFSET_CSMENUCODE = 205
  5. 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
  6.  
  7. public plugin_init()
  8. {
  9.     register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
  10.    
  11.     // Commands
  12.     register_clcmd("chooseteam", "Cmd_ChooseTeam")
  13.     register_clcmd("say /ze", "Cmd_ChooseTeam")
  14.     register_clcmd("say_team /ze", "Cmd_ChooseTeam")
  15.    
  16.     // Register Menus
  17.     register_menu("Main Menu", KEYSMENU, "Main_Menu")
  18. }
  19.  
  20. public Cmd_ChooseTeam(id)
  21. {
  22.     Show_Menu_Main(id)
  23.     return PLUGIN_HANDLED // Kill the Choose Team Command
  24. }
  25.  
  26. // Main Menu
  27. public Show_Menu_Main(id)
  28. {
  29.     static szMenu[500]
  30.     new iLen
  31.    
  32.     // Title
  33.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\yZombie Escape 1.0^n^n", id, "MAIN_MENU_TITLE")
  34.    
  35.     // 1. Buy Weapons
  36.     if (is_user_alive(id))
  37.     {
  38.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
  39.     }
  40.     else
  41.     {
  42.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
  43.     }
  44.    
  45.     // 2. Extra Items
  46.     if (is_user_alive(id))
  47.     {
  48.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
  49.     }
  50.     else
  51.     {
  52.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
  53.     }
  54.    
  55.     // 3. Camera Menu
  56.     if (is_user_alive(id))
  57.     {
  58.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
  59.     }
  60.     else
  61.     {
  62.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
  63.     }
  64.    
  65.     // 4. Unstuck
  66.     if (is_user_alive(id))
  67.     {
  68.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
  69.     }
  70.     else
  71.     {
  72.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
  73.     }
  74.    
  75.     // 5. Rules
  76.     if (is_user_alive(id))
  77.     {
  78.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
  79.     }
  80.     else
  81.     {
  82.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
  83.     }
  84.    
  85.     // 0. Exit
  86.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
  87.    
  88.     // Fix for AMXX custom menus
  89.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  90.     show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
  91. }
  92.  
  93. // Main Menu
  94. public Main_Menu(id, key)
  95. {
  96.     // Player disconnected?
  97.     if (!is_user_connected(id))
  98.         return PLUGIN_HANDLED
  99.    
  100.     switch (key)
  101.     {
  102.         case 0: // Buy Weapons
  103.         {
  104.             client_cmd(id, "guns")
  105.         }
  106.         case 1: // Extra Items
  107.         {
  108.             if (is_user_alive(id))
  109.             {
  110.                 ze_show_items_menu(id)
  111.             }
  112.             else
  113.             {
  114.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  115.         }  
  116.         case 2: // Camera Menu
  117.         {
  118.             client_cmd(id, "say /cam")  
  119.         }
  120.         case 3: // Unstuck
  121.         {
  122.             client_cmd(id, "say /unstuck")
  123.         }
  124.         case 4: // Rules
  125.         {
  126.             client_cmd(id, "say /rules")      
  127.         }
  128.     }
  129.    
  130.     return PLUGIN_HANDLED;
  131. }

For your second request, Just set the user team to be spectator using ReAPI: rg_set_user_team(id, TEAM_SPECTATOR, MODEL_UNASSIGNED)
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#4

Post by johnnysins2000 » 7 years ago

Raheem wrote: 7 years ago I told you before that loose indentation not error it's just warning you get it because your indentation not same this is the fix:

  1. #include <zombie_escape>
  2.  
  3. // Keys
  4. const OFFSET_CSMENUCODE = 205
  5. 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
  6.  
  7. public plugin_init()
  8. {
  9.     register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
  10.    
  11.     // Commands
  12.     register_clcmd("chooseteam", "Cmd_ChooseTeam")
  13.     register_clcmd("say /ze", "Cmd_ChooseTeam")
  14.     register_clcmd("say_team /ze", "Cmd_ChooseTeam")
  15.    
  16.     // Register Menus
  17.     register_menu("Main Menu", KEYSMENU, "Main_Menu")
  18. }
  19.  
  20. public Cmd_ChooseTeam(id)
  21. {
  22.     Show_Menu_Main(id)
  23.     return PLUGIN_HANDLED // Kill the Choose Team Command
  24. }
  25.  
  26. // Main Menu
  27. public Show_Menu_Main(id)
  28. {
  29.     static szMenu[500]
  30.     new iLen
  31.    
  32.     // Title
  33.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\yZombie Escape 1.0^n^n", id, "MAIN_MENU_TITLE")
  34.    
  35.     // 1. Buy Weapons
  36.     if (is_user_alive(id))
  37.     {
  38.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
  39.     }
  40.     else
  41.     {
  42.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
  43.     }
  44.    
  45.     // 2. Extra Items
  46.     if (is_user_alive(id))
  47.     {
  48.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
  49.     }
  50.     else
  51.     {
  52.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
  53.     }
  54.    
  55.     // 3. Camera Menu
  56.     if (is_user_alive(id))
  57.     {
  58.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
  59.     }
  60.     else
  61.     {
  62.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
  63.     }
  64.    
  65.     // 4. Unstuck
  66.     if (is_user_alive(id))
  67.     {
  68.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
  69.     }
  70.     else
  71.     {
  72.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
  73.     }
  74.    
  75.     // 5. Rules
  76.     if (is_user_alive(id))
  77.     {
  78.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
  79.     }
  80.     else
  81.     {
  82.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
  83.     }
  84.    
  85.     // 0. Exit
  86.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
  87.    
  88.     // Fix for AMXX custom menus
  89.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  90.     show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
  91. }
  92.  
  93. // Main Menu
  94. public Main_Menu(id, key)
  95. {
  96.     // Player disconnected?
  97.     if (!is_user_connected(id))
  98.         return PLUGIN_HANDLED
  99.    
  100.     switch (key)
  101.     {
  102.         case 0: // Buy Weapons
  103.         {
  104.             client_cmd(id, "guns")
  105.         }
  106.         case 1: // Extra Items
  107.         {
  108.             if (is_user_alive(id))
  109.             {
  110.                 ze_show_items_menu(id)
  111.             }
  112.             else
  113.             {
  114.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  115.         }  
  116.         case 2: // Camera Menu
  117.         {
  118.             client_cmd(id, "say /cam")  
  119.         }
  120.         case 3: // Unstuck
  121.         {
  122.             client_cmd(id, "say /unstuck")
  123.         }
  124.         case 4: // Rules
  125.         {
  126.             client_cmd(id, "say /rules")      
  127.         }
  128.     }
  129.    
  130.     return PLUGIN_HANDLED;
  131. }

For your second request, Just set the user team to be spectator using ReAPI: rg_set_user_team(id, TEAM_SPECTATOR, MODEL_UNASSIGNED)

Still same Compilation error . Yes Now I know it is not error bro .

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Warning: Loose indentation on line 116
Error: Invalid statement; not in switch on line 116
Warning: Expression has no effect on line 116
Error: Expected token: ";", but found ":" on line 116
Error: Invalid expression, assumed zero on line 116
Error: Too many error messages on one line on line 116

Compilation aborted.
4 Errors.
Could not locate output file E:\My old windows 8 things\amxmodx\AMX Mod X\amxxstudio\ZE_SMA\ze_main_menu.amx (compile failed).


These are the errors after putting and trying your code
Nobody Is That Busy If They Make Time :roll:

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

#5

Post by Raheem » 7 years ago

You don't provide the full error i think it's only loose indentation. This time you forget "}" so final working code:

  1. #include <zombie_escape>
  2.  
  3. // Keys
  4. const OFFSET_CSMENUCODE = 205
  5. 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
  6.  
  7. public plugin_init()
  8. {
  9.     register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
  10.    
  11.     // Commands
  12.     register_clcmd("chooseteam", "Cmd_ChooseTeam")
  13.     register_clcmd("say /ze", "Cmd_ChooseTeam")
  14.     register_clcmd("say_team /ze", "Cmd_ChooseTeam")
  15.    
  16.     // Register Menus
  17.     register_menu("Main Menu", KEYSMENU, "Main_Menu")
  18. }
  19.  
  20. public Cmd_ChooseTeam(id)
  21. {
  22.     Show_Menu_Main(id)
  23.     return PLUGIN_HANDLED // Kill the Choose Team Command
  24. }
  25.  
  26. // Main Menu
  27. public Show_Menu_Main(id)
  28. {
  29.     static szMenu[500]
  30.     new iLen
  31.    
  32.     // Title
  33.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\yZombie Escape 1.0^n^n", id, "MAIN_MENU_TITLE")
  34.    
  35.     // 1. Buy Weapons
  36.     if (is_user_alive(id))
  37.     {
  38.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
  39.     }
  40.     else
  41.     {
  42.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1.\r -=||*\yWeapons\r*||=-^n", id, "MENU_WEAPONBUY")
  43.     }
  44.    
  45.     // 2. Extra Items
  46.     if (is_user_alive(id))
  47.     {
  48.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
  49.     }
  50.     else
  51.     {
  52.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. -=||*\yExtra Items\r*||=-^n", id, "MENU_EXTRABUY")
  53.     }
  54.    
  55.     // 3. Camera Menu
  56.     if (is_user_alive(id))
  57.     {
  58.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
  59.     }
  60.     else
  61.     {
  62.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yCamera Menu\r*||=-^n", id, "MENU_CAMERA")
  63.     }
  64.    
  65.     // 4. Unstuck
  66.     if (is_user_alive(id))
  67.     {
  68.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
  69.     }
  70.     else
  71.     {
  72.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yUnstuck\r*||=-^n", id, "MENU_UNSTUCK")
  73.     }
  74.    
  75.     // 5. Rules
  76.     if (is_user_alive(id))
  77.     {
  78.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
  79.     }
  80.     else
  81.     {
  82.         iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yRules\r*||=-^n", id, "MENU_UNSTUCK")
  83.     }
  84.    
  85.     // 0. Exit
  86.     iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
  87.    
  88.     // Fix for AMXX custom menus
  89.     set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  90.     show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
  91. }
  92.  
  93. // Main Menu
  94. public Main_Menu(id, key)
  95. {
  96.     // Player disconnected?
  97.     if (!is_user_connected(id))
  98.         return PLUGIN_HANDLED
  99.    
  100.     switch (key)
  101.     {
  102.         case 0: // Buy Weapons
  103.         {
  104.             client_cmd(id, "guns")
  105.         }
  106.         case 1: // Extra Items
  107.         {
  108.             if (is_user_alive(id))
  109.             {
  110.                 ze_show_items_menu(id)
  111.             }
  112.             else
  113.             {
  114.                 ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
  115.             }
  116.         }
  117.         case 2: // Camera Menu
  118.         {
  119.             client_cmd(id, "say /cam")  
  120.         }
  121.         case 3: // Unstuck
  122.         {
  123.             client_cmd(id, "say /unstuck")
  124.         }
  125.         case 4: // Rules
  126.         {
  127.             client_cmd(id, "say /rules")      
  128.         }
  129.     }
  130.     return PLUGIN_HANDLED;
  131. }
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#6

Post by johnnysins2000 » 7 years ago

I see why didn't I notice this thing ? :/ Anyway Thnx now i know loosing indentation only comes when i am missing } { these brackets
Nobody Is That Busy If They Make Time :roll:

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

#7

Post by Raheem » 7 years ago

You need to review the code after writing it. miss the brackets will give error but the miss of indentation just warning. The indentation is the spaces not the {} i told you before.
He who fails to plan is planning to fail

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#8

Post by Night Fury » 7 years ago

Code: Select all

#include <zombie_escape>

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)
{
	Show_Menu_Main(id)
	return PLUGIN_HANDLED // Kill the Choose Team Command
}
 
// Main Menu
public Show_Menu_Main(id)
{
	static szMenu[500], iLen
   
	// Title
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\yZombie Escape 1.0^n^n")
   
	// 1. Buy Weapons
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r -=||*\yWeapons\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1.\r -=||*\yWeapons\r*||=-^n")
	}
   
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r -=||*\yExtra Items\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. -=||*\yExtra Items\r*||=-^n")
	}
   
	// 3. Camera Menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yCamera Menu\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yCamera Menu\r*||=-^n")
	}
   
	// 4. Unstuck
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yUnstuck\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yUnstuck\r*||=-^n")
	}
   
	// 5. Rules
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yRules\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yRules\r*||=-^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)
{
	if (!is_user_connected(id))
		return
   
	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: // Camera Menu
		{
			client_cmd(id, "say /cam")  
		}
		case 3: // Unstuck
		{
			client_cmd(id, "say /unstuck")
		}
		case 4: // Rules
		{
			client_cmd(id, "say /rules")      
		}
	}
}
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

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

#9

Post by Raheem » 7 years ago

Jack GamePlay wrote: 7 years ago

Code: Select all

#include <zombie_escape>

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)
{
	Show_Menu_Main(id)
	return PLUGIN_HANDLED // Kill the Choose Team Command
}
 
// Main Menu
public Show_Menu_Main(id)
{
	static szMenu[500], iLen
   
	// Title
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\yZombie Escape 1.0^n^n")
   
	// 1. Buy Weapons
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r -=||*\yWeapons\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1.\r -=||*\yWeapons\r*||=-^n")
	}
   
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r -=||*\yExtra Items\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. -=||*\yExtra Items\r*||=-^n")
	}
   
	// 3. Camera Menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yCamera Menu\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yCamera Menu\r*||=-^n")
	}
   
	// 4. Unstuck
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yUnstuck\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yUnstuck\r*||=-^n")
	}
   
	// 5. Rules
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r -=||*\yRules\r*||=-^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3.\r -=||*\yRules\r*||=-^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)
{
	if (!is_user_connected(id))
		return
   
	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: // Camera Menu
		{
			client_cmd(id, "say /cam")  
		}
		case 3: // Unstuck
		{
			client_cmd(id, "say /unstuck")
		}
		case 4: // Rules
		{
			client_cmd(id, "say /rules")      
		}
	}
}
Problem already solved.
He who fails to plan is planning to fail

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#10

Post by sPe3doN » 7 years ago

.
Last edited by sPe3doN 5 years ago, edited 1 time in total.
Image

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#11

Post by sPe3doN » 6 years ago

Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#12

Post by Night Fury » 6 years ago

ZE Main Menu.rar
(4.54 KiB) Downloaded 356 times
ZE Main Menu.rar
(4.54 KiB) Downloaded 356 times
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

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 1 guest