while (Process32Next(processesSnapshot, &processInfo))
Как будет работать этот цикл?
Тут нет условия, что должно заставить цикл остановиться?
Или я что-то не понимаю?
while (Process32Next(processesSnapshot, &processInfo))
void func_air_brake()
{
static float orig_pos[3];
static float fall_speed_mult;
static int vkl = 0;
actor_info *info = g_SAMP->getPlayers()->pLocalPlayer->pSAMP_Actor->pGTA_Ped;
if (isKeyPressed(VK_RSHIFT))
menu.air_brake ^= 1;
if (menu.air_brake)
{
vect3_copy(&info->base.matrix[4 * 3], orig_pos);
fall_speed_mult = 1.0f;
vkl = 1;
}
if (!menu.air_brake && vkl)
{
toggleSAMPCursor(0);
TOGGLECURSOR(1);
TOGGLECURSOR(0);
vkl = 0;
}
if (menu.air_brake)
{
float *matrix = info->base.matrix;
// if there's no parachute
if (g_SAMP->getPlayers()->pLocalPlayer->byteCurrentWeapon != 46)
{
vect3_copy(orig_pos, &info->base.matrix[4 * 3]);
vect3_zero(info->speed);
SetIsStanding(1);
float d[4] = { 0.0f, 0.0f, 0.0f, 0.0002f };
if (isKeyDown('W'))
d[0] += 1.0f;
if (isKeyDown('S'))
d[0] -= 1.0f;
if (isKeyDown('A'))
d[1] += 1.0f;
if (isKeyDown('D'))
d[1] -= 1.0f;
if (isKeyDown(VK_UP))
d[2] += 1.0f;
if (isKeyDown(VK_DOWN))
d[2] -= 1.0f;
if (!vect3_near_zero(d))
{
float vect[4] = { -d[1], d[0], d[2], 0.0f };
float out[4];
/* out = matrix * norm(d) */
vect3_normalize(vect, vect);
matrix_vect4_mult(matrix, vect, out);
matrix[4 * 3 + 0] += out[0] * d[3];
matrix[4 * 3 + 1] += out[1] * d[3];
matrix[4 * 3 + 2] += out[2] * d[3];
}
}
vect3_copy(&matrix[4 * 3], orig_pos);
}
}
typedef struct RpClump RpClump;
typedef RpClump *(*RpClumpCallback) (RpClump * clump, void *data);
struct RwObject
{
unsigned char type;
unsigned char subtype;
unsigned char flags;
unsigned char privateFlags;
void *parent; // should be RwFrame with RpClump
};
struct RwListEntry
{
RwListEntry *next, *prev;
};
struct RwList
{
RwListEntry root;
};
struct RpClump
{ // RenderWare (plugin) Clump (used by GTA)
RwObject object;
RwList atomics;
RwList lights;
RwList cameras;
RwListEntry globalClumps;
RpClumpCallback callback;
};
list < CAnimBlendAssociation * > m_Associations;
CAnimBlendAssociation * GetAnimBlendAssociation(CAnimBlendAssociationSAInterface * pInterface)
{
if (pInterface)
{
list < CAnimBlendAssociation * > ::iterator iter = m_Associations.begin();
for (; iter != m_Associations.end(); iter++)
{
if ((*iter)->GetInterface() == pInterface)
{
return *iter;
}
}
CAnimBlendAssociation * pAssociation = new CAnimBlendAssociationSA(pInterface);
m_Associations.push_back(pAssociation);
return pAssociation;
}
return NULL;
}
CAnimBlendAssociation * RpAnimBlendClumpGetFirstAssociation(RpClump * pClump)
{
if (!pClump)
return NULL;
CAnimBlendAssociationSAInterface * pInterface;
DWORD dwFunc = FUNC_RpAnimBlendClumpGetFirstAssociation;
_asm
{
push pClump
call dwFunc
mov pInterface, eax
add esp, 0x4
}
return GetAnimBlendAssociation(pInterface);
}
GTAfunc_LockActor(true);Ребят, есть проблема при включении аирбрейка собейт не держит Z координату, т.е. если спуститься под землю он будет медленно падать вниз.
C++:void func_air_brake() { static float orig_pos[3]; static float fall_speed_mult; static int vkl = 0; actor_info *info = g_SAMP->getPlayers()->pLocalPlayer->pSAMP_Actor->pGTA_Ped; if (isKeyPressed(VK_RSHIFT)) menu.air_brake ^= 1; if (menu.air_brake) { vect3_copy(&info->base.matrix[4 * 3], orig_pos); fall_speed_mult = 1.0f; vkl = 1; } if (!menu.air_brake && vkl) { toggleSAMPCursor(0); TOGGLECURSOR(1); TOGGLECURSOR(0); vkl = 0; } if (menu.air_brake) { float *matrix = info->base.matrix; // if there's no parachute if (g_SAMP->getPlayers()->pLocalPlayer->byteCurrentWeapon != 46) { vect3_copy(orig_pos, &info->base.matrix[4 * 3]); vect3_zero(info->speed); SetIsStanding(1); float d[4] = { 0.0f, 0.0f, 0.0f, 0.0002f }; if (isKeyDown('W')) d[0] += 1.0f; if (isKeyDown('S')) d[0] -= 1.0f; if (isKeyDown('A')) d[1] += 1.0f; if (isKeyDown('D')) d[1] -= 1.0f; if (isKeyDown(VK_UP)) d[2] += 1.0f; if (isKeyDown(VK_DOWN)) d[2] -= 1.0f; if (!vect3_near_zero(d)) { float vect[4] = { -d[1], d[0], d[2], 0.0f }; float out[4]; /* out = matrix * norm(d) */ vect3_normalize(vect, vect); matrix_vect4_mult(matrix, vect, out); matrix[4 * 3 + 0] += out[0] * d[3]; matrix[4 * 3 + 1] += out[1] * d[3]; matrix[4 * 3 + 2] += out[2] * d[3]; } } vect3_copy(&matrix[4 * 3], orig_pos); } }
WndProcИли как еще можно сделать постоянное выполнение опред. кода в dll, кроме потока с бесконечным циклом, т.к. при использовании такого потока проседает много фпс
Для того, чтобы работали таймеры, нужно будет обрабатывать очередь сообщений.Почему не работает таймер?
Вместо (TIMERPROC)TimerProc делал &TimerProc - результат такой же.![]()
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Чтобы фпс не проседало, используй Sleep с задержкой ~100Или как еще можно сделать постоянное выполнение опред. кода в dll, кроме потока с бесконечным циклом, т.к. при использовании такого потока проседает много фпс
раксамп (RakSAMP)Возможно не в той теме спрашиваю.
Как написать бота, который будет работать без запуска GTA? Есть какие-то готовые средства?
Есть какой-нибудь мануал к нему? Что и где менять, чтобы бота написать.раксамп (RakSAMP)
нет, сам думайЕсть какой-нибудь мануал к нему? Что и где менять, чтобы бота написать.
Мануал? Нет. Всякие там мануалы только по павну могут быть.Есть какой-нибудь мануал к нему? Что и где менять, чтобы бота написать.
pRakClient->RegisterAsRemoteProcedureCall(&RPC_ScrDialogBox, ScrDialogBox);