I'm currently making a plugin for a game and I've got the following problem:
I want to let the user choose the radius, but since C++ doesn't let me create an array with a variable size I can't get a custom radius.
This works fine
const int numElements = 25;
const int arrSize = numElements * 2 + 2;
int vehs[arrSize];
//0 index is the size of the array
vehs[0] = numElements;
int count = GET_PED_NEARBY_VEHICLES(PLAYER_PED_ID(), vehs);
but this dosen't:
int radius = someOtherVariableForRadius * 2;
const int numElements = radius;
const int arrSize = numElements * 2 + 2;
int vehs[arrSize];
//0 index is the size of the array
vehs[0] = numElements;
int count = GET_PED_NEARBY_VEHICLES(PLAYER_PED_ID(), vehs);
Is there any possible way of modifing that const int without creating errors in
int vehs[arrSize];
?
std::vector?std::vectorhas thedata()member function just for that.