Question

trevison
Активный

Столкнулся с проблемой, что когда кидают какое-нибудь предложение с продажей бизнеса или что-нибудь подобное, где нужно согласиться на Y или отказаться на N - открывается инвентарь ( инвентарь на Y )

так выглядит само открытие инвентаря:

if(!active_accept(playerid)  && GetPVarInt(playerid,"invstat") == -1) pc_cmd_inv(playerid);

сток active_accept: 

stock active_accept(playerid) {
    if(GetPVarInt(playerid,"invstat") != -1return 1;
    else return 0;
}

вот какие проверки используются при нажатии Y:

            pTemp[playerid][pSellHouseOffee] == playerid ||
            GetPVarInt(playerid,"dicedipl") == playerid ||
            pTemp[playerid][pSellBusinessOffee] == playerid ||
            pTemp[playerid][pSettleHouseOffee] == playerid ||
            pTemp[playerid][pSellFillingOffee] == playerid ||
            GetPVarInt(playerid,"repairoffee") == playerid ||
            GetPVarInt(playerid, "KeyDuel") == 1 ||
            GetPVarInt(playerid,"gunoffee") == playerid ||
            GetPVarInt(playerid,"selectpoint") == 2 ||
            GetPVarInt(playerid,"drugoffee") == playerid ||
            PlayerCreateShopObject[playerid] != 0 ||
            GetPVarInt(playerid, "TicketOffer") != 999

всё это я пробовал добавить в active_accept и инвентарь не открывался вообще

Share this post


Link to post

4 answers to this question

  • 0
Sleash
Завсегдатый

@trevison 

GetPVarInt(playerid,"invstat") != -1 ||     // Тут проверка проходит, переменная не равна -1 (INVALID_PLAYER_ID = 65535)
pTemp[playerid][pSellHouseOffee] ||         // Тут првоерка НЕ проходит, ибо переменная равна 0
GetPVarInt(playerid,"dicedipl") ||          // Тут проверка проходит, ибо переменная не равна 0 (65535)
pTemp[playerid][pSellBusinessOffee] ||      // Тут проверка проходит, ибо переменная не равна 0 (65535)
pTemp[playerid][pSettleHouseOffee] ||       // Тут проверка проходит, ибо переменная не равна 0 (65535)
pTemp[playerid][pSellFillingOffee] ||       // Тут проверка проходит, ибо переменная не равна 0 (-1)
GetPVarInt(playerid,"repairoffee") ||       // Тут првоерка НЕ проходит, ибо переменная равна 0
GetPVarInt(playerid, "KeyDuel") == 1 ||     // Тут првоерка НЕ проходит, ибо переменная равна 0, а должна 1
GetPVarInt(playerid,"gunoffee") ||          // Тут првоерка НЕ проходит, ибо переменная равна 0
GetPVarInt(playerid,"selectpoint") == 2 ||  // Тут првоерка НЕ проходит, ибо переменная равна 0
GetPVarInt(playerid,"drugoffee") ||         // Тут првоерка НЕ проходит, ибо переменная равна 0
PlayerCreateShopObject[playerid] != 0 ||    // Тут првоерка НЕ проходит, ибо переменная равна 0
GetPVarInt(playerid, "TicketOffer") != 999  // Тут првоерка НЕ проходит, ибо переменная равна 999

Я думаю проблема в установке переменных при подключении/спавна игрока или запуске мода
Кстати:

if(variable) //...
if(variable != 0//...
// Эти две проверки полностью идентичны при любых значениях, даже если они отрицательные

 

Share this post


Link to post
  • 0
Sleash
Завсегдатый

@trevison По данным отрезкам кода мало что можно сказать, разве что можете попробовать при нажатии Y для дебага выводить в консоль значения всех переменных:

printf("%d\'s ID pressed Y, vars: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d", playerid,
pTemp[playerid][pSellHouseOffee], GetPVarInt(playerid,"dicedipl"), pTemp[playerid][pSellBusinessOffee],
pTemp[playerid][pSettleHouseOffee], pTemp[playerid][pSellFillingOffee], GetPVarInt(playerid,"repairoffee"),
GetPVarInt(playerid, "KeyDuel"), GetPVarInt(playerid,"gunoffee"), GetPVarInt(playerid,"selectpoint"),
GetPVarInt(playerid,"drugoffee"), PlayerCreateShopObject[playerid], GetPVarInt(playerid, "TicketOffer"));

 

Share this post


Link to post
  • 0
trevison
Активный
stock active_accept(playerid)
{
    printf("%d\'s ID pressed Y, vars: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d", playerid,
    pTemp[playerid][pSellHouseOffee], GetPVarInt(playerid,"dicedipl"), pTemp[playerid][pSellBusinessOffee],
    pTemp[playerid][pSettleHouseOffee], pTemp[playerid][pSellFillingOffee], GetPVarInt(playerid,"repairoffee"),
    GetPVarInt(playerid, "KeyDuel"), GetPVarInt(playerid,"gunoffee"), GetPVarInt(playerid,"selectpoint"),
    GetPVarInt(playerid,"drugoffee"), PlayerCreateShopObject[playerid], GetPVarInt(playerid, "TicketOffer"));
    if(GetPVarInt(playerid,"invstat") != -1 ||
            pTemp[playerid][pSellHouseOffee] ||
            GetPVarInt(playerid,"dicedipl") ||
            pTemp[playerid][pSellBusinessOffee] ||
            pTemp[playerid][pSettleHouseOffee] ||
            pTemp[playerid][pSellFillingOffee] ||
            GetPVarInt(playerid,"repairoffee") ||
            GetPVarInt(playerid, "KeyDuel") == 1 ||
            GetPVarInt(playerid,"gunoffee") ||
            GetPVarInt(playerid,"selectpoint") == 2 ||
            GetPVarInt(playerid,"drugoffee") ||
            PlayerCreateShopObject[playerid] != 0 ||
            GetPVarInt(playerid, "TicketOffer") != 999return 1;
    else return 0;
}

0's ID pressed Y, vars: 65535, 0, 65535, 65535, 65535, -1, 0, 0, 0, 0, 0, 999 - console

Share this post


Link to post
  • 0
trevison
Активный

вроде получилось сделать таким кодом:

stock active_accept(playerid)
{
    if(GetPVarInt(playerid,"invstat") != -1 ||
            pTemp[playerid][pSellHouseOffee] == INVALID_PLAYER_ID ||
            GetPVarInt(playerid,"dicedipl") ||
            pTemp[playerid][pSellBusinessOffee] == INVALID_PLAYER_ID ||
            pTemp[playerid][pSettleHouseOffee] == INVALID_PLAYER_ID ||
            pTemp[playerid][pSellFillingOffee] == INVALID_PLAYER_ID ||
            GetPVarInt(playerid,"repairoffee") ||
            GetPVarInt(playerid, "KeyDuel") != 1 ||
            GetPVarInt(playerid,"gunoffee") ||
            GetPVarInt(playerid,"selectpoint") != 2 ||
            GetPVarInt(playerid,"drugoffee") ||
            GetPVarInt(playerid, "TicketOffer") != 999return 1;
    else return 0;
}

 

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Elvis
      By Elvis
      Идёт набор в команду по разработке CRMP-проекта! 
       
      Требуются специалисты на следующие роли:  
      - Технический администратор (1 человек)  
      - Технические разработчики (2 человека)  
      - Внутриигровые разработчики (5 человек)  
       
      Все подробности и условия обсудим лично — пишите руководителю в Telegram - @AntonLegost
    • Jasper231
      By Jasper231
      Идет набор в команду для создания CRMP MOBILE проекта. Нам нужны
      1) Кодеры
      2) Мапперы
      3) Люди которые вообще разбираются в создании серверов
       
      об зарпалте договоримся и об остальном поговорим в вк: @haslyyyim
    • otec
      By otec
      Копия радмира
      ║☑️Название CORVUS CRMP
      ║☑️Сервер у которого есть будущее и будет
      ║☑️Адекватная администрация
      ║☑️Идут наборы в Лидеры, Админы.
      ║☑️Вступайте в Telegram: t.me/corvusgta « Вступай!
      ║☑️Вступайте в ВКонтакте: vk.com/corvus_crmp « Вступай!
      ║☑️Постоянные ПРИЗЫ - МП | Интересный Мод
      ║☑️Все новости - обновления в Telegram и ВКонтакте
      ║☑️Сайт - corvus-crmp.ru
      ║☑️Форум - forum.corvus-crmp.ru
      ║☑️Скачать лаунчер - corvus-crmp.ru
      ║☑️Заходи мы ждем тебя
      ║☑️В случае возможных ошибок пишите сюда:@corvus_help_bot
    • vicegame
      By vicegame
      Доброго времени суток уважаемые форумчане
      Хочу представить наши услуги и цены:
      GTA SAMP от 75руб
      GTA CRMP от 75 руб
      GTA MTA от 120 руб
      Для каждого тарифа неограниченные слоты, оплата только за ресурсы 
      Удобная панель управления и широкий функционал 
      Работаем с 2023 года!
       
      Также имеются БЕСПЛАТНЫЕ тарифы для (ознакомительных целей)
       
      Мощные процессоры Ryzen 5950X (Германия)
       
      Платежная система YooKassa на борту:
      Банковские карты
      SberPay
      TinkoffPay
      Yoomoney

      Ссылка на хостинг: ТЫК