Другое С/С++ Вопрос - Ответ

SR_team

like pancake
BH Team
4,720
6,370
Дай альтернативу.
typedef const unsigned CU;
CU IS_SPHERE_VISIBLE_FUNC = 0x420D40;
bool isSphereVisible(RwV3D pos, float range)
{
typedef bool (__thiscall *CCamera__isSphereVisible)(void* _this, RwV3D *pos, float radius);
return (CCamera__isSphereVisible(IS_SPHERE_VISIBLE_FUNC))((void*)*(uint32_t*)0xB6F028, &pos, range);
}

P.S. RwV3D такой же как CVector
 

Jack_Savage

Участник
150
17
Пытался сделать dff viewer знаю что есть но все равно хочется написать...
Нашел библиотеку librw (GitHub - aap/librw: A (partial) re-implementation of RenderWare Graphics(https://github.com/aap/librw)) и через это чудо рендерил dff модельку.
Если попытаться рендерить модель из gta3.img то будет вот что то такое:
zf3MUx8.png

Хотя там должна быть дорога.
Может кто знает в чем трабл ?

PS: Если прогнать модель (импортировать ее туда и сразу экспортировать назад с заменой файла. Нечего даже не меняю.) через zmodeler или blender то будет работать как надо.
Помогите если кто знает в чем проблема.
 

Blood

Известный
45
1
парни, может кто помочь маленький код AHK перевести на С++
 

Karbun

Участник
112
3
Как правильно использовать цикл do..while? После использование ГТА зависает и крашится.
 

BlackKnigga

Известный
BH Team
922
445
C++:
do
    {
     coords;
     SF->getSAMP()->getChat()->AddChatMessage(-1, "Следующее действие");
    } while (true);

Может надо задержку добавить?
В mainloop делаешь? Он сам по себе цикл и в нем нельзя использовать циклы и задержки.
И чо это такое ваще?
 
  • Нравится
Реакции: Karbun

Karbun

Участник
112
3
В mainloop делаешь? Он сам по себе цикл и в нем нельзя использовать циклы и задержки.
И чо это такое ваще?
Не в mainloop, в функции. coords - это еще одна функция, которая обновляет координаты, к ней идет запрос, она возвращает координаты.

C++:
float coords()
{
    float fPos[3] = { PEDSELF->GetPosition()->fX,
            PEDSELF->GetPosition()->fY,
            PEDSELF->GetPosition()->fZ };
    return (fPos[0], fPos[1], fPos[2]);
}
 

Karbun

Участник
112
3
Тогда давай весь код
Он вродe и так вecь здeсь
C++:
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>

#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"

SAMPFUNCS *SF = new SAMPFUNCS();

float coords()
{
    float fPos[3] = { PEDSELF->GetPosition()->fX,
            PEDSELF->GetPosition()->fY,
            PEDSELF->GetPosition()->fZ };
    return (fPos[0], fPos[1], fPos[2]);
}

void script(void)
float fPos[3];
do
    {
     coords;
     SF->getSAMP()->getChat()->AddChatMessage(-1, "Следующее действие");
    } while (true);

void CALLBACK fld(std::string str)
{
    script();
}

void CALLBACK mainloop()
{
    static bool init = false;
    if (!init)
    {
        if (GAME == nullptr)
            return;
        if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
            return;
        if (!SF->getSAMP()->IsInitialized())
            return;
        SF->getSAMP()->getChat()->AddChatMessage( D3DCOLOR_XRGB( 0, 0xAA, 0 ), "SAMPFUNCS Plugin loaded." );
        SF->getSAMP()->registerChatCommand("fld", fld);

        init = true;
    }
}
 

BlackKnigga

Известный
BH Team
922
445
Он вродe и так вecь здeсь
C++:
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>

#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"

SAMPFUNCS *SF = new SAMPFUNCS();

float coords()
{
    float fPos[3] = { PEDSELF->GetPosition()->fX,
            PEDSELF->GetPosition()->fY,
            PEDSELF->GetPosition()->fZ };
    return (fPos[0], fPos[1], fPos[2]);
}

void script(void)
float fPos[3];
do
    {
     coords;
     SF->getSAMP()->getChat()->AddChatMessage(-1, "Следующее действие");
    } while (true);

void CALLBACK fld(std::string str)
{
    script();
}

void CALLBACK mainloop()
{
    static bool init = false;
    if (!init)
    {
        if (GAME == nullptr)
            return;
        if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
            return;
        if (!SF->getSAMP()->IsInitialized())
            return;
        SF->getSAMP()->getChat()->AddChatMessage( D3DCOLOR_XRGB( 0, 0xAA, 0 ), "SAMPFUNCS Plugin loaded." );
        SF->getSAMP()->registerChatCommand("fld", fld);

        init = true;
    }
}
Херню какую то написал. Как это скомпилировалось вообще?
void script(void) - где открывающая и закрывающая скобка?
coords; - вызывать надо так: coords();
Да и беск. цикл в теле функции тоже нельзя юзать
Что ты вообще сделать хочешь?
 
  • Нравится
Реакции: Karbun и memir