diff --git a/plugins/mapsmenu.sma b/plugins/mapsmenu.sma index 09479107..744f5e58 100755 --- a/plugins/mapsmenu.sma +++ b/plugins/mapsmenu.sma @@ -37,7 +37,8 @@ #define MAX_MAPS 64 -new g_mapName[MAX_MAPS][32] +new Array:g_mapName; +//new g_mapName[MAX_MAPS][32] new g_mapNums new g_menuPosition[33] @@ -64,6 +65,8 @@ public plugin_init() register_menucmd(register_menuid("Votemap Menu"), 1023, "actionVoteMapMenu") register_menucmd(register_menuid("The winner: "), 3, "actionResult") + g_mapName=ArrayCreate(32); + new maps_ini_file[64]; get_configsdir(maps_ini_file, 63); format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file); @@ -99,7 +102,10 @@ public actionResult(id, key) message_end() } - set_task(2.0, "delayedChange", 0, g_mapName[g_choosed], strlen(g_mapName[g_choosed]) + 1) + new tempMap[32]; + ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap)); + + set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1) log_amx("Vote: %L", "en", "RESULT_ACC") client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_ACC") } @@ -129,8 +135,10 @@ public checkVotes(id) if (iResult >= iRatio) { g_choosed = g_voteSelected[id][a] - client_print(0, print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", g_mapName[g_choosed]) - log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", g_mapName[g_choosed]) + new tempMap[32]; + ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap)); + client_print(0, print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", tempMap); + log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", tempMap); } if (g_choosed != -1) @@ -138,7 +146,9 @@ public checkVotes(id) if (is_user_connected(id)) { new menuBody[512] - new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", g_mapName[g_choosed]) + new tempMap[32]; + ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap)); + new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", tempMap) len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT") format(menuBody[len], 511-len, "^n1. %L^n2. %L", id, "YES", id, "NO") @@ -154,8 +164,9 @@ public checkVotes(id) message_begin(MSG_ALL, SVC_INTERMISSION) message_end() } - - set_task(2.0, "delayedChange", 0, g_mapName[g_choosed], strlen(g_mapName[g_choosed]) + 1) + new tempMap[32]; + ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap)); + set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1) } } else { client_print(0, print_chat, "%L", LANG_PLAYER, "VOTE_FAILED") @@ -214,19 +225,20 @@ displayVoteMapsMenu(id, pos) if (end > g_mapNums) end = g_mapNums + new tempMap[32]; for (new a = start; a < end; ++a) { + ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap)); if (g_voteSelectedNum[id] == 4 || isMapSelected(id, pos * 7 + b)) { ++b - if (g_coloredMenus) - len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_mapName[a]) + len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, tempMap) else - len += format(menuBody[len], 511-len, "#. %s^n", g_mapName[a]) + len += format(menuBody[len], 511-len, "#. %s^n", tempMap) } else { keys |= (1< 0) + { + ArrayGetString(g_mapName, g_voteSelected[id][0], tempMapA, charsmax(tempMapA)); + } + else + { + copy(tempMapA, charsmax(tempMapA), ""); + } + if (g_voteSelectedNum[id] > 1) + { + ArrayGetString(g_mapName, g_voteSelected[id][1], tempMapB, charsmax(tempMapB)); + } + else + { + copy(tempMapB, charsmax(tempMapB), ""); + } + if (g_voteSelectedNum[id] > 2) + { + ArrayGetString(g_mapName, g_voteSelected[id][2], tempMapC, charsmax(tempMapC)); + } + else + { + copy(tempMapC, charsmax(tempMapC), ""); + } + if (g_voteSelectedNum[id] > 3) + { + ArrayGetString(g_mapName, g_voteSelected[id][3], tempMapD, charsmax(tempMapD)); + } + else + { + copy(tempMapD, charsmax(tempMapD), ""); + } + log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, - g_voteSelectedNum[id] > 0 ? g_mapName[g_voteSelected[id][0]] : "", - g_voteSelectedNum[id] > 1 ? g_mapName[g_voteSelected[id][1]] : "", - g_voteSelectedNum[id] > 2 ? g_mapName[g_voteSelected[id][2]] : "", - g_voteSelectedNum[id] > 3 ? g_mapName[g_voteSelected[id][3]] : "") + tempMapA, tempMapB, tempMapC, tempMapD) } case 8: displayVoteMapsMenu(id, ++g_menuPosition[id]) case 9: displayVoteMapsMenu(id, --g_menuPosition[id]) @@ -423,14 +471,13 @@ public actionMapsMenu(id, key) get_user_authid(id, authid, 31) get_user_name(id, name, 31) - switch (get_cvar_num("amx_show_activity")) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGEL_2", name, g_mapName[a]) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGEL_1", g_mapName[a]) - } + new tempMap[32]; + ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap)); + + show_activity_key("ADMIN_CHANGEL_1", "ADMIN_CHANGEL_2", name, tempMap); - log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, g_mapName[a]) - set_task(2.0, "delayedChange", 0, g_mapName[a], strlen(g_mapName[a]) + 1) + log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, tempMap) + set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1) /* displayMapsMenu(id, g_menuPosition[id]) */ } } @@ -444,6 +491,7 @@ displayMapsMenu(id, pos) return new menuBody[512] + new tempMap[32] new start = pos * 8 new b = 0 @@ -460,7 +508,8 @@ displayMapsMenu(id, pos) for (new a = start; a < end; ++a) { keys |= (1<