Вопросы

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 и инвентарь не открывался вообще

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


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

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

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

 

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


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

 

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


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

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


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

 

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


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

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

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

    • grizly57a
      От grizly57a
      вот логи 
       
       
      ---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3.7-R2, (C)2005-2015 SA-MP Team [16:41:25] [16:41:25] Server Plugins [16:41:25] -------------- [16:41:25] Loading plugin: crashdetect.so [16:41:25] CrashDetect plugin 4.19.4 [16:41:25] Loaded. [16:41:25] Loading plugin: pawncmd.so [16:41:25] Pawn.CMD plugin v3.2.0 by urShadow has been loaded [16:41:25] Loaded. [16:41:25] Loading plugin: pawnraknet.so [16:41:25] [Pawn.RakNet] plugin v1.6.0 loading... [16:41:25] [Pawn.RakNet] | Pawn.RakNet 1.6.0 | 2016 - 2023 |-------------------------------- | Author and maintainer: katursis | Compiled: Feb 12 2023 at 19:35:06 |-------------------------------------------------------------- | Repository: https://github.com/katursis/Pawn.RakNet |-------------------------------------------------------------- | Wiki: https://github.com/katursis/Pawn.RakNet/wiki [16:41:25] Loaded. [16:41:25] Loading plugin: sscanf.so [16:41:25] [16:41:25] =============================== [16:41:25] sscanf plugin loaded. [16:41:25] Version: 2.8.3 [16:41:25] (c) 2018 Alex "Y_Less" Cole [16:41:25] =============================== [16:41:25] Loaded. [16:41:25] Loading plugin: streamer.so [16:41:25] *** Streamer Plugin v2.9.4 by Incognito loaded *** [16:41:25] Loaded. [16:41:25] Loading plugin: mysql_static.so [16:41:25] >> plugin.mysql: R39-6 successfully loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: TOTP.so [16:41:25] TOTP plugin v1.0.1 by Games loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: profiler.so [16:41:25] Profiler plugin 2.15.1 [16:41:25] Loaded. [16:41:25] Loading plugin: timerfix.so [16:41:25] >> TimerFix v1.5 successfully loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: UTuning.so [16:41:25] Loaded. [16:41:25] Loading plugin: housecar.so [16:41:25] Loaded. [16:41:25] Loading plugin: TOTP.so [16:41:25] TOTP plugin v1.0.1 by Games loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: FCNPC.so [16:41:25] [16:41:25] ------------------------------------------------- [16:41:25] FCNPC - Fully Controllable NPC v2.0.9 [16:41:25] GNU/Linux SA-MP 0.3.7 R2 [16:41:25] Apr 17 2024 at 09:11:36 [16:41:25] [16:41:25] Author: OrMisicL (2013 - 2015) [16:41:25] Continued by: ziggi (2016 - present) [16:41:25] [16:41:25] See full credits in the README.md file [16:41:25] ------------------------------------------------- [16:41:25] [16:41:25] Loading... [16:41:25] [16:41:25] ------------------------------------------------- [16:41:25] ColAndreasv1.4.0 [16:41:25] [16:41:25] Created By: [16:41:25] [uL]Chris42O [16:41:25] [uL]Slice [16:41:25] [uL]Pottus [16:41:25] ------------------------------------------------- [16:41:25] [16:41:25] Loading... [16:41:25] ColAndreas v1.4.0 Loaded. [16:41:25] Loaded. [16:41:25] Loaded 13 plugins. [16:41:25] [16:41:25] Filterscripts [16:41:25] --------------- [16:41:25] Loading filterscript 'voice.amx'... [16:41:25] No collision data found. [16:41:25] [FCNPC] Warning: Unable to create NPCs. The maxnpc limit in server.cfg is 0. [16:41:25] -------------------------------------- [16:41:25] VOICE COPY RADMIR BY ������ dev. [16:41:25] -------------------------------------- [16:41:25] Loaded 1 filterscripts. [16:41:25] *** Streamer Plugin: Include file version (0x295) does not match plugin version (0x294) (script might need to be recompiled with the correct include file). [16:41:25] ------------------------------------------ [16:41:25] SSSS [16:41:25] ------------------------------------------ [16:41:25] mapname = "San Andreas" (string) [16:41:25] [Vehicle]: ��� ������������ �������� ������� [16:41:25] [TP]: ��� �����/������ ������� [16:41:25] [ATM]: ��� ��������� ������� [16:41:25] ����������� � ���� ������ �� ������� [������� � ����� ������ ����������] [16:41:25] ----------------------------------------- [16:41:25] [16:41:25] [16:41:25] [16:41:25] ----------------------------------------- [16:41:25] Number of vehicle models: 55 [16:42:00] [connection] 93.159.241.195:2395 requests connection cookie. [16:42:01] [connection] incoming connection: 93.159.241.195:2395 id: 0 [16:42:02] [join] Dkak_wlaas has joined the server (0:93.159.241.195) [16:42:02] [part] Dkak_wlaas has left the server (0:2)