AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Multi dimensional array (https://forums.alliedmods.net/showthread.php?t=192714)

OvidiuS 08-13-2012 12:12

[SOLVED] Multi dimensional array
 
I don't know what i'm doing :s
Code:
#include < amxmodx > public plugin_init( ) {     new const g_szCommands[ ][ ] =     {         { "war3menu",               "show_wc3Menu" },         { "say /war3Menu",          "show_wc3Menu" },         { "say_team /war3Menu",     "show_wc3Menu" },         { "changerace",             "command_ChangeRace" },         { "say /changerace",        "command_ChangeRace" },         { "say_team /changerace",   "command_ChangeRace" },         { "selectskill",            "command_SelectSkill" },         { "say /selectskill",       "command_SelectSkill" },         { "say_team /selectskill""command_SelectSkill" },         { "playerskills",           "command_PlayerSkills" },         { "say /playerskills",      "command_PlayerSkills" },         { "say_team /playerskills", "command_PlayerSkills" },         { "skillsinfo",             "command_SkillsInfo" },         { "say /skillsinfo",        "command_SkillsInfo" },         { "say_team /skillsinfo",   "command_SkillsInfo" },         { "itemsinfo",              "command_ItemInfo" },         { "say /itemsinfo",         "command_ItemInfo" },         { "say /itemsinfo",         "command_ItemInfo" },         { "war3help",               "command_wc3Help" },         { "say /war3help",          "command_wc3Help" },         { "say_team /war3help",     "command_wc3Help" },         { "ultimate",               "command_Ultimate" },         { "icons",                  "command_Icons" },         { "say /icons",             "command_Icons" },         { "say_team /icons",        "command_Icons" },         { "shopmenu",               "command_ShopMenu" },         { "say /shopmenu",          "command_ShopMenu" },         { "say_team /shopmenu",     "command_ShopMenu" },         { "level",                  "command_Level" },         { "say /level",             "command_Level" },         { "say_team /level",        "command_Level" }     }     //for( new i = 0; i < sizeof g_szCommands; i++ )         //register_clcmd( g_szCommands[ i ], g_szCommands[ i ][ ] ) }
How can i use multi-dimensional array to register commands ?
I don't want to use 2 arrays, one for command, one for handle.

Merciless 08-13-2012 12:15

Re: Multi dimensional array
 
PHP Code:

register_clcmdg_szCommands][0], g_szCommands][1] ) 


OvidiuS 08-13-2012 12:19

Re: Multi dimensional array
 
Simple as that.

Thank you.

fysiks 08-13-2012 18:56

Re: [SOLVED] Multi dimensional array
 
Your array is declared wrong. It should have 3 dimensions, not just two. Hopefully you figured this out on your own already. Either way, it should be stated here.


All times are GMT -4. The time now is 05:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.