openmultiplayer / open.mp

Open Multiplayer, a multiplayer mod fully backwards compatible with SA-MP
https://open.mp
Mozilla Public License 2.0
453 stars 92 forks source link

GangZones error #897

Closed MatheusAgL closed 6 months ago

MatheusAgL commented 6 months ago

Describe the bug Every time the server is restarted when it comes back, and a player disconnects, this error is presented by CrashDetect

To Reproduce Steps to reproduce the behavior: Restart the server The first player who lodges

Expected behavior Do not crashed

Screenshots and/or logs


[2024-03-19T11:10:40-0300] [Info] [debug] Native backtrace:
[2024-03-19T11:10:40-0300] [Info] [debug] #0 5d953cf4 in ?? () in components\GangZones.dll
[2024-03-19T11:10:40-0300] [Info] [debug] #1 00fe6d84 in ?? () in omp-server.exe
[2024-03-19T11:10:40-0300] [Info] [debug] #2 7bd3fcee in ?? () in components\LegacyNetwork.dll
[2024-03-19T11:10:40-0300] [Info] [debug] #3 00fafe2e in ?? () in omp-server.exe
[2024-03-19T11:10:40-0300] [Info] [debug] #4 00fa92a6 in ?? () in omp-server.exe
[2024-03-19T11:10:40-0300] [Info] [debug] #5 011cea90 in ?? () in omp-server.exe
[2024-03-19T11:10:40-0300] [Info] [debug] #6 76a67ba9 in ?? () in C:\WINDOWS\System32\KERNEL32.DLL
[2024-03-19T11:10:40-0300] [Info] [debug] #7 776fbdab in ?? () in C:\WINDOWS\SYSTEM32\ntdll.dll
[2024-03-19T11:10:40-0300] [Info] [debug] #8 776fbd2f in ?? () in C:\WINDOWS\SYSTEM32\ntdll.dll
[2024-03-19T11:10:40-0300] [Info] [debug] Registers:
[2024-03-19T11:10:40-0300] [Info] [debug] EAX: 00000000 EBX: 038e0140 ECX: 08d65600 EDX: 04939e08
[2024-03-19T11:10:40-0300] [Info] [debug] ESI: 03968070 EDI: 04939e0e EBP: 0137f974 ESP: 0137f904
[2024-03-19T11:10:40-0300] [Info] [debug] EIP: 5d953cf4 EFLAGS: 00010293
[2024-03-19T11:10:40-0300] [Info] [debug] Stack:
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000000: c52fa9d6 c2b0b6a1 4105c433 44c3c000
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000020: 03968070 00000009 04939e0e 0346e108
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000040: 04939e08 08d65600 0950ed10 03968060
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000060: 00000002 038e0110 000080da 038e0140
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000080: 000080da e4666864 01c3dd85 035a8b9c
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000000a0: 00000000 01370000 c52fa9d6 c2b0b6a1
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000000c0: 00000000 0137f9e4 000080da 040279d4
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000000e0: 00000098 00000098 00000098 0a276f48
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000100: 0000c193 00008664 0000014c 092ec148
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000120: 00000000 7ffef000 00000001 00000006
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000140: 00000143 7b203c1d 7b1dafe6 08b858b1
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000160: 08b858b1 0137fa9c 55fd530a 092ec168
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000180: 00000000 092ec160 55fd5500 08b8577c
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000001a0: 092ec160 092ec148 0137fad8 7bdf9624
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000001c0: 08b8577c 092ec160 0137fb20 7b073d98
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000001e0: 000080da 0137fb40 7be201bf 000013c5
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000200: 000080da 0346e0d0 0950e8d4 04027940
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000220: 0137f9e4 0137fd50 7bd49000 00000000
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000240: 00fafe2e 000013c5 00000000 e462e914
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000260: e462e914 e462e914 000080da 00000000
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000280: 0e7f25c8 00001388 00000000 0346e020
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000002a0: 00000000 00000000 0137fbbc 0137fbbc
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000002c0: 00000004 00000004 00000039 0000003f
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000002e0: 00000017 0000001f 01956060 01007470
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000300: 01956588 01007470 0137fd68 00fa8f13
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000320: 018d73c8 018f3c68 018f3c80 018f3c80
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000340: 018d00d0 018d0110 018d0110 00000007
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000360: 018c75c0 012621c8 012621c8 00000000
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+00000380: 6867696c 01370074 00000001 00000039
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000003a0: 019599a0 01959988 3f800000 019565b0
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000003c0: 00000007 00000008 3f800000 019561c8
[2024-03-19T11:10:40-0300] [Info] [debug] ESP+000003e0: 00000007 00000008 69766e00 00000000
[2024-03-19T11:10:40-0300] [Info] [debug] Loaded modules:
[2024-03-19T11:10:40-0300] [Info] [debug] 00fa0000 - 01280000 omp-server.exe
[2024-03-19T11:10:40-0300] [Info] [debug] 77690000 - 77841000 ntdll.dll
[2024-03-19T11:10:40-0300] [Info] [debug] 76a50000 - 76b40000 KERNEL32.DLL
[2024-03-19T11:10:40-0300] [Info] [debug] 75040000 - 75055000 aswhook.dll
[2024-03-19T11:10:40-0300] [Info] [debug] 77270000 - 774e4000 KERNELBASE.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 757d0000 - 7582f000 WS2_32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 76b40000 - 76bfa000 RPCRT4.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 763b0000 - 76a4a000 SHELL32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 775d0000 - 77649000 msvcp_win.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 75b80000 - 75c92000 ucrtbase.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 770c0000 - 77268000 USER32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 77660000 - 7767a000 win32u.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 76cd0000 - 76cf3000 GDI32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 762c0000 - 763a2000 gdi32full.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 76e30000 - 76f33000 CRYPT32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 76c50000 - 76ccf000 ADVAPI32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 76d60000 - 76e24000 msvcrt.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 75df0000 - 75e75000 sechost.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 756f0000 - 7570a000 bcrypt.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 72a40000 - 72a71000 WINMM.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 55fc0000 - 5602d000 MSVCP140.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 55fa0000 - 55fb5000 VCRUNTIME140.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 76c20000 - 76c45000 IMM32.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 5dbc0000 - 5dbe2000 Actors.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5dba0000 - 5dbbc000 Checkpoints.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5db80000 - 5db9f000 Classes.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5db40000 - 5db7b000 Console.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5dad0000 - 5db3c000 CustomModels.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 78c60000 - 78d27000 Databases.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5dab0000 - 5dacd000 Dialogs.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7a680000 - 7ab4d000 discord-connector.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5da50000 - 5daa5000 log-core2.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5da30000 - 5da4f000 Fixes.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5d950000 - 5d971000 GangZones.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 77860000 - 77885000 LegacyConfig.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7bd20000 - 7bdcd000 LegacyNetwork.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 79070000 - 79091000 Menus.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 790a0000 - 790d2000 Objects.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7bdf0000 - 7bf78000 Pawn.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 759a0000 - 759eb000 SHLWAPI.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7bbf0000 - 7bc87000 pawnraknet.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5d9e0000 - 5da00000 Pickups.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7c7f0000 - 7c815000 TextDraws.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7bcf0000 - 7bd14000 TextLabels.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 5d930000 - 5d949000 Timers.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 05fe0000 - 07c8c000 Unicode.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7c820000 - 7c83d000 Variables.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7bfc0000 - 7bfef000 Vehicles.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 74790000 - 747a5000 CRYPTSP.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 74760000 - 74790000 rsaenh.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 747b0000 - 747bb000 CRYPTBASE.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 75580000 - 755e2000 bcryptPrimitives.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 737e0000 - 737f3000 kernel.appcore.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 73800000 - 73851000 mswsock.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 74f70000 - 7502d000 DNSAPI.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 75160000 - 75184000 IPHLPAPI.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 76f40000 - 76f47000 NSI.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 72840000 - 72848000 rasadhlp.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 71ce0000 - 71d3d000 fwpuclnt.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7b6a0000 - 7b729000 crashdetect.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 7af20000 - 7b00e000 MSVCR120.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7b730000 - 7b7a1000 MSVCP120.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7b7b0000 - 7b7da000 sscanf.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 7b040000 - 7b08e000 mysql.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 7b090000 - 7b15d000 libmariadb.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7b7e0000 - 7b7fa000 log-core.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 75150000 - 7515a000 Secur32.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 749f0000 - 74a1b000 SSPICLI.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 73d80000 - 73d92000 napinsp.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 73860000 - 73876000 pnrpnsp.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 74f60000 - 74f6e000 winrnr.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 72e10000 - 72e21000 wshbth.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 72df0000 - 72e08000 nlansp_c.dll
[2024-03-19T11:10:41-0300] [Info] [debug] 7b1b0000 - 7b21d000 streamer.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 5da20000 - 5da2f000 mapandreas.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 7b180000 - 7b1a9000 chrono.DLL
[2024-03-19T11:10:41-0300] [Info] [debug] 72830000 - 7283e000 MSASN1.dll```
**Release version**
omp 1.2.0.2670
AmyrAhmady commented 6 months ago

Please provide a script that causes this problem on restart and player disconnect

MatheusAgL commented 6 months ago

    #endinput
#endif
#define _inc_safezones true

#include <YSI_Coding\y_hooks>

#define COLOR_SAFEZONE      0x9AFBD890
#define C_SAFEZONE          "9AFBD8"
#define MAX_SAFE_ZONES      10

enum ENUM_SAFE_ZONE {
    safeID,
    safeGZ,
    safeName[35],
    Float:safeMinX,
    Float:safeMinY,
    Float:safeMaxX,
    Float:safeMaxY,
    gzInt,
    gzWorld,
};
static SafeZone[MAX_SAFE_ZONES][ENUM_SAFE_ZONE];
static bool:playerInSafeZone[MAX_PLAYERS];
static Timer:timer_safe_set[MAX_PLAYERS];

stock SafeZone_SetID(safe, id)
    SafeZone[safe][safeID] = id;

stock SafeZone_SetName(safe, const name[])
    format(SafeZone[safe][safeName], 35, name);

stock SafeZone_SetMinX(safe, Float:min_x)
    SafeZone[safe][safeMinX] = min_x;

stock SafeZone_SetMinY(safe, Float:min_y)
    SafeZone[safe][safeMinY] = min_y;

stock SafeZone_SetMaxX(safe, Float:max_x)
    SafeZone[safe][safeMaxX] = max_x;

stock SafeZone_SetMaxY(safe, Float:max_y)
    SafeZone[safe][safeMaxY] = max_y;

stock SafeZone_SetInterior(safe, interior)
    SafeZone[safe][gzInt] = interior;

stock SafeZone_SetWorld(safe, world)
    SafeZone[safe][gzWorld] = world;

stock IsPlayerInSafeZone(playerid)
    return playerInSafeZone[playerid];

// ------------------------ Sistema de Zona segura ------------------------
new Iterator: SafeZones<MAX_SAFE_ZONES>;

static 
        Statement: stmt_insertSafeZone,
        Statement: stmt_selectSafeZone,
        Statement: stmt_deleteSafeZone;

hook OnMySQLConnected() 
{
    static const query_insertSafeZone[] = 
        "INSERT INTO `safe_zone` (`id`, `name`, `min_x`, `min_y`, `max_x`, `max_y`, `interior`, `world`) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)"
    ;
    stmt_insertSafeZone = MySQL_PrepareStatement(MySQL_Handle, query_insertSafeZone);

    static const query_selectSafeZone[] = 
        "SELECT id, name, min_x, min_y, max_x, max_y, interior, world FROM `safe_zone` LIMIT ?"
    ;
    stmt_selectSafeZone = MySQL_PrepareStatement(MySQL_Handle, query_selectSafeZone);

    static const query_deleteSafeZone[] = 
        "DELETE FROM `safe_zone` WHERE `id` = ?"
    ;
    stmt_deleteSafeZone = MySQL_PrepareStatement(MySQL_Handle, query_deleteSafeZone);
    return 1;
}

hook OnGameModeInit()
{
    inline const OnLoadSafeZones() 
    {
        new name[35],
            Float:min_x,
            Float:min_y,
            Float:max_x,
            Float:max_y,
            interior,
            world;

        MySQL_BindResult(stmt_selectSafeZone, 1, name);
        MySQL_BindResultFloat(stmt_selectSafeZone, 2, min_x);
        MySQL_BindResultFloat(stmt_selectSafeZone, 3, min_y);
        MySQL_BindResultFloat(stmt_selectSafeZone, 4, max_x);
        MySQL_BindResultFloat(stmt_selectSafeZone, 5, max_y);
        MySQL_BindResultInt(stmt_selectSafeZone, 6, interior);
        MySQL_BindResultInt(stmt_selectSafeZone, 7, world);

        while (MySQL_Statement_FetchRow(stmt_selectSafeZone)) {
            SafeZone_Create(name, min_x, min_y, max_x, max_y, interior, world);
        }

        new count = Iter_Count(SafeZones);
        printf("[SafeZones]: %d carregadas...", count);
    }
    MySQL_BindInt(stmt_selectSafeZone, 0, MAX_SAFE_ZONES);
    MySQL_ExecuteParallel_Inline(stmt_selectSafeZone, using inline OnLoadSafeZones);
    return 1;
}

hook OnPlayerConnect(playerid)
{
    SafeZones_ShowForPlayer(playerid);
    return 1;
}

hook OnPlayerDisconnect(playerid, reason)
{
    playerInSafeZone[playerid] = false;
    return 1;
}

timer Timer_SetPlayerSafeZone[1000 * 60](playerid) {
    SendClientMessage(playerid, -1, "Você foi definido como protegido por area neutra");
    return playerInSafeZone[playerid] = true;
}

hook OnPlayerEnterGangZone(playerid, zoneid) 
{
    foreach (new safe : SafeZones) {
        if (zoneid == SafeZone[safe][safeGZ]) {
            ShowPlayerBaloonInfo(playerid, "Voce entrou em uma ~g~area segura~w~, em 1 minuto estara ~g~~h~protegido.", 5000);
            timer_safe_set[playerid] = defer Timer_SetPlayerSafeZone(playerid);
        }
    }
    return 1;
}

hook OnPlayerLeaveGangZone(playerid, zoneid) 
{
    foreach (new safe : SafeZones) {
        if (zoneid == SafeZone[safe][safeGZ]) {
            stop timer_safe_set[playerid];
            ShowPlayerBaloonInfo(playerid, "Voce saiu de uma ~g~area segura", 5000);
            playerInSafeZone[playerid] = false;
        }
    }
    return 1;
}

stock SafeZone_Insert(id, const name[], Float: min_x, Float: min_y, Float: max_x, Float: max_y, interior, world) {
    MySQL_BindInt(stmt_insertSafeZone, 0, id);
    MySQL_Bind(stmt_insertSafeZone, 1, name);
    MySQL_BindFloat(stmt_insertSafeZone, 2, min_x);
    MySQL_BindFloat(stmt_insertSafeZone, 3, min_y);
    MySQL_BindFloat(stmt_insertSafeZone, 4, max_x);
    MySQL_BindFloat(stmt_insertSafeZone, 5, max_y);
    MySQL_BindInt(stmt_insertSafeZone, 6, interior);
    MySQL_BindInt(stmt_insertSafeZone, 7, world);
    MySQL_ExecuteThreaded(stmt_insertSafeZone);
}

stock SafeZone_Create(const name[], Float:min_x, Float:min_y, Float:max_x, Float:max_y, interior = 0, world = 0) {
    new id = Iter_Free(SafeZones);

    if (id != -1) {
        Iter_Add(SafeZones, id);

        SafeZone_SetID(id, id);
        SafeZone_SetName(id, name);
        SafeZone_SetMinX(id, min_x);
        SafeZone_SetMinY(id, min_y);
        SafeZone_SetMaxX(id, max_x);
        SafeZone_SetMaxY(id, max_y);
        SafeZone_SetInterior(id, interior);
        SafeZone_SetWorld(id, world);

        if (interior == 0)
            SafeZone[id][safeGZ] = GangZoneCreate(min_x, min_y, max_x, max_y);

        UseGangZoneCheck(SafeZone[id][safeGZ], true);
        GangZoneShowForAll(SafeZone[id][safeGZ], COLOR_SAFEZONE);

        return 1;
    }
    return 0;
}

stock SafeZone_Destroy(safe) {
    new id = Iter_Contains(SafeZones, safe);

    if (id != -1) {
        Iter_Remove(SafeZones, safe);
        GangZoneDestroy(SafeZone[safe][safeGZ]);

        MySQL_BindInt(stmt_deleteSafeZone, 0, SafeZone[safe][safeID]);
        MySQL_ExecuteThreaded(stmt_deleteSafeZone);
    }
}

stock SafeZone_IsPlayerIn(playerid) {
    foreach (new safe : SafeZones) if (IsPlayerInGangZone(playerid, safe)) {
        return safe;
    }
    return -1;
}

stock SafeZones_ShowForPlayer(playerid) {
    foreach (new safe : SafeZones) GangZoneShowForPlayer(playerid, SafeZone[safe][safeGZ], COLOR_SAFEZONE);
}```
Vince0789 commented 6 months ago

Please provide a minimum, complete and verifiable example that still causes the bug; i.e. I should be able to reproduce the problem without the use of any third-party libraries.


For instance, you are using several y_iterate functions incorrectly:

MatheusAgL commented 6 months ago

Thanks for the information about code errors, I made the corrections due.

I found that the error was for not using GangZoneDestroy in OnGameModeExit.