Jak zmusić gracza do wywołania menu z inne...
Najlepsza odpowiedź Asiap 26.11.2016 22:49
nie zmieni to tylko rodzaj funkcji
stock to funkcja prywatna i gdy nie jest uzywana to kompilator nie pokaze o tym informacji
public to funkcja publiczna i tak samo nie bedzie info jesli nie jest uzywana, tylko taka funkcja moze byc uzywana w np. set_task, calfunc_ itd
Przejdź do postu
Gasior
07.10.2016
Witam,
Tworze /menu, dla graczy na serwerze. Gdy wybierze się opcję 5 - Lista Map, gracz wpisuje /mapy i wyświetla mu się menu z galileo 2.6.1 w którym naciskając na mapę w menu może ją nominować.
Czyli
case 5: { client_cmd(id, "say", "/mapy"); }
aczkolwiek nie jest to takie proste bo kod z galileo jest skomplikowany i o ile gracz wpisuje tą komendę na czacie to nie wykonuje ona poleceń z galileo.
Czy jest jakaś furtka którą można to obejść?
RomanHardcor
07.10.2016
Jedyne co mi przychodzi do głowy to dodać w kodzie galileo w plugin_init
register_clcmd("say /menugalileo", "funkcja menu galileo nie wiem jak tam masz");
I w to główne menu dla graczy dać
client_cmd(id, "say /menugalileo");
Gasior
08.10.2016
Nie dziala w taki sposob, gdyz to sa dwa odmienne pluginy. Gracz wpisuje /mapy, ale poniewaz "say" jest wymuszony nie dziala to. Gdy sam napisze /mapy to nie ma problemu. To samo jest z inna komenda, polaczylem pluginy od menu i modeli, gdy gracz wpisuje /modele to kolejne menu sie wyswietla ale opcja w nim zatwierdzona nie ma skutku. Dopiero gdy wpisze /modele samodzielnie to opcja dziala. Wyglada na to, ze nie ma na to sposobu.
RomanHardcor
08.10.2016
Menu jest np tak moje zbudowane z wymuszania komend.
A jakby zrobić pętlę?
Gasior
10.10.2016
Czyli że z mojego pluginu menu powinienem zrobić bibliotekę do galileo czy na odwrót?
Asiap
02.11.2016
if(callfunc_begin("nazwa_funkcji", "nazwa_pluginu.amxx")) { callfunc_push_int(id); callfunc_end(); }
Gasior
24.11.2016
#include <amxmodx> #include <cstrike> #define MENUITEM_DISABLED (1<<26) public plugin_init() { register_plugin("Gasior Menu", "1.0", "Gasior"); register_clcmd("say /menu", "Menu"); register_clcmd("say_team /menu", "Menu"); } //lets make the function that will make the menu public Menu( id ) { //first we need to make a variable that will hold the menu new menu = menu_create( "\rWybierz jedna z dostepnych opcji:", "menu_handler" ); //Note - menu_create //The first parameter is what the menu will be titled ( what is at the very top ) //The second parameter is the function that will deal/handle with the menu ( which key was pressed, and what to do ) //Now lets add some things to select from the menu menu_additem( menu, "\yZakup VIPa!", "", 0 ); menu_additem( menu, "\yCo Oferuje VIP?", "", 0 ); menu_additem( menu, "\rZloz Podanie na Admina!", "", 0 ); menu_additem( menu, "\wCzym jest Bywalec?", "", 0 ); menu_additem( menu, "\wKlasyfikacja Ogolna", "", 0); menu_additem( menu, "\wMapy", "", 0); menu_setprop( menu, MPROP_EXIT, MEXIT_ALL ); //Note - menu_setprop //The first parameter is the menu to modify //The second parameter is what to modify ( found in amxconst.inc ) //The third parameter is what to modify it to ( in this case, we are adding a option to the menu that will exit the menu. setting it to MEXIT_NEVER will disable this option ) //Additional note - MEXIT_ALL is the default property for MPROP_EXIT, so this is redundant //Lets display the menu menu_display( id, menu, 0 ); //Note - menu_display //The first parameter is which index to show it to ( you cannot show this to everyone at once ) //The second parameter is which menu to show them ( in this case, the one we just made ) //The third parameter is which page to start them on } //okay, we showed them the menu, now lets handle it ( looking back at menu_create, we are going to use that function ) public menu_handler( id, menu, item ) { //Because of the simplicity of this menu, we can switch for which item was pressed //Note - this is zero-based, so the first item is 0 switch( item ) { case 0: { show_motd(id, "sklepsms.txt", "Kupno Vipa"); } case 1: { show_motd(id, "vip.txt", "Co Oferuje VIP?"); } case 2: { show_motd(id, "podanie.txt", "Zloz Podanie"); } case 3: { show_motd(id, "bywalec.txt", "Czym jest Bywalec?"); } case 4: { //client_print(id, print_center, "/mapy"); show_motd(id, "klasyfikacja.txt", "Klasyfikacja"); } case 5: { if(callfunc_begin("nomination_menu", "galileo.amxx")) { callfunc_push_int(id); callfunc_end(); } } } menu_destroy( menu ); return PLUGIN_HANDLED; }
Wygląda to teraz tak, tylko dalej nie reaguje.
Coś źle zrobiłem?
Gasior
26.11.2016
stock nomination_menu( player_id ) { // gather all maps that match the nomination new mapIndex; new info[ 1 ]; new choice[ MAX_MAPNAME_LENGHT + 32 ]; new nominationMap[ MAX_MAPNAME_LENGHT ]; new disabledReason[ 16 ]; buildTheNominationsMenu( player_id ); for( mapIndex = 0; mapIndex < g_nominationMapCount; mapIndex++ ) { ArrayGetString( g_nominationMap, mapIndex, nominationMap, charsmax( nominationMap ) ); info[ 0 ] = mapIndex; // in most cases, the map will be available for selection, so assume that's the case here disabledReason[ 0 ] = '^0'; if( nomination_getPlayer( mapIndex ) ) // disable if the map has already been nominated { formatex( disabledReason, charsmax( disabledReason ), "%L", player_id, "GAL_MATCH_NOMINATED" ); } else if( map_isTooRecent( nominationMap ) ) // disable if the map is too recent { formatex( disabledReason, charsmax( disabledReason ), "%L", player_id, "GAL_MATCH_TOORECENT" ); } else if( equal( g_currentMap, nominationMap ) ) // disable if the map is the current map { formatex( disabledReason, charsmax( disabledReason ), "%L", player_id, "GAL_MATCH_CURRENTMAP" ); } formatex( choice, charsmax( choice ), "%s %s", nominationMap, disabledReason ); menu_additem( g_generalUsePlayersMenuId[ player_id ], choice, info, ( disabledReason[ 0 ] == '^0' ? 0 : ( 1 << 26 ) ) ); DEBUG_LOGGER( 0, "( nomination_menu ) choice: %s, info[0]: %d", choice, info[ 0 ] ); } menu_display( player_id, g_generalUsePlayersMenuId[ player_id ] ); }
Asiap
26.11.2016
to jest stock a nie publiczna funkcja wiec to nie zadziala
zmien stock na public i skompiluj ponownie galileo
Najlepsza odpowiedź
Asiap
26.11.2016
nie zmieni to tylko rodzaj funkcji
stock to funkcja prywatna i gdy nie jest uzywana to kompilator nie pokaze o tym informacji
public to funkcja publiczna i tak samo nie bedzie info jesli nie jest uzywana, tylko taka funkcja moze byc uzywana w np. set_task, calfunc_ itd