
02.08.2025, 00:43
|
|
Новичок
Регистрация: 31.07.2024
Сообщений: 10
С нами:
941818
Репутация:
1
|
|
Все круто, но при нажатии пкм с включеным тригером самп просто крашит с ошибкой
--------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\kichiroCOMFORT [v2]\gta_sa.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. --------------------------- ОК ---------------------------
Так-же небыло в CPad функции GetRightMouseDown, но я заменил проверкой переменной в том самом CPad
Нынешний код выглядит вот так, хз че делать, помогите
TriggerBot.cpp:
Код:
#include "TriggerBot.h"
#include "plugin.h"
#include "CPad.h"
#include "CPlayerPed.h"
#include "CWorld.h"
#include "CVector.h"
#include "CEntity.h"
#include "CColPoint.h"
#include "CCamera.h"
#include "CPools.h"
#include "sampapi/sampapi.h"
#include "sampapi/0.3.7-R1/CChat.h"
using namespace sampapi::v037r1;
bool JK_TriggerIsEnable = false;
void MouseLeftClick() {
INPUT input[2] = {};
input[0].type = INPUT_MOUSE;
input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
input[1].type = INPUT_MOUSE;
input[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(2, input, sizeof(INPUT));
}
void TriggerBot::Update() {
if (!JK_TriggerIsEnable) return;
CPlayerPed* player = FindPlayerPed();
if (!player || !player->IsAlive() || CPad::NewMouseControllerState.rmb == 0) return;
CVector source;
TheCamera.Find3rdPersonCamTargetVector(100.0f, player->GetPosition(), &source, nullptr);
CVector target;
TheCamera.Find3rdPersonCamTargetVector(0.0f, source, &source, &target);
CColPoint colPoint;
CEntity* hitEntity = nullptr;
bool hit = CWorld::ProcessLineOfSight(source, target, colPoint, hitEntity,
true, // buildings
true, // vehicles
true, // peds
false, // objects
false, // dummies
false, // seeThroughStuff
false, // cameraObjects
false // unknownFlag
);
if (hit && hitEntity && hitEntity->m_nType == ENTITY_TYPE_PED && hitEntity != player) {
CPed* ped = reinterpret_cast(hitEntity);
if (ped && ped->IsAlive()) {
MouseLeftClick();
}
}
}
void TriggerBot::RenderUI()
{
ImGui::Checkbox("TriggerBot", &JK_TriggerIsEnable);
}
|
|
|