1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
int activeLineIndexPlayer = 0;
void process_player_menu()
{
const float lineWidth = 250.0;
const int lineCount = 3;
std::string caption = "MANAGER TYPE";
static struct {
LPCSTR text;
bool *pState;
bool *pUpdated;
} lines[lineCount] = {
{"BANK MANAGER", NULL, NULL},
{"CLUB MANAGER", NULL, NULL},
{"SHOP MANAGER", NULL, NULL},
};
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, 18.0, 0.0, 5.0, false, true);
for (int i = 0; i < lineCount; i++)
if (i != activeLineIndexPlayer)
draw_menu_line(line_as_str(lines[i].text, lines[i].pState),
lineWidth, 9.0, 60.0 + i * 36.0, 0.0, 9.0, false, false);
draw_menu_line(line_as_str(lines[activeLineIndexPlayer].text, lines[activeLineIndexPlayer].pState),
lineWidth + 1.0, 11.0, 56.0 + activeLineIndexPlayer * 36.0, 0.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)
{
// common variables
BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID());
Player player = PLAYER::PLAYER_ID();
Ped playerPed = PLAYER::PLAYER_PED_ID();
switch (activeLineIndexPlayer)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
default:
if (lines[activeLineIndexPlayer].pState)
*lines[activeLineIndexPlayer].pState = !(*lines[activeLineIndexPlayer].pState);
if (lines[activeLineIndexPlayer].pUpdated)
*lines[activeLineIndexPlayer].pUpdated = true;
}
waitTime = 200;
} else
if (bBack || trainer_switch_pressed())
{
break;
} else
if (bUp)
{
if (activeLineIndexPlayer == 0)
activeLineIndexPlayer = lineCount;
activeLineIndexPlayer--;
waitTime = 150;
} else
if (bDown)
{
activeLineIndexPlayer++;
if (activeLineIndexPlayer == lineCount)
activeLineIndexPlayer = 0;
waitTime = 150;
}
}
}
|