Question

Столкнулся с проблемой, что когда кидают какое-нибудь предложение с продажей бизнеса или что-нибудь подобное, где нужно согласиться на 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

@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

@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
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

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

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

    • DAYREK
      By DAYREK
      Приветствую, подготовили для вас игровой сайт. Все сделано с нуля.
       
      В систему входит:
      - Главная страница.
      - Магазин.
      - Новости.
      - Личный кабинет.
      Все системы работают, в личном кабинете отображаются данные о игроке, имущество, статистика и прочее, добавите туда по своему желанию еще что-нибудь.

      Основные языки системы:
      - HTML, CSS, JS, PHP
      База данных MySQL
       
      Если я увижу потенциал в данном сайте, буду выпускать обновления. Добавлю систему ЛК для администратора, с отслеживанием логов админов и игроков.
      Изменением настроек сервера и сайта, изменение темы сайта и прочее.

      Связь со мной тык

       
       
    • bogdan@gmail
      By bogdan@gmail
      Как исправить взрыв при создание тс через мод тоесть припосав его там создавая спавн авто