Code:
int activeLineIndexSelectiveComponent = 0;
void process_component_menu(int componentID)
{
const float lineWidth = 250.0;
const int lineCount = 45;
std::string caption = "CLOTH CHANGER (" + std::to_string(componentID) + ")";
typedef struct {
int drawable;
int texture;
int pallete;
} lines;
lines clothing[lineCount];
int blanks = 0;
for (int i = 0; i < 32; i++)
{
if (!PED::IS_PED_COMPONENT_VARIATION_VALID(PLAYER::PLAYER_PED_ID(), componentID, PED::GET_PED_DRAWABLE_VARIATION(PLAYER::PLAYER_PED_ID(), componentID), PED::GET_PED_TEXTURE_VARIATION(PLAYER::PLAYER_PED_ID(), componentID)))
{
blanks++;
}
else
{
clothing[i - blanks] = { PED::GET_PED_DRAWABLE_VARIATION(PLAYER::PLAYER_PED_ID(), componentID), PED::GET_PED_TEXTURE_VARIATION(PLAYER::PLAYER_PED_ID(), componentID), PED::GET_PED_PALETTE_VARIATION(PLAYER::PLAYER_PED_ID(), componentID) };
blanks = 0;
}
}
DWORD waitTime = 150;
while (true)
{
// timed menu draw, used for pause after active line switch
DWORD maxTickCount = GetTickCount() + waitTime;
do
{
// draw menu
draw_menu_line(caption, lineWidth, 15.0, 20.0, 1000.0, 5.0, false, true);
for (int i = 0; i < lineCount; i++)
if (i != activeLineIndexSelectiveComponent)
draw_menu_line(std::to_string(componentID), lineWidth, 9.0, 60 + i * 30, 1000.0, 7.0, false, false);
draw_menu_line(std::to_string(componentID), lineWidth, 9.0, 60 + activeLineIndexSelectiveComponent * 30, 1000.0, 7.0, true, false);
update_features();
WAIT(0);
} while (GetTickCount() < maxTickCount);
waitTime = 0;
// process buttons
bool bSelect, bBack, bUp, bDown;
get_button_state(&bSelect, &bBack, &bUp, &bDown, NULL, NULL);
if (bSelect)
{
menu_beep();
PED::SET_PED_COMPONENT_VARIATION(PLAYER::PLAYER_PED_ID(), componentID, clothing[activeLineIndexSelectiveComponent].drawable, clothing[activeLineIndexSelectiveComponent].texture, clothing[activeLineIndexSelectiveComponent].pallete);
waitTime = 200;
}
else
if (bBack || trainer_switch_pressed())
{
menu_beep();
break;
}
else
if (bUp)
{
menu_beep();
if (activeLineIndexSelectiveComponent == 0)
activeLineIndexSelectiveComponent = lineCount;
activeLineIndexSelectiveComponent--;
waitTime = 150;
}
else
if (bDown)
{
menu_beep();
activeLineIndexSelectiveComponent++;
if (activeLineIndexSelectiveComponent == lineCount)
activeLineIndexSelectiveComponent = 0;
waitTime = 150;
}
}
}
any help on making this work would be appreciated.