У
Удалённый пользователь 123482
Гость
Как ID в CVehicle преобразовать?Код:int GetNearestVehicle() { int nearestVehicle = -1; double closestDistance = -1; typedef long double(__thiscall* GetDistance)(stSAMPVehicle*); for (int vID = 1; vID <= MAX_VEHICLES; vID++) { static stVehiclePool *allVehicles; allVehicles = SF->getSAMP()->getVehicles(); if (allVehicles->iIsListed[vID] != 1 || allVehicles->iIsListed2[vID] != 1) continue; if (allVehicles->pSAMP_Vehicle[vID] == 0 || allVehicles->pSAMP_Vehicle[vID]->pGTA_Vehicle == 0) continue; static double currentDistance; static GetDistance getDistanceToLocalPlayer = (GetDistance)(SF->getSAMP()->getSAMPAddr() + 0x9A700); currentDistance = getDistanceToLocalPlayer(allVehicles->pSAMP_Vehicle[vID]); if (closestDistance == -1) { closestDistance = currentDistance; nearestVehicle = vID; } else if (currentDistance < closestDistance) { closestDistance = currentDistance; nearestVehicle = vID; } } return nearestVehicle; }