Jump to content

Status Bar


Diceman

Recommended Posts

I found this one wandering the web and confirmed working on Arma3

 

  1. So create a folder "scripts" in your mpmisssions.
  2. create "statusBar.hpp" in this folder with the following content:
    #define ST_RIGHT 0x01
    
    class statusBar {
    	idd = -1;
    	onLoad = "uiNamespace setVariable ['statusBar', _this select 0]";
    	onUnload = "uiNamespace setVariable ['statusBar', objNull]";
    	onDestroy = "uiNamespace setVariable ['statusBar', objNull]";
    	fadein = 0;
    	fadeout = 0;
    	duration = 10e10;
    	movingEnable = 0;
    	controlsBackground[] = {};
    	objects[] = {};
    	class controls {
    		class statusBarText {
    			idc = 1000;
    			x = safezoneX + safezoneW - 1.4;
    			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="Cargando...";
    			class Attributes {
    				align="left";
    				color = "#FFFFFF";
    			};
    		};
    	};
    };
    
  3.  

    Create "statusBar.sqf" in this folder with the following content and edit the line _statusText = "ADD YOUR SERVER TITLE Epoch"; to your liking:
     

    waitUntil {!(isNull (findDisplay 46))};
    disableSerialization;
    
    _rscLayer = "statusBar" call BIS_fnc_rscLayer;
    _rscLayer cutRsc["statusBar","PLAIN"];
    systemChat format["Epoch MoD", _rscLayer];
    
    [] spawn {
    	sleep 5;
    	_statusText = "Welcome";
    	_counter = 180;
    	_timeSinceLastUpdate = 0;
    	while {true} do
    	{
    		sleep 1;
    		_counter = _counter - 1;
    		_statusText = "ADD YOUR SERVER TITLE Epoch";
    		((uiNamespace getVariable "statusBar")displayCtrl 1000)ctrlSetText format["%3 | FPS: %1 | Players Online : %2   ", round diag_fps, count playableUnits, _statusText, _counter];
    	};
    };
    
    
  4. add this line to your init.sqf:
     

    [] execVM "scripts\statusBar.sqf";
    
  5. Add this line to your description.ext (if the class RscTitles exists, only add the #include line):
     

    class RscTitles 
    {
    	#include "scripts\statusBar.hpp" 
    };	
    
  6. (OPTIONAL) I think BattleEye will kick you with this script running so you have to edit your scripts.txt (I thought line 21)

I take no credits I'm just sharing, I have no Idea from whom this from.

Link to comment
Share on other sites

"FPS: 55 | Next Restart: 155 Minutes | Players Online: 30 | Krypto: 5000 "

an example of how it looks

 

 

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 - 1.5;
			y = safezoneY + safezoneH - 0.04; //H
			w = 1;
			h = 0.04;
			shadow = 2;
			colorBackground[] = { 1, 0.3, 0, 0.0 };  // uncomment and increase 4th number to have a background
			font = "PuristaSemibold";
			size = 0.04;
			type = 13;
			style = 1;
			text="Loading server info...";
			class Attributes {
				align="left";
				color = "#00FF09";   //#FF8700
			};
		};
	};
};

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]
	Description: Puts a small bar in the bottom right of screen to display in-game information

*/
_rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["osefStatusBar","PLAIN"];
systemChat format["[[GLR]] Loading info...", _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 | Next Restart: %2 Minutes | Players Online: %3 | Krypto: $%4 ", round diag_fps, (240-(round(serverTime/60))), (count playableUnits), EPOCH_playerCrypto];
	}; 
};
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...