-
Автор темы
- #1
C++:
void Menu::spectators_list() {
if (g_pEngine->IsConnected()) {
int pos_x = g_Menu.Config.spec_x;
int pos_y = g_Menu.Config.spec_y;
static int _drag_x = 300;
static int _drag_y = 300;
static bool _dragging = false;
bool _click = false;
if (GetAsyncKeyState(VK_LBUTTON))
_click = true;
Vector2D _mouse_pos = g_pSurface->GetMousePosition();
if (_dragging && !_click)
_dragging = false;
if (_dragging && _click)
{
pos_x = _mouse_pos.x - _drag_x;
pos_y = _mouse_pos.y - _drag_y;
g_Menu.Config.spec_x = pos_x;
g_Menu.Config.spec_y = pos_y;
}
int spec_width = 160;
int spec_height = 160;
if ((g_pSurface->MouseInRegion(pos_x + 400, pos_y, spec_width, spec_height - 140))) {
_dragging = true;
_drag_x = _mouse_pos.x - pos_x;
_drag_y = _mouse_pos.y - pos_y;
}
int wa, ha;
g_pEngine->GetScreenSize(wa, ha);
g_pSurface->FilledRect(pos_x + 400, pos_y, spec_width, 20, Color(32, 32, 32));
int loop = 0;
for (int i = 0; i <= 64; i++) {
C_BaseEntity* e = (C_BaseEntity*)g_pEntityList->GetClientEntity(i);
PlayerInfo_t pinfo;
if (e && e != Globals::LocalPlayer && !e->IsDormant()) {
g_pEngine->GetPlayerInfo(i, &pinfo);
uintptr_t obs = e->observer_target();
if (!obs) continue;
C_BaseEntity* spec = (C_BaseEntity*)g_pEntityList->GetClientEntityFromHandle(obs);
if (spec == nullptr) continue;
PlayerInfo_t spec_info;
g_pEngine->GetPlayerInfo(i, &spec_info);
char buf[255]; sprintf_s(buf, "%s", pinfo.szName);
if (spec->EntIndex() == Globals::LocalPlayer->EntIndex()) {
g_pSurface->FilledRect(pos_x + 400, (pos_y + (18 * loop)) + 20, 160, 20, Color(50, 50, 50));
g_pSurface->DrawT(pos_x + 408, (pos_y + (18 * loop)) + 22, Color(180, 180, 180), Globals::menu_font, false, buf);
loop++;
}
}
}
char loop_str[24];
sprintf_s(loop_str, "Spectators - (%d)", loop);
g_pSurface->DrawT(pos_x + 408, pos_y + 2, Color(180, 180, 180), Globals::menu_font, false, loop_str);
g_pSurface->FilledRect(pos_x + 400, pos_y + 20, spec_width, 1, menurgba);
}
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
Последнее редактирование: