This is Kind of like SRB's version Except we're grabbing ALL nearby vehicles & checking if they're touching your current vehicle then DELETING the car rather than playing an explosion.
Code:
void VehicleRAM_Protection() {
const int NumElements = 10;
const int Array = NumElements * 2 + 2;
Vehicle bocp[Array];
bocp[0] = NumElements;
int count = PED::GET_PED_NEARBY_VEHICLES(PLAYER::PLAYER_PED_ID(), bocp);
Vehicle mycar = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), 0);
if (bocp != NULL) {
for (int i = 1; i <= count; i++) {
int arse = i;
if (bocp[arse] != NULL && ENTITY::DOES_ENTITY_EXIST(bocp[arse])) {
if (ENTITY::IS_ENTITY_TOUCHING_ENTITY(bocp[arse], mycar)) {
if (bocp[arse] != mycar) {
ENTITY::SET_ENTITY_AS_MISSION_ENTITY(bocp[arse], 1, 1);
ENTITY::DELETE_ENTITY(&bocp[arse]);
}
}
}
}
}
}
if (Veh_RamProtect) {
VehicleRAM_Protection();
}