Posted May 9, 2023 · Report post Как сделать, что бы при выборе приза в переменную count извлекалось его количество (как с select_id ,только в вместо u_prise будет u_count) ? callback: prize_callback ( playerid ) { new rows, fields; cache_get_data ( rows, fields ) ; if ( ! rows ) { DeletePVar ( playerid, "ofm_list_page" ) ; new line_string [ 42 ] ; global_string [ 0 ] = EOS ; strcat ( global_string, "{"#cBL"}Аксессуары\n" ) ; strcat ( global_string, "{"#cBL"}Инвентарь\n" ) ; format ( line_string, 42, "{"#cWH"}Аптечки: {"#cBL"}%d\n", p_info [ playerid ] [ aidkit ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Бинты: {"#cBL"}%d\n", p_info [ playerid ] [ bandage ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Шины: {"#cBL"}%d\n", p_info [ playerid ] [ schiene ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Аспирин: {"#cBL"}%d\n", p_info [ playerid ] [ aspirin ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Морфий: {"#cBL"}%d\n", p_info [ playerid ] [ morphine ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Адреналин: {"#cBL"}%d\n", p_info [ playerid ] [ adrenalin ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Интерферон: {"#cBL"}%d\n", p_info [ playerid ] [ interferon ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Колдрекс: {"#cBL"}%d\n", p_info [ playerid ] [ koldrex ] ) ; strcat ( global_string, line_string ) ; show_dialog ( playerid, d_main_inventory, DIALOG_STYLE_LIST, "{"#cBL"}Инвентарь", global_string, "Выбрать", "Назад" ) ; SendClientMessage ( playerid, col_white, "{"#cGL"}[Информация] {"#cWH"}Ваш Инвентарь пуст." ) ; return 1 ; } SetPVarInt ( playerid, "ofm_list_rows", rows ) ; new rows_list = GetPVarInt ( playerid, "ofm_list_page" ) - 1 ; global_string [ 0 ] = EOS ; new line_string [ 300 ], prize_type, prize_count; strcat ( global_string, "{"#cBL"}Предыдущая страница\n{"#cBL"}Следующая страница\n{"#cWH"}" ) ; for ( new i = rows_list * 10 ; i < rows_list * 10 + 10 ; i ++ ) { if ( i >= rows ) break ; prize_type = cache_get_field_content_int ( i, "u_prise", sql_connection ) ; prize_count = cache_get_field_content_int ( i, "u_count", sql_connection ) ; format ( line_string, 16, "vpr_%d", i - rows_list * 10 ) ; SetPVarInt ( playerid, line_string, prize_type) ; format ( line_string, sizeof line_string, "%s (%d шт.)\n", prise_text [ prize_type ], prize_count ) ; strcat ( global_string, line_string ) ; } if (!(p_info[playerid][vip] < 1)) { new inv_count = get_player_inv_count(playerid); new inv_info[32]; format(inv_info, sizeof(inv_info), "Инвентарь (%d/Unlimited)", inv_count); show_dialog(playerid, d_prise, DIALOG_STYLE_LIST, inv_info, global_string, "Выбрать", "Назад"); } else { new inv_count = get_player_inv_count(playerid); new inv_info[32]; format(inv_info, sizeof(inv_info), "Инвентарь (%d/%d)", inv_count, p_info[playerid][invslot]); show_dialog(playerid, d_prise, DIALOG_STYLE_LIST, inv_info, global_string, "Выбрать", "Назад"); } return 1 ; } case d_prise: { if ( ! response ) { for ( new i = 0 ; i < 10 ; i ++ ) { new pvar_string [ 8 ] ; format ( pvar_string, sizeof ( pvar_string ), "vpr_%d", i ) ; DeletePVar ( playerid, pvar_string ) ; } if ( GetPVarInt ( playerid, "ofm_list_page" ) == 1 ) { DeletePVar ( playerid, "ofm_list_page" ) ; DeletePVar ( playerid, "ofm_list_rows" ) ; } new line_string [ 42 ] ; global_string [ 0 ] = EOS ; strcat ( global_string, "{"#cBL"}Аксессуары\n" ) ; strcat ( global_string, "{"#cBL"}Инвентарь\n" ) ; format ( line_string, 42, "{"#cWH"}Аптечки: {"#cBL"}%d\n", p_info [ playerid ] [ aidkit ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Бинты: {"#cBL"}%d\n", p_info [ playerid ] [ bandage ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Шины: {"#cBL"}%d\n", p_info [ playerid ] [ schiene ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Аспирин: {"#cBL"}%d\n", p_info [ playerid ] [ aspirin ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Морфий: {"#cBL"}%d\n", p_info [ playerid ] [ morphine ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Адреналин: {"#cBL"}%d\n", p_info [ playerid ] [ adrenalin ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Интерферон: {"#cBL"}%d\n", p_info [ playerid ] [ interferon ] ) ; strcat ( global_string, line_string ) ; format ( line_string, 42, "{"#cWH"}Колдрекс: {"#cBL"}%d\n", p_info [ playerid ] [ koldrex ] ) ; strcat ( global_string, line_string ) ; show_dialog ( playerid, d_main_inventory, DIALOG_STYLE_LIST, "{"#cBL"}Инвентарь", global_string, "Выбрать", "Назад" ) ; return 1 ; } if ( listitem == 0 ) { if ( GetPVarInt ( playerid, "ofm_list_page" ) == 1 ) { for ( new i = 0 ; i < 10 ; i ++ ) { new pvar_string [ 8 ] ; format ( pvar_string, sizeof ( pvar_string ), "vpr_%d", i ) ; DeletePVar ( playerid, pvar_string ) ; } DeletePVar ( playerid, "ofm_list_page" ) ; DeletePVar ( playerid, "ofm_list_rows" ) ; return 1 ; } else { new scm_string [ 128 ] ; mysql_format ( sql_connection, scm_string, sizeof ( scm_string ), "SELECT * FROM `users_prise` WHERE `u_id` = '%d'", p_info [ playerid ] [ id ] ) ; mysql_tquery ( sql_connection, scm_string, "prize_callback", "i", playerid ) ; SetPVarInt ( playerid, "ofm_list_page", GetPVarInt ( playerid, "ofm_list_page" ) - 1 ) ; } return 1 ; } else if ( listitem == 1 ) { if ( ofm_formula ( GetPVarInt ( playerid, "ofm_list_page" ) ) >= GetPVarInt ( playerid, "ofm_list_rows" ) ) { SendClientMessage ( playerid, col_white, "{"#cGL"}[Информация] {"#cWH"}Вы находитесь на последней странице инвентаря." ) ; new scm_string [ 128 ] ; mysql_format ( sql_connection, scm_string, sizeof ( scm_string ), "SELECT * FROM `users_prise` WHERE `u_id` = '%d'", p_info [ playerid ] [ id ] ) ; mysql_tquery ( sql_connection, scm_string, "prize_callback", "i", playerid ) ; SetPVarInt ( playerid, "ofm_list_page", GetPVarInt ( playerid, "ofm_list_page" ) ) ; return 1 ; } new scm_string [ 128 ] ; mysql_format ( sql_connection, scm_string, sizeof ( scm_string ), "SELECT * FROM `users_prise` WHERE `u_id` = '%d'", p_info [ playerid ] [ id ] ) ; mysql_tquery ( sql_connection, scm_string, "prize_callback", "i", playerid ) ; SetPVarInt ( playerid, "ofm_list_page", GetPVarInt ( playerid, "ofm_list_page" ) + 1 ) ; return 1 ; } new pvar_string [ 64 ] ; format ( pvar_string, 16, "vpr_%d", listitem - 2 ) ; new select_id = GetPVarInt ( playerid, pvar_string ) ; for ( new i = 0 ; i < 10 ; i ++ ) { format ( pvar_string, sizeof ( pvar_string ), "vpr_%d", i ) ; DeletePVar ( playerid, pvar_string ) ; } DeletePVar ( playerid, "ofm_list_page" ) ; DeletePVar ( playerid, "ofm_list_rows" ) ; format ( pvar_string, sizeof pvar_string, "{"#cBL"}%s", prise_text [ select_id ] ) ; show_dialog ( playerid, d_prise_select, DIALOG_STYLE_LIST, pvar_string, "{"#cBL"}1. {"#cWH"}Использовать\n{"#cBL"}2. {"#cWH"}Продать\n{"#cBL"}3. {"#cWH"}Выкинуть\n{"#cBL"}4. {"#cWH"}Информация", "Выбрать", "Назад" ) ; SetPVarInt ( playerid, "prise_select", select_id ) ; return 1 ; } 0 Заметка от keyl , создано May 9, 2023 3.2. Код необходимо брать в тег "Код", а код более 10 строк – еще и в "Спойлер". Как это сделать рассказано в разделе "FAQ". Устное предупреждение. Share this post Link to post
0 Posted May 9, 2023 · Report post Вопрос решен. Тема закрыта по просьбе пользователя. 0 Share this post Link to post
Posted · Report post
Как сделать, что бы при выборе приза в переменную count извлекалось его количество (как с select_id ,только в вместо u_prise будет u_count) ?
Заметка от keyl , создано
3.2. Код необходимо брать в тег "Код", а код более 10 строк – еще и в "Спойлер". Как это сделать рассказано в разделе "FAQ".
Устное предупреждение.
Share this post
Link to post