Показать сообщение отдельно

  #7591  
Старый 12.08.2025, 01:35
swlm
Познающий
Регистрация: 03.08.2022
Сообщений: 57
С нами: 1990627

Репутация: 8
По умолчанию

Выводило 0, до того, пока код не изменил вот так:

cpp:





Код:
uintptr_t* getPlayerEntity() {
    uintptr_t player_pool = getPlayerPool();
    uintptr_t local_info = player_pool + 0x2F14;
    uintptr_t* local_player = reinterpret_cast(local_info + 0x26);
    uintptr_t samp_ped = *local_player;
    uintptr_t game_ped = samp_ped + 0x2A4;

    return &game_ped;
}

CVector* getPos() {
    uintptr_t* gamePed = getPlayerEntity();
    if (gamePed != nullptr) {
        return reinterpret_cast(0x4043A0)(gamePed);
    }

    //return CVector(1.0, 5.0, 10.0);
}


И вылет с ошибкой: Память не может быть Read.

А был вот такой код, до момента вылета:

cpp:





Код:
[CODE title="cpp"]uintptr_t getPlayerEntity() {
    uintptr_t player_pool = getPlayerPool();
    uintptr_t local_info = player_pool + 0x2F14;
    uintptr_t* local_player = reinterpret_cast(local_info + 0x26);
    uintptr_t samp_ped = *local_player;
    uintptr_t game_ped = samp_ped + 0x2A4;

    return game_ped;
}

CVector* getPos() {
    uintptr_t gamePed = getPlayerEntity();
    if (&gamePed != nullptr) {
        return reinterpret_cast(0x4043A0)(gamePed);
    }

    //return CVector(1.0, 5.0, 10.0);
}


[/CODE]

Цитата:
Сообщение от вайега52  

Значит неправильно подключаешь)

Если используешь визуалку, то копируешь псдк с гита, запускаешь его инсталлер, ставишь в первом поле путь до папки, где у тебя плагинсдк лежит, потом выбираешь версию визуалки, генерируешь проект, билдишь.

В своём проекте в настройках пишешь путь до .lib файла псдк и до заголовочных файлов
Так всё и сделано, смотри, вот такая конфигурация:

cpp:





Код:
  
    
      Debug
      Win32
    
    
      Release
      Win32
    
    
      Debug
      x64
    
    
      Release
      x64
    
  
  
    17.0
    Win32Proj
    {ab886c38-1f59-43d8-9935-abe2983b5637}
    sampvoice
    10.0
  
  
  
    DynamicLibrary
    true
    v143
    Unicode
  
  
    DynamicLibrary
    false
    v143
    true
    Unicode
    
    
  
  
    DynamicLibrary
    true
    v143
    Unicode
  
  
    DynamicLibrary
    false
    v143
    true
    Unicode
  
  
  
  
  
  
  
    
  
  
    
  
  
    
  
  
    
  
  
  
    
      Level3
      true
      WIN32;_DEBUG;SAMPVOICE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
      true
      Use
      pch.h
    
    
      Windows
      true
      false
    
  
  
    
      Level3
      true
      true
      true
      WIN32;NDEBUG;SAMPVOICE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
      true
      Use
      pch.h
      stdcpplatest
      C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\include;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\cyanide-src\include;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\polyhook-src\zydis\src;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\polyhook-src;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\polyhook-src\polyhook2;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\polyhook-src\sources;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\polyhook-src\zydis\include;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\polyhook-src\zydis\include\Zydis;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\xbyak-src;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x86-Release\_deps\xbyak-src\xbyak;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x64-Debug\_deps\polyhook-src\zydis\dependencies\zycore\include;C:\plugin-sdk\tools\myplugin-gen\generated\client-npc\RakHook\out\build\x64-Debug\_deps\polyhook-src\zydis\msvc;C:\portaudio-master\include;C:\Users\swlm\Desktop\MinHook\include;C:\opus-main\include;C:\Users\swlm\Desktop\basic-template;C:\Users\swlm\Desktop\basic-template\pawn\source;C:\Users\swlm\Desktop\basic-template\pawn\source\linux;C:\Users\swlm\Desktop\basic-template\sdk\include;C:\Users\swlm\Desktop\basic-template\sdk\lib\glm\glm\..;C:\Users\swlm\Desktop\basic-template\sdk\lib\robin-hood-hashing\src\include;C:\Users\swlm\Desktop\basic-template\sdk\lib\span-lite\include;C:\Users\swlm\Desktop\basic-template\sdk\lib\string-view-lite\include;$(PLUGIN_SDK_DIR)\shared;$(PLUGIN_SDK_DIR)\shared\game;$(PLUGIN_SDK_DIR)\plugin_SA;$(PLUGIN_SDK_DIR)\plugin_SA\game_SA;$(PLUGIN_SDK_DIR)\plugin_SA\game_SA\rw;%(AdditionalIncludeDirectories)
      MultiThreaded
      true
    
    
      Windows
      true
      false
      C:\plugin-sdk\output\lib;C:\opus-main\out\build\x86-Release\Release;C:\Users\swlm\Desktop\minhook\build\VC17\lib\Release;C:\portaudio-master\out\build\x86-Release\Release;%(AdditionalLibraryDirectories)
      plugin.lib;rakhook.lib;PolyHook_2.lib;cyanide.lib;Zydis.lib;Zycore.lib;portaudio.lib;opus.lib;libMinHook.x86.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;%(AdditionalDependencies)
    
  
  
    
      Level3
      true
      _DEBUG;SAMPVOICE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
      true
      Use
      pch.h
    
    
      Windows
      true
      false
    
  
  
    
      Level3
      true
      true
      true
      NDEBUG;SAMPVOICE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
      true
      Use
      pch.h
    
    
      Windows
      true
      false
    
  
  
    
    
    
    
    
    
    
    
    
    
  
  
    
    
    
    
    
    
      Create
      Create
      Create
      Create
 
Ответить с цитированием