void SwitchContext ( CVehicle* pVehicle ) { if ( !pVehicle ) return; // Grab the vehicle's internal interface CVehicleSA* pVehicleSA = dynamic_cast < CVehicleSA* > ( pVehicle ); DWORD dwVehicle = (DWORD)pVehicleSA->GetInterface (); // Grab the driver of the vehicle CPed* thePed = pVehicle->GetDriver (); if ( thePed ) { // Switch the context to the driver of the vehiclee SwitchContext ( thePed ); if ( bNotInLocalContext ) { // Prevent the game making remote players vehicle's audio behave like locals (and deleting // radio etc when they are removed) - issue #95 MemPutFast < BYTE > ( 0x50230C, 0x0 ); MemPutFast < BYTE > ( dwVehicle + 312 + 0xA5, 0 ); // For tanks, to prevent our mouse movement affecting remote tanks // 006AEA25 0F85 60010000 JNZ gta_sa.006AEB8B // V // 006AEA25 90 NOP // 006AEA26 E9 60010000 JMP gta_sa.006AEB8B MemPutFast < BYTE > ( 0x6AEA25, 0x90 ); MemPutFast < BYTE > ( 0x6AEA26, 0xE9 ); // Same for firetrucks and SWATs // 00729B96 0F85 75010000 JNZ gta_sa.00729D11 // V // 00729B96 90 NOP // 00729B97 E9 75010000 JMP gta_sa.00729D11 MemPutFast < BYTE > ( 0x729B96, 0x90 ); MemPutFast < BYTE > ( 0x729B97, 0xE9 ); bRadioHackInstalled = TRUE; } else { //0050237C |. E8 9F37FFFF CALL gta_sa_u.004F5B20 MemPutFast < BYTE > ( 0x50237C + 0, 0xE8 ); MemPutFast < BYTE > ( 0x50237C + 1, 0x9F ); MemPutFast < BYTE > ( 0x50237C + 2, 0x37 ); MemPutFast < BYTE > ( 0x50237C + 3, 0xFF ); MemPutFast < BYTE > ( 0x50237C + 4, 0xFF ); //0x5023A3 MemPutFast < BYTE > ( 0x5023A3 + 0, 0xE8 ); MemPutFast < BYTE > ( 0x5023A3 + 1, 0xB8 ); MemPutFast < BYTE > ( 0x5023A3 + 2, 0x37 ); MemPutFast < BYTE > ( 0x5023A3 + 3, 0xFF ); MemPutFast < BYTE > ( 0x5023A3 + 4, 0xFF ); } } }
void SwitchContext ( CVehicle* pVehicle ) { if ( !pVehicle ) return; // Grab the vehicle's internal interface CVehicleSA* pVehicleSA = dynamic_cast < CVehicleSA* > ( pVehicle ); DWORD dwVehicle = (DWORD)pVehicleSA->GetInterface (); // Grab the driver of the vehicle CPed* thePed = pVehicle->GetDriver (); if ( thePed ) { // Switch the context to the driver of the vehiclee SwitchContext ( thePed ); if ( bNotInLocalContext ) { // Prevent the game making remote players vehicle's audio behave like locals (and deleting // radio etc when they are removed) - issue #95 *(BYTE *)0x50230C = 0x0; *(BYTE *)(dwVehicle + 312 + 0xA5) = 0; // set the is local player's flag to 0 on the audio entity for the vehicle // For tanks, to prevent our mouse movement affecting remote tanks // 006AEA25 0F85 60010000 JNZ gta_sa.006AEB8B // V // 006AEA25 90 NOP // 006AEA26 E9 60010000 JMP gta_sa.006AEB8B *(BYTE *)0x6AEA25 = 0x90; *(BYTE *)0x6AEA26 = 0xE9; bRadioHackInstalled = TRUE; } else { //0050237C |. E8 9F37FFFF CALL gta_sa_u.004F5B20 *(BYTE *)(0x50237C + 0) = 0xE8; *(BYTE *)(0x50237C + 1) = 0x9F; *(BYTE *)(0x50237C + 2) = 0x37; *(BYTE *)(0x50237C + 3) = 0xFF; *(BYTE *)(0x50237C + 4) = 0xFF; //0x5023A3 *(BYTE *)(0x5023A3 + 0) = 0xE8; *(BYTE *)(0x5023A3 + 1) = 0xB8; *(BYTE *)(0x5023A3 + 2) = 0x37; *(BYTE *)(0x5023A3 + 3) = 0xFF; *(BYTE *)(0x5023A3 + 4) = 0xFF; } } }
CTaskSimpleCarSetPedInAsDriverSA::CTaskSimpleCarSetPedInAsDriverSA(CVehicle* pTargetVehicle, CTaskUtilityLineUpPedWithCar* pUtility) { DEBUG_TRACE("CTaskSimpleCarSetPedInAsDriverSA::CTaskSimpleCarSetPedInAsDriverSA(CVehicle* pTargetVehicle, CTaskUtilityLineUpPedWithCar* pUtility)"); CVehicleSA* pTargetVehicleSA = dynamic_cast < CVehicleSA* > ( pTargetVehicle ); if ( pTargetVehicleSA ) { this->CreateTaskInterface(sizeof(CTaskSimpleCarSetPedInAsDriverSAInterface)); DWORD dwFunc = FUNC_CTaskSimpleCarSetPedInAsDriver__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); DWORD dwThisInterface = (DWORD)this->GetInterface(); _asm { mov ecx, dwThisInterface push pUtility push dwVehiclePtr call dwFunc } } else {
CTaskComplexEnterCarAsDriverSA::CTaskComplexEnterCarAsDriverSA ( CVehicle* pTargetVehicle):CTaskComplexEnterCarSA ( pTargetVehicle, true, false, false, false ) { DEBUG_TRACE("CTaskComplexEnterCarAsDriverSA::CTaskComplexEnterCarAsDriverSA(CVehicle* pTargetVehicle)"); CVehicleSA* pTargetVehicleSA = dynamic_cast < CVehicleSA* > ( pTargetVehicle ); if ( pTargetVehicleSA ) { this->CreateTaskInterface(sizeof(CTaskComplexEnterCarAsDriverSAInterface)); if ( !IsValid () ) return; DWORD dwFunc = FUNC_CTaskComplexEnterCarAsDriver__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); DWORD dwThisInterface = (DWORD)this->GetInterface(); _asm { mov ecx, dwThisInterface push dwVehiclePtr call dwFunc } } else {
void cheat_lockstatus() { if (!cheat_state->_generic.lockstatus) return; if (gta_menu_active()) return; if (cheat_state->_generic.cheat_panic_enabled) return; if (!pGameInterface || !pGameInterface->GetPools()) return; if (!pPedSelf) return; const vehicle_entry *vehicle; char buf[256]; int v; float w, h; D3DXVECTOR3 poss, screenposs; CVector2D screenPosition; CVector ourPosition, iterPosition, ourPosMinusIter; // get our position if (!isBadPtr_GTA_pVehicle(pPedSelf->GetVehicle())) { ourPosition = *(pPedSelf->GetVehicle()->GetPosition()); } else { ourPosition = pPedSelf->GetInterface()->Placeable.matrix->vPos; } // setup iterator CVehicleSA *iterVehicle = NULL; CPoolsSA *pPools = reinterpret_cast <CPoolsSA *> (pGameInterface->GetPools()); CPoolsSA::vehiclePool_t::mapType::iterator iter = pPools->m_vehiclePool.map.begin(); // iterate while (iter.pos < iter.end) { // map iterator CVehicleSA pointer to our CVehicleSA pointer iterVehicle = iter.pos->second; // advance to next CVehicleSA for next pass iter.pos++; // move past null pointers if (isBadPtr_GTA_pVehicle(iterVehicle)) continue; //if ( isBadPtr_GTA_pVehicle(iterVehicle->GetVehicleInterface()) ) // continue; // check if it's farther than set.vehicle_tags_dist iterPosition = iterVehicle->GetInterface()->Placeable.matrix->vPos; ourPosMinusIter = ourPosition - iterPosition; if (ourPosMinusIter.Length() > set.vehicle_tags_dist) continue; // check if it's our vehicle if (iterVehicle == pPedSelf->GetVehicle()) continue; // check if it's near zero if (iterVehicle->GetPosition()->IsNearZero()) continue; // CVector to D3DXVECTOR3, function to be converted to CVector later poss.x = iterPosition.fX; poss.y = iterPosition.fY; poss.z = iterPosition.fZ; // yup CalcScreenCoors(&poss, &screenposs); // check if the vehicle is culled or not if (screenposs.z < 1.f) continue; // D3DXVECTOR3 to CVector2D screenPosition.fX = screenposs.x; screenPosition.fY = screenposs.y; // get the vehicle model's name vehicle = gta_vehicle_get_by_id(iterVehicle->GetModelIndex()); // get SAMP's vehicle id if (g_Vehicles != NULL) v = translateGTASAMP_vehiclePool.iSAMPID[getVehicleGTAIDFromInterface((DWORD *)iterVehicle->GetVehicleInterface())]; else v = (int)iterVehicle->GetArrayID(); ///////////////// // render time // h = pD3DFont->DrawHeight(); _snprintf_s(buf, sizeof(buf)-1, "%s", iterVehicle->AreDoorsLocked() ? "Закрыта" : "Открыта"); w = pD3DFont->DrawLength(buf); // different color if car is being driven DWORD color_veh; if (iterVehicle->AreDoorsLocked()) color_veh = D3DCOLOR_XRGB(255, 0, 0); // blueish 100, 150, 235 else color_veh = D3DCOLOR_XRGB(0, 255, 0); // render vehicle name pD3DFont->PrintShadow(screenPosition.fX, screenPosition.fY, color_veh, buf); } return; }