Вопросы

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

Поделиться сообщением


Ссылка на сообщение

4 ответа на этот вопрос

  • 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//...
// Эти две проверки полностью идентичны при любых значениях, даже если они отрицательные

 

Поделиться сообщением


Ссылка на сообщение
  • 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"));

 

Поделиться сообщением


Ссылка на сообщение
  • 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

Поделиться сообщением


Ссылка на сообщение
  • 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;
}

 

Поделиться сообщением


Ссылка на сообщение
Гость
Эта тема закрыта для публикации ответов.
  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

  • Похожий контент

    • Kutuzov
      От Kutuzov
      Всем привет, хотелось бы спросить у тех, кто разбирается в PluginSDK.
      Какие есть источники, руководства, документации о PluginSDK?
      Я пока что ничего нормального не нахожу.
      Заранее спасибо