Resolved ZE Main Menu Help

Coding Help/Re-API Supported
johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

ZE Main Menu Help

#1

Post by johnnysins2000 » 2 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
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#2

Post by johnnysins2000 » 2 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
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#3

Post by Raheem » 2 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)
You don't know? Learn and you will know.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#4

Post by johnnysins2000 » 2 Years Ago

Raheem wrote:
2 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
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#5

Post by Raheem » 2 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. }
You don't know? Learn and you will know.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#6

Post by johnnysins2000 » 2 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
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#7

Post by Raheem » 2 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.
You don't know? Learn and you will know.

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 622
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#8

Post by Mohamed Alaa » 2 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 web projects.
CS 1.6 hosting: powergamingtech.com

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#9

Post by Raheem » 2 Years Ago

Jack GamePlay wrote:
2 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.
You don't know? Learn and you will know.

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 211
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#10

Post by sPe3doN » 2 Years Ago

.
Last edited by sPe3doN on 29 Aug 2018, 21:34, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests