Vehicles ESP Crash

Статус
В этой теме нельзя размещать новые ответы.

Uztor

Новичок
Автор темы
42
0
Hello, why my samp crash (on spawn) when I try this?:

Код:
bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride,    CONST RGNDATA *pDirtyRegion)
{
    if (SUCCEEDED(SF->getRender()->BeginRender()))
    {
        int vehicles = SF->getSAMP()->getVehicles()->iVehicleCount;
        for (int i = 0; i < vehicles; i++)
        {
            float vPos[3];
            SF->getCLEO()->SetLocalVar(1, (float)i); //Car ID
            SF->getCLEO()->SetLocalVar(2, vPos[0]); //X
            SF->getCLEO()->SetLocalVar(3, vPos[1]); //Y
            SF->getCLEO()->SetLocalVar(4, vPos[2]); //Z
            SF->getCLEO()->callOpcode("00AA: store_car 1@ position_to 2@ 3@ 4@"); //Store

            float *rvPos[2];
            SF->getGame()->convert3DCoordsToScreen(vPos[0], vPos[2], vPos[3], rvPos[0], rvPos[1]);
            SF->getRender()->DrawBox((int)rvPos[0], (int)rvPos[1], 25, 25, D3DCOLOR_ARGB(255, 0, 255, 0));
        }
        SF->getRender()->EndRender();
    };
    return true;
};
 

Uztor

Новичок
Автор темы
42
0
I want to get the position of a car.

Код:
float vPos[3];
            SF->getCLEO()->SetLocalVar(1, (float)i);
            SF->getCLEO()->SetLocalVar(2, vPos[0]);
            SF->getCLEO()->SetLocalVar(3, vPos[1]);
            SF->getCLEO()->SetLocalVar(4, vPos[2]);
            SF->getCLEO()->callOpcode("0407: store_coords_to 2@ 3@ 4@ from_car 1@ with_offset 0.0 0.0 0.0");

Crash. :/
 
Последнее редактирование:

Dark_Knight

Me, me and me.
Друг
4,085
2,114
I want to get the position of a car.

Код:
float vPos[3];
            SF->getCLEO()->SetLocalVar(1, (float)i);
            SF->getCLEO()->SetLocalVar(2, vPos[0]);
            SF->getCLEO()->SetLocalVar(3, vPos[1]);
            SF->getCLEO()->SetLocalVar(4, vPos[2]);
            SF->getCLEO()->callOpcode("0407: store_coords_to 2@ 3@ 4@ from_car 1@ with_offset 0.0 0.0 0.0");

Crash. :/
It's bullshit. Wait
 
  • Нравится
Реакции: Ya Zaregalsya

Dark_Knight

Me, me and me.
Друг
4,085
2,114
Код:
CVector Pos;
    CVector2D Pos2D;
    stVehiclePool *Vehicle = SF->getSAMP()->getVehicles();
    int count = Vehicle->iVehicleCount;
    vehicle_info *car;
    for (int i = 0; i < count; i++)
    {
        car = Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle;
        if (car)
        {
            Pos.fX = car->base.matrix[4 * 3];
            Pos.fY = car->base.matrix[4 * 3 + 1];
            Pos.fZ = car->base.matrix[4 * 3 + 2];
            SF->getGame()->convert3DCoordsToScreen(Pos.fX, Pos.fY, Pos.fZ, &Pos2D.fX, &Pos2D.fY); 
            SF->getRender()->DrawBox((int)Pos2D.fX, (int)Pos2D.fY, 50, 20, -1/*White color. Use ARGB HEX color*/);
        }
    }
 

Uztor

Новичок
Автор темы
42
0
Thank you very much! :)
//It's crash instantly. :(
@Dark_Knight It's crash at this position:
Код:
car = Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle;

My try:
Код:
if (VehicleESP == true)
        {
            CVector Pos;
            CVector2D Pos2D;
            stVehiclePool *Vehicle = SF->getSAMP()->getVehicles();
            int count = Vehicle->iVehicleCount;
            SF->Log("Vehicles: %d", count);
            vehicle_info *car;
            for (int i = 0; i < count; i++)
            {
                SF->Log("for before car = Ve %d", i);
                car = Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle;
                if (!car)
                    continue;

                SF->Log("for after car = Ve %d", i);
                Pos.fX = car->base.matrix[4 * 3];
                Pos.fY = car->base.matrix[4 * 3 + 1];
                Pos.fZ = car->base.matrix[4 * 3 + 2];
                SF->getGame()->convert3DCoordsToScreen(Pos.fX, Pos.fY, Pos.fZ, &Pos2D.fX, &Pos2D.fY);
                SF->Log("has converted %d", i);
                SF->getRender()->DrawBox((int)Pos2D.fX, (int)Pos2D.fY, 50, 20, D3DCOLOR_ARGB(0, 255, 255, 255));
                SF->Log("box drawed %d", i);
            }
        }
Log:
[19:40:48] SAMPFUNCS v5.2.2 for SA:MP 0.3.7 completely loaded!
[19:41:12] Vehicles: 238
[19:41:12] for before car = Ve 0
[19:41:12] SAMPFUNCS v5.2.2 for SA:MP 0.3.7 caught an exception.
 
Последнее редактирование:

By_Surse

Известный
310
279
Код:
CVector Pos;
    CVector2D Pos2D;
    stVehiclePool *Vehicle = SF->getSAMP()->getVehicles();
    int count = Vehicle->iVehicleCount;
    vehicle_info *car;
    for (int i = 0; i < count; i++)
    {
        car = Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle;
        if (car)
        {
            Pos.fX = car->base.matrix[4 * 3];
            Pos.fY = car->base.matrix[4 * 3 + 1];
            Pos.fZ = car->base.matrix[4 * 3 + 2];
            SF->getGame()->convert3DCoordsToScreen(Pos.fX, Pos.fY, Pos.fZ, &Pos2D.fX, &Pos2D.fY);
            SF->getRender()->DrawBox((int)Pos2D.fX, (int)Pos2D.fY, 50, 20, -1/*White color. Use ARGB HEX color*/);
        }
    }
крашит(
 
  • Нравится
Реакции: Ya Zaregalsya
Статус
В этой теме нельзя размещать новые ответы.