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

    • vexlinee
      By vexlinee
      Всем здравствуйте, сидел я на майнкрафт читиках и поднадоело, теперь хочу сделать студию либо свой крмп проектик
      Так вот вопросы:
      1. Какие программы лучше всего использовать для лаунчеров? В большенстве видел Android studio
      2. Как запустить сам мод, можно ли это сделать локально и быстро, или стоит переносить на хост 
      3. Про какой кеш говорят типы под лаунчерами 
      4. Как сделать установку сборки через лаунчер по кнопке играть