Привет. Сейчас я расскажу как добавить статус бар на сервер ARMA 3 Altis Life.
Он включает в себя:
количество гражданских игроков;
количество полицейских;
количество медиков;
координаты;
наличные деньги;
деньги в банке;
FPS.
1. Создаем файл "statusBar.sqf".
waitUntil {!(isNull (findDisplay 46))};
disableSerialization;
/*
File: fn_statusBar.sqf
Author: Some French Guy named Osef I presume, given the variable on the status bar
Edited by: [midgetgrimm], Maksim
Description: Puts a small bar in the bottom right of screen to display in-game information
*/
4 cutRsc ["osefStatusBar","PLAIN"];
//systemChat format["Загрузка информации...", _rscLayer];
[] spawn {
sleep 5;
_counter = 180;
_timeSinceLastUpdate = 0;
while {true} do
{
sleep 1;
_counter = _counter - 1;
((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText
format["FPS: %1 | Копы: %2 | Граждане: %3 | Медики: %4 | Наличные: %5 | Банк: %6 | Координаты: %7", round diag_fps, west countSide playableUnits, civilian countSide playableUnits, independent countSide playableUnits,[life_cash] call life_fnc_numberText,[life_atmcash] call life_fnc_numberText,mapGridPosition player, _counter];
};
};
2. Создаем файл "statusBar.hpp".
#define ST_RIGHT 0x01
class osefStatusBar {
idd = -1;
onLoad = "uiNamespace setVariable ['osefStatusBar', _this select 0]";
onUnload = "uiNamespace setVariable ['osefStatusBar', objNull]";
onDestroy = "uiNamespace setVariable ['osefStatusBar', objNull]";
fadein = 0;
fadeout = 0;
duration = 10e10;
movingEnable = 0;
controlsBackground[] = {};
objects[] = {};
class controls {
class statusBarText {
idc = 1000;
x = safezoneX + safezoneW - 2.65;
y = safezoneY + safezoneH - 0.04;
w = 1;
h = 0.04;
shadow = 2;
colorBackground[] = { 1, 0.3, 0, 0.0 };
font = "PuristaSemibold";
size = 0.03;
type = 13;
style = 1;
text="Загрузка информации...";
class Attributes {
align="right";
color = "#009999";
};
};
};
};
3. Открываем файл "description.ext" и ищем в нем "class RscTitles". Затем добавляем в него наш "statusBar.hpp".
Должно получиться примерно так:
class RscTitles
{
#include "dialog\ui.hpp"
#include "dialog\progress.hpp"
#include "statusBar.hpp"
};
4. Открываем файл "init.sqf" и подключаем наш скрипт:
[] execVM "statusBar.sqf";
Готово.
Ссылка на оригинал: http://www.altisliferpg.com/topic/10170-advanced-statusbar/