Darth_Rogue Posted April 11, 2015 Report Share Posted April 11, 2015 Status Bar With Icons & Server FPS display After seeing all the struggles people were having in other threads I decided to redo this script to make it easier for folks to understand and edit. This has much of the same functionality and generally appears similar to Scarr's build but the back end code is much simpler and should therefore be easier for scripting noobs like myself to see what's going on where and make changes as needed. The color gradients can be edited to suite your liking, but I feel it's pretty well spot on the way it is. Your mileage may vary. Admins can add their UIDs to have the status bar show a real-time server FPS reading and also display their world space coords, which will be very helpful when doing map edits and object placement without having to use an editor just for a few small items. UPDATE - v1.36 Released Due to multiple requests I have added a feature to the status bar where the bar will resize automatically based on player interface size. To update: Remove the current 'status_bar' folder from your mission file and replace it with the 'status_bar' folder you will download from Github. No other changes should be needed. BE filters are the same. Here are a couple screenshot showing what it looks likeFor AdminsFor Players Install Instructions Install Instructions (also included in the download) 1. Place 'addons' folder into your mission file 2. Open init.sqf and add this to the last line //Status Bar if(hasInterface) then{[] execVM "addons\Status_Bar\init_statusBar.sqf"}; NOTE: If you already have an if(hasInterface) section in your inti.sqf, simply add [] execVM "addons\Status_Bar\init_statusBar.sqf" within that existing if(hasInterface) block. There's no need to create a second one. Also, if you find that the script will not start, yet it provides no errors in your client RPT, try moving the init execVM line either lower or higher in your init.sqf. Sometimes load order of scripts does matter. 3. Open description.ext and add this to the last line class RscTitles { #include "addons\Status_Bar\statusBar.hpp" }; NOTE: IF you already have an RscTitles section in description.ext, simply add '#include "addons\Status_Bar\statusBar.hpp"' between the brackets. 4. Open scripts.txt BE filter add make the following additions ~line 20 7 playableunits !=""pto: %3 | Players: %2 | FPS: %1 ", round diag_fps, count playableUnits, EPOCH_playerCrypto, mapGridPosition player];" ~line 23 7 exec !"addons\status_bar\init_statusBar.sqf" 5. Open init_statusBar.sqf and on line 8 add the UIDs of admins whom you want to have the world space coords and server fps display. sb_admin_list = ["XXXXXXXXXXXXXXXXXXXXXX","XXXXXXXXXXXXXXXXXXXX","XXXXXXXXXXXXXXXXXXXXX"]; //admins id goes here 6. Also in init_statusBar.sqf, select whether you want to have your admins in the list have a world space coords display or not (WSC = true/false). This would be global for any admins in the admin list array.DOWNLOAD Credits: See Github Salutesh, -CJ-, Sneakydude and 24 others 27 Link to comment Share on other sites More sharing options...
Gr8 Posted April 11, 2015 Report Share Posted April 11, 2015 Looks Beautiful Darth_Rogue 1 Link to comment Share on other sites More sharing options...
Salutesh Posted April 12, 2015 Report Share Posted April 12, 2015 I love the design! Awesome work! Link to comment Share on other sites More sharing options...
Richie Posted April 12, 2015 Report Share Posted April 12, 2015 I have to agree, that is a really nice looking status bar, good job Darth :d You know what i miss though ? I miss the X players within X meters, I know it can be done but have no clue how, if you want a challenge Darth :unsure: feature request for you. Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 I'll do some home work and see what I can do. :) Link to comment Share on other sites More sharing options...
Salutesh Posted April 12, 2015 Report Share Posted April 12, 2015 I'll do some home work and see what I can do. :) I love you! You added s status for the stamina! I tryed to add this by myself but for any reason it doesnt work. Thank you men! Darth_Rogue 1 Link to comment Share on other sites More sharing options...
BenR Posted April 12, 2015 Report Share Posted April 12, 2015 I have to agree, that is a really nice looking status bar, good job Darth :D You know what i miss though ? I miss the X players within X meters, I know it can be done but have no clue how, if you want a challenge Darth :unsure: feature request for you. You could try using near entities to find how many players are nearby, its how my mission system cleanups work and it seems to work alright. _playersNearbyRadius = 300; /* Distance to count nearby players */ _playersNearby = count (player nearEntities['Man',_playersNearbyRadius]); However near entities and near objects are fairly resource intensive so might be better to only have this scan every 10 seconds for example. Richie and DirtySanchez 2 Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 Yeah I was thinking about that. Depending on the server player count this could potentially end up causing a performance runaway problem. I recall the status bar in DayZ that had what Richie is talking about. But most DayZ servers maxed at 40 players. Link to comment Share on other sites More sharing options...
BenR Posted April 12, 2015 Report Share Posted April 12, 2015 The issue of player counts is why I used nearEntities instead of a playableUnits loop as nearEntities won't change much if theres 3 people on a server or 100 as its only really counting how many are near you, so unless you have the radius turned up to something like 2000 you shouldn't have an issue, but definitely only loop it max every 5 seconds, 10 or 20 second loops are probably good enough for a 300m scan. Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 OK. I'm away for work today but soon as I get a chance I'll play with the code and see if we can incorporate that. Thanks, BenR! Link to comment Share on other sites More sharing options...
DirtySanchez Posted April 12, 2015 Report Share Posted April 12, 2015 You could try using near entities to find how many players are nearby, its how my mission system cleanups work and it seems to work alright._playersNearbyRadius = 300; /* Distance to count nearby players */ _playersNearby = count (player nearEntities['Man',_playersNearbyRadius]); However near entities and near objects are fairly resource intensive so might be better to only have this scan every 10 seconds for example. Gotta love feature requests that come with example code! Darth_Rogue 1 Link to comment Share on other sites More sharing options...
stonXer Posted April 12, 2015 Report Share Posted April 12, 2015 very nice dude, shall be trying out thanks :) Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 I've had several requests to customize this for folks via PM. To keep from having to repeat myself I'll give a few pointers here. If you want to change at which percentage the colors change you can do it a couple different ways. The quick and easy method would be to change the color codes. _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#339900"; //this is now the same as the color above. Both percentiles will appear the same color _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; You can change two (or more) color gradients to the same hex code, meaning they will both appear as the same color. The other option would be to change the code in this section: if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; You can basically break it down like so - "if player's damage level is equal to 100% then use the color code named _colour100". As you move down the line the same basic principles apply. "If player's damage level is greater than or equal to 90, but less than 100, use color code named _colour90". Next comes, "If player's damage level is greater than or equal to 80, but less than 90, use color code named _colour80". Lather, rinse, repeat...all the way down the line. It's also the same for every respective section, including hunger, thrist and energy levels. By changing the logic on these lines you can change the behavior of the status bar. If you wanted to you could even totally reverse it and have it appear red in color at 100% and green closer to 0%. It's not as intimidating as it looks. With a little bit of thought and some good ol' fashioned trial and error I'm sure nearly anyone can edit this to do what they want it to do. Don't get me wrong, I don't mind helping people, but I'm getting tons of PMs all asking the same thing, and me doing it for people isn't helping folks to learn anything. Personal experience is a better teacher than I'll ever be. :) Madbull and DirtySanchez 2 Link to comment Share on other sites More sharing options...
Salutesh Posted April 12, 2015 Report Share Posted April 12, 2015 Is there a way to get a server restart timer into this? :) I am still quite a noob with that serverTime stuff... Link to comment Share on other sites More sharing options...
Friendly Posted April 12, 2015 Report Share Posted April 12, 2015 Nice Job Man! Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 For those that want a restart timer use this version. Do note though that the time will not be accurate if you restart your server prior to a normal restart event. waitUntil {!(isNull (findDisplay 46))}; disableSerialization; /* File: fn_statusBar.sqf Author: Osef (Ported to EpochMod by piX) Edited by: [piX] Description: Puts a small bar in the bottom centre of screen to display in-game information Modified by: ScaRR Description: Modified status bar to display player Krypto, Next Server restart time based on real_date.dll from Kilzone Kid (which can be found at http://killzonekid.com/arma-extension-real_date-dll-v3-0/) and display the Thirst, Hunger and damage as percentages. Added colouring to the status bar elements, that changes gradually depending on the percentages. Added flashing of the values if values are within a certain threshold Modified by: Darth_Rogue 4/11/15 Description: Added admin section to display real-time server FPS and world space coords Modified health, food and drink values to display from a starting point of 100% instead of starting at 0% Removed Hex color scheme and went to a hard coded method easier for folks to understand and edit colors Removed restart timer due to multiple glitches (divide by 0 errors with certain time zones) Added second section to hpp file to provide properly aligned background for players vs. admin menus Added GRIDREF display for players PLEASE KEEP CREDITS - THEY ARE DUE TO THOSE WHO PUT IN THE EFFORT! */ if ((getPlayerUID player) in [ "XXXXXXXXXXXXXXXXXX" //admins id goes here ]) then { _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"]; systemChat format["Loading Admin info...", _rscLayer]; [] spawn { sleep 5; //set the color values. //Additional color codes can be found here: http://html-color-codes.com/ _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#33CC00"; _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; _uid = getPlayerUID player; while {true} do { sleep 1; //moved the creation of the status bar inside the loop and create it if it is null, //this is to handle instance where the status bar is disappearing if(isNull ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)) then{ diag_log "statusbar is null create"; disableSerialization; _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"]; }; //initialize variables and set values _unit = _this select 0; _damage = round ((1 - (damage player)) * 100); //_damage = (round(_damage * 100)); _hunger = round((EPOCH_playerHunger/5000) * 100); _thirst = round((EPOCH_playerThirst/2500) * 100); _wallet = EPOCH_playerCrypto; _stamina = round(EPOCH_playerStamina * 100) / 100; _energy = round(EPOCH_playerEnergy); _energyPercent = floor((_energy / 2500 ) * 100); _serverFPS = if (typeName EPOCH_diag_fps == "SCALAR") then [{EPOCH_diag_fps},{"MANIPULATED"}], _pos = getPosATL player; _dir = getDir (vehicle player); //Colour coding // Damage _colourDamage = _colourDefault; if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; if(_damage < 1) then{_colourDamage = _colourDead;}; // Hunger _colourHunger = _colourDefault; if(_hunger >= 100) then{_colourHunger = _colour100;}; if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;}; if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;}; if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;}; if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;}; if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;}; if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;}; if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;}; if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;}; if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;}; if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;}; if(_hunger < 1) then{_colourHunger = _colourDead;}; // Thirst _colourThirst = _colourDefault; if(_thirst >= 100) then{_colourThirst = _colour100;}; if((_thirst >= 90) && (_thirst < 100)) then {_colourThirst = _colour90;}; if((_thirst >= 80) && (_thirst < 90)) then {_colourThirst = _colour80;}; if((_thirst >= 70) && (_thirst < 80)) then {_colourThirst = _colour70;}; if((_thirst >= 60) && (_thirst < 70)) then {_colourThirst = _colour60;}; if((_thirst >= 50) && (_thirst < 60)) then {_colourThirst = _colour50;}; if((_thirst >= 40) && (_thirst < 50)) then {_colourThirst = _colour40;}; if((_thirst >= 30) && (_thirst < 40)) then {_colourThirst = _colour30;}; if((_thirst >= 20) && (_thirst < 30)) then {_colourThirst = _colour20;}; if((_thirst >= 10) && (_thirst < 20)) then {_colourThirst = _colour10;}; if((_thirst >= 1) && (_thirst < 10)) then {_colourThirst = _colour0;}; if(_thirst < 1) then{_colourThirst = _colourDead;}; // Energy _colourEnergy = _colourDefault; if(_energyPercent >= 100) then{_colourEnergy = _colour100;}; if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;}; if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;}; if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;}; if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;}; if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;}; if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;}; if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;}; if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;}; if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;}; if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;}; if(_energyPercent < 1) then{_colourEnergy = _colour0;}; // Stamina _colourStamina = _colourDefault; //display the information ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)ctrlSetStructuredText parseText format[" <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\players.paa' color='%10'/> %2</t> <t shadow='1' shadowColor='#000000' color='%11'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\damage.paa' color='%11'/> %3%1</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\krypto.paa' color='%10'/> %4</t> <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\hunger.paa' color='%12'/> %5%1</t> <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\thirst.paa' color='%13'/> %6%1</t> <t shadow='1' shadowColor='#000000' color='%15'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\stamina.paa' color='%15'/>%9</t> <t shadow='1' shadowColor='#000000' color='%14'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\energy.paa' color='%14'/>%8%1</t> <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t> <t shadow='1' shadowColor='#000000' color='%10'>POS: %16</t> <t shadow='1' shadowColor='#000000' color='%10'>DIR: %17</t>", "%", count playableUnits, _damage, _wallet, _hunger, _thirst, _serverFPS, _energyPercent, _stamina, _colourDefault, _colourDamage, _colourHunger, _colourThirst, _colourEnergy, _colourStamina, _pos, _dir ]; }; }; } else { _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBar","PLAIN"]; systemChat format["Loading Player info...", _rscLayer]; [] spawn { sleep 5; //set the color values. //Additional color codes can be found here: http://html-color-codes.com/ _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#33CC00"; _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; _uid = getPlayerUID player; while {true} do { sleep 1; //moved the creation of the status bar inside the loop and create it if it is null, //this is to handle instance where the status bar is disappearing if(isNull ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)) then{ diag_log "statusbar is null create"; disableSerialization; _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBar","PLAIN"]; }; //initialize variables and set values _unit = _this select 0; _damage = round ((1 - (damage player)) * 100); //_damage = (round(_damage * 100)); _hunger = round((EPOCH_playerHunger/5000) * 100); _thirst = round((EPOCH_playerThirst/2500) * 100); _wallet = EPOCH_playerCrypto; _stamina = round(EPOCH_playerStamina * 100) / 100; _energy = round(EPOCH_playerEnergy); _energyPercent = floor((_energy / 2500 ) * 100); _fps = format["%1", diag_fps]; _grid = mapGridPosition player; _xx = (format[_grid]) select [0,3]; _yy = (format[_grid]) select [3,3]; _time = (round(240-(serverTime)/60)); //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals _hours = (floor(_time/60)); _minutes = (_time - (_hours * 60)); switch(_minutes) do { case 9: {_minutes = "09"}; case 8: {_minutes = "08"}; case 7: {_minutes = "07"}; case 6: {_minutes = "06"}; case 5: {_minutes = "05"}; case 4: {_minutes = "04"}; case 3: {_minutes = "03"}; case 2: {_minutes = "02"}; case 1: {_minutes = "01"}; case 0: {_minutes = "00"}; }; //Colour coding // Damage _colourDamage = _colourDefault; if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; if(_damage < 1) then{_colourDamage = _colourDead;}; // Hunger _colourHunger = _colourDefault; if(_hunger >= 100) then{_colourHunger = _colour100;}; if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;}; if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;}; if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;}; if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;}; if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;}; if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;}; if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;}; if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;}; if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;}; if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;}; if(_hunger < 1) then{_colourHunger = _colourDead;}; // Thirst _colourThirst = _colourDefault; if(_thirst >= 100) then{_colourThirst = _colour100;}; if((_thirst >= 90) && (_thirst < 100)) then {_colourThirst = _colour90;}; if((_thirst >= 80) && (_thirst < 90)) then {_colourThirst = _colour80;}; if((_thirst >= 70) && (_thirst < 80)) then {_colourThirst = _colour70;}; if((_thirst >= 60) && (_thirst < 70)) then {_colourThirst = _colour60;}; if((_thirst >= 50) && (_thirst < 60)) then {_colourThirst = _colour50;}; if((_thirst >= 40) && (_thirst < 50)) then {_colourThirst = _colour40;}; if((_thirst >= 30) && (_thirst < 40)) then {_colourThirst = _colour30;}; if((_thirst >= 20) && (_thirst < 30)) then {_colourThirst = _colour20;}; if((_thirst >= 10) && (_thirst < 20)) then {_colourThirst = _colour10;}; if((_thirst >= 1) && (_thirst < 10)) then {_colourThirst = _colour0;}; if(_thirst < 1) then{_colourThirst = _colourDead;}; // Energy _colourEnergy = _colourDefault; if(_energyPercent >= 100) then{_colourEnergy = _colour100;}; if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;}; if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;}; if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;}; if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;}; if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;}; if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;}; if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;}; if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;}; if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;}; if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;}; if(_energyPercent < 1) then{_colourEnergy = _colour0;}; // Stamina _colourStamina = _colourDefault; //display the information ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)ctrlSetStructuredText parseText format[" <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\players.paa' color='%10'/> %2</t> <t shadow='1' shadowColor='#000000' color='%11'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\damage.paa' color='%11'/> %3%1</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\krypto.paa' color='%10'/> %4</t> <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\hunger.paa' color='%12'/> %5%1</t> <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\thirst.paa' color='%13'/> %6%1</t> <t shadow='1' shadowColor='#000000' color='%15'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\stamina.paa' color='%16'/>%9</t> <t shadow='1' shadowColor='#000000' color='%14'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\energy.paa' color='%14'/>%8%1</t> <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t> <t shadow='1' shadowColor='#000000' color='%10'>GRIDREF: %16</t> <t shadow='1' shadowColor='#000000' color='%10'>RESTART IN: %17:%18</t>", "%", count playableUnits, _damage, _wallet, _hunger, _thirst, round diag_fps, _energyPercent, _stamina, _colourDefault, _colourDamage, _colourHunger, _colourThirst, _colourEnergy, _colourStamina, format["%1/%2",_xx,_yy], _hours, _minutes ]; }; }; }; This is untested since I'm not home today, but it's the same code I've used in earlier status bar builds so it should be good. Salutesh 1 Link to comment Share on other sites More sharing options...
Salutesh Posted April 12, 2015 Report Share Posted April 12, 2015 For those that want a restart timer use this version. Do note though that the time will not be accurate if you restart your server prior to a normal restart event. waitUntil {!(isNull (findDisplay 46))}; disableSerialization; /* File: fn_statusBar.sqf Author: Osef (Ported to EpochMod by piX) Edited by: [piX] Description: Puts a small bar in the bottom centre of screen to display in-game information Modified by: ScaRR Description: Modified status bar to display player Krypto, Next Server restart time based on real_date.dll from Kilzone Kid (which can be found at http://killzonekid.com/arma-extension-real_date-dll-v3-0/) and display the Thirst, Hunger and damage as percentages. Added colouring to the status bar elements, that changes gradually depending on the percentages. Added flashing of the values if values are within a certain threshold Modified by: Darth_Rogue 4/11/15 Description: Added admin section to display real-time server FPS and world space coords Modified health, food and drink values to display from a starting point of 100% instead of starting at 0% Removed Hex color scheme and went to a hard coded method easier for folks to understand and edit colors Removed restart timer due to multiple glitches (divide by 0 errors with certain time zones) Added second section to hpp file to provide properly aligned background for players vs. admin menus Added GRIDREF display for players PLEASE KEEP CREDITS - THEY ARE DUE TO THOSE WHO PUT IN THE EFFORT! */ if ((getPlayerUID player) in [ "XXXXXXXXXXXXXXXXXX" //admins id goes here ]) then { _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"]; systemChat format["Loading Admin info...", _rscLayer]; [] spawn { sleep 5; //set the color values. //Additional color codes can be found here: http://html-color-codes.com/ _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#33CC00"; _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; _uid = getPlayerUID player; while {true} do { sleep 1; //moved the creation of the status bar inside the loop and create it if it is null, //this is to handle instance where the status bar is disappearing if(isNull ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)) then{ diag_log "statusbar is null create"; disableSerialization; _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"]; }; //initialize variables and set values _unit = _this select 0; _damage = round ((1 - (damage player)) * 100); //_damage = (round(_damage * 100)); _hunger = round((EPOCH_playerHunger/5000) * 100); _thirst = round((EPOCH_playerThirst/2500) * 100); _wallet = EPOCH_playerCrypto; _stamina = round(EPOCH_playerStamina * 100) / 100; _energy = round(EPOCH_playerEnergy); _energyPercent = floor((_energy / 2500 ) * 100); _serverFPS = if (typeName EPOCH_diag_fps == "SCALAR") then [{EPOCH_diag_fps},{"MANIPULATED"}], _pos = getPosATL player; _dir = getDir (vehicle player); //Colour coding // Damage _colourDamage = _colourDefault; if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; if(_damage < 1) then{_colourDamage = _colourDead;}; // Hunger _colourHunger = _colourDefault; if(_hunger >= 100) then{_colourHunger = _colour100;}; if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;}; if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;}; if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;}; if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;}; if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;}; if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;}; if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;}; if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;}; if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;}; if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;}; if(_hunger < 1) then{_colourHunger = _colourDead;}; // Thirst _colourThirst = _colourDefault; if(_thirst >= 100) then{_colourThirst = _colour100;}; if((_thirst >= 90) && (_thirst < 100)) then {_colourThirst = _colour90;}; if((_thirst >= 80) && (_thirst < 90)) then {_colourThirst = _colour80;}; if((_thirst >= 70) && (_thirst < 80)) then {_colourThirst = _colour70;}; if((_thirst >= 60) && (_thirst < 70)) then {_colourThirst = _colour60;}; if((_thirst >= 50) && (_thirst < 60)) then {_colourThirst = _colour50;}; if((_thirst >= 40) && (_thirst < 50)) then {_colourThirst = _colour40;}; if((_thirst >= 30) && (_thirst < 40)) then {_colourThirst = _colour30;}; if((_thirst >= 20) && (_thirst < 30)) then {_colourThirst = _colour20;}; if((_thirst >= 10) && (_thirst < 20)) then {_colourThirst = _colour10;}; if((_thirst >= 1) && (_thirst < 10)) then {_colourThirst = _colour0;}; if(_thirst < 1) then{_colourThirst = _colourDead;}; // Energy _colourEnergy = _colourDefault; if(_energyPercent >= 100) then{_colourEnergy = _colour100;}; if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;}; if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;}; if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;}; if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;}; if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;}; if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;}; if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;}; if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;}; if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;}; if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;}; if(_energyPercent < 1) then{_colourEnergy = _colour0;}; // Stamina _colourStamina = _colourDefault; //display the information ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)ctrlSetStructuredText parseText format[" <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\players.paa' color='%10'/> %2</t> <t shadow='1' shadowColor='#000000' color='%11'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\damage.paa' color='%11'/> %3%1</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\krypto.paa' color='%10'/> %4</t> <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\hunger.paa' color='%12'/> %5%1</t> <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\thirst.paa' color='%13'/> %6%1</t> <t shadow='1' shadowColor='#000000' color='%15'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\stamina.paa' color='%15'/>%9</t> <t shadow='1' shadowColor='#000000' color='%14'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\energy.paa' color='%14'/>%8%1</t> <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t> <t shadow='1' shadowColor='#000000' color='%10'>POS: %16</t> <t shadow='1' shadowColor='#000000' color='%10'>DIR: %17</t>", "%", count playableUnits, _damage, _wallet, _hunger, _thirst, _serverFPS, _energyPercent, _stamina, _colourDefault, _colourDamage, _colourHunger, _colourThirst, _colourEnergy, _colourStamina, _pos, _dir ]; }; }; } else { _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBar","PLAIN"]; systemChat format["Loading Player info...", _rscLayer]; [] spawn { sleep 5; //set the color values. //Additional color codes can be found here: http://html-color-codes.com/ _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#33CC00"; _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; _uid = getPlayerUID player; while {true} do { sleep 1; //moved the creation of the status bar inside the loop and create it if it is null, //this is to handle instance where the status bar is disappearing if(isNull ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)) then{ diag_log "statusbar is null create"; disableSerialization; _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBar","PLAIN"]; }; //initialize variables and set values _unit = _this select 0; _damage = round ((1 - (damage player)) * 100); //_damage = (round(_damage * 100)); _hunger = round((EPOCH_playerHunger/5000) * 100); _thirst = round((EPOCH_playerThirst/2500) * 100); _wallet = EPOCH_playerCrypto; _stamina = round(EPOCH_playerStamina * 100) / 100; _energy = round(EPOCH_playerEnergy); _energyPercent = floor((_energy / 2500 ) * 100); _fps = format["%1", diag_fps]; _grid = mapGridPosition player; _xx = (format[_grid]) select [0,3]; _yy = (format[_grid]) select [3,3]; _counter = _counter - 1; _time = (round(240-(serverTime)/60)); //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals _hours = (floor(_time/60)); _minutes = (_time - (_hours * 60)); switch(_minutes) do { case 9: {_minutes = "09"}; case 8: {_minutes = "08"}; case 7: {_minutes = "07"}; case 6: {_minutes = "06"}; case 5: {_minutes = "05"}; case 4: {_minutes = "04"}; case 3: {_minutes = "03"}; case 2: {_minutes = "02"}; case 1: {_minutes = "01"}; case 0: {_minutes = "00"}; }; //Colour coding // Damage _colourDamage = _colourDefault; if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; if(_damage < 1) then{_colourDamage = _colourDead;}; // Hunger _colourHunger = _colourDefault; if(_hunger >= 100) then{_colourHunger = _colour100;}; if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;}; if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;}; if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;}; if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;}; if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;}; if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;}; if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;}; if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;}; if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;}; if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;}; if(_hunger < 1) then{_colourHunger = _colourDead;}; // Thirst _colourThirst = _colourDefault; if(_thirst >= 100) then{_colourThirst = _colour100;}; if((_thirst >= 90) && (_thirst < 100)) then {_colourThirst = _colour90;}; if((_thirst >= 80) && (_thirst < 90)) then {_colourThirst = _colour80;}; if((_thirst >= 70) && (_thirst < 80)) then {_colourThirst = _colour70;}; if((_thirst >= 60) && (_thirst < 70)) then {_colourThirst = _colour60;}; if((_thirst >= 50) && (_thirst < 60)) then {_colourThirst = _colour50;}; if((_thirst >= 40) && (_thirst < 50)) then {_colourThirst = _colour40;}; if((_thirst >= 30) && (_thirst < 40)) then {_colourThirst = _colour30;}; if((_thirst >= 20) && (_thirst < 30)) then {_colourThirst = _colour20;}; if((_thirst >= 10) && (_thirst < 20)) then {_colourThirst = _colour10;}; if((_thirst >= 1) && (_thirst < 10)) then {_colourThirst = _colour0;}; if(_thirst < 1) then{_colourThirst = _colourDead;}; // Energy _colourEnergy = _colourDefault; if(_energyPercent >= 100) then{_colourEnergy = _colour100;}; if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;}; if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;}; if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;}; if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;}; if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;}; if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;}; if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;}; if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;}; if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;}; if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;}; if(_energyPercent < 1) then{_colourEnergy = _colour0;}; // Stamina _colourStamina = _colourDefault; //display the information ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)ctrlSetStructuredText parseText format[" <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\players.paa' color='%10'/> %2</t> <t shadow='1' shadowColor='#000000' color='%11'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\damage.paa' color='%11'/> %3%1</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\krypto.paa' color='%10'/> %4</t> <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\hunger.paa' color='%12'/> %5%1</t> <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\thirst.paa' color='%13'/> %6%1</t> <t shadow='1' shadowColor='#000000' color='%15'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\stamina.paa' color='%16'/>%9</t> <t shadow='1' shadowColor='#000000' color='%14'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\energy.paa' color='%14'/>%8%1</t> <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t> <t shadow='1' shadowColor='#000000' color='%10'>GRIDREF: %16</t> <t shadow='1' shadowColor='#000000' color='%10'>RESTART IN: %17:%18</t>", "%", count playableUnits, _damage, _wallet, _hunger, _thirst, round diag_fps, _energyPercent, _stamina, _colourDefault, _colourDamage, _colourHunger, _colourThirst, _colourEnergy, _colourStamina, format["%1/%2",_xx,_yy], _hours, _minutes, _counter ]; }; }; }; This is untested since I'm not home today, but it's the same code I've used in earlier status bar builds so it should be good. Thank you! EDIT: Chill out and relax, take your time if you get home :D Undefined variable _counter (Line 244) Also ingame it looks like this: Link to comment Share on other sites More sharing options...
fullaholes Posted April 12, 2015 Report Share Posted April 12, 2015 My server won't start with this added, followed the instructions word for word but the server refuses to start... Any ideas ? Thanks in advance Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 Thank you! EDIT: Chill out and relax, take your time if you get home :D Undefined variable _counter (Line 244) Also ingame it looks like this: Thanks for the heads-up! That was a quick copy/paste job from some old code. I've fixed the above post and removed that variable, as it wasn't needed for this purpose. EDIT: I noticed from your screenshot that the restart timer is cut off. When I get home tomorrow I'll adjust the hpp file to allow for the wider bar from the addition of the restart timer and update the files. Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 12, 2015 Author Report Share Posted April 12, 2015 My server won't start with this added, followed the instructions word for word but the server refuses to start... Any ideas ? Thanks in advance Please post your client and server RPTs, but my best guess is that it's a problem in your description.ext. Check to make sure you haven't missed any }; or have two instances of RscTitles sections. An error in description.ext is the only part of this script that would cause an error where the server won't start at all. Link to comment Share on other sites More sharing options...
Fleischer111 Posted April 13, 2015 Report Share Posted April 13, 2015 very nice work .. looks very good .. even with restart ..only my status bar is not in the center but left .. how can I change this ?? Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 13, 2015 Author Report Share Posted April 13, 2015 I'm going to fix it tomorrow and release the updated files. If you want to work on it yourself in the meantime feel free to do so. Open the .hpp file and look for the x and w settings. X is left and right adjustment. W is width overall. Keep in mind that there are two sections in the hpp file. One for the admin section and the other for players. I only added the restart timer to the players section so it will be in the lower half of the file that you want to make those adjustments. Fleischer111 1 Link to comment Share on other sites More sharing options...
Salutesh Posted April 13, 2015 Report Share Posted April 13, 2015 I'm going to fix it tomorrow and release the updated files. If you want to work on it yourself in the meantime feel free to do so. Open the .hpp file and look for the x and w settings. X is left and right adjustment. W is width overall. Keep in mind that there are two sections in the hpp file. One for the admin section and the other for players. I only added the restart timer to the players section so it will be in the lower half of the file that you want to make those adjustments. Thanks i will try it out :D EDIT : Here we go! I added the Server restart timer also to the Admin Statusbar and added the missing part for that nice icon. Also make a small edit in the .hpp file to fit the bar so it doesnt cross the Arma HUD. fn_statusBar_with_icons.sqf waitUntil {!(isNull (findDisplay 46))}; disableSerialization; /* File: fn_statusBar.sqf Author: Osef (Ported to EpochMod by piX) Edited by: [piX] Description: Puts a small bar in the bottom centre of screen to display in-game information Modified by: ScaRR Description: Modified status bar to display player Krypto, Next Server restart time based on real_date.dll from Kilzone Kid (which can be found at http://killzonekid.com/arma-extension-real_date-dll-v3-0/) and display the Thirst, Hunger and damage as percentages. Added colouring to the status bar elements, that changes gradually depending on the percentages. Added flashing of the values if values are within a certain threshold Modified by: Darth_Rogue 4/11/15 Description: Added admin section to display real-time server FPS and world space coords Modified health, food and drink values to display from a starting point of 100% instead of starting at 0% Removed Hex color scheme and went to a hard coded method easier for folks to understand and edit colors Removed restart timer due to multiple glitches (divide by 0 errors with certain time zones) Added second section to hpp file to provide properly aligned background for players vs. admin menus Added GRIDREF display for players PLEASE KEEP CREDITS - THEY ARE DUE TO THOSE WHO PUT IN THE EFFORT! */ if ((getPlayerUID player) in admin_list) then { _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"]; systemChat format["Loading Admin info...", _rscLayer]; [] spawn { sleep 5; //set the color values. //Additional color codes can be found here: http://html-color-codes.com/ _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#33CC00"; _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; _uid = getPlayerUID player; while {true} do { sleep 1; //moved the creation of the status bar inside the loop and create it if it is null, //this is to handle instance where the status bar is disappearing if(isNull ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)) then { diag_log "statusbar is null create"; disableSerialization; _rscLayer = "osefStatusBarAdmin" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBarAdmin","PLAIN"]; }; //initialize variables and set values _unit = _this select 0; _damage = round ((1 - (damage player)) * 100); //_damage = (round(_damage * 100)); _hunger = round((EPOCH_playerHunger/5000) * 100); _thirst = round((EPOCH_playerThirst/2500) * 100); _wallet = EPOCH_playerCrypto; _stamina = round(EPOCH_playerStamina * 100) / 100; _energy = round(EPOCH_playerEnergy); _energyPercent = floor((_energy / 2500 ) * 100); _serverFPS = if (typeName EPOCH_diag_fps == "SCALAR") then [{EPOCH_diag_fps},{"MANIPULATED"}], _pos = getPosATL player; _dir = getDir (vehicle player); _grid = mapGridPosition player; _xx = (format[_grid]) select [0,3]; _yy = (format[_grid]) select [3,3]; _time = (round(240-(serverTime)/60)); //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals _hours = (floor(_time/60)); _minutes = (_time - (_hours * 60)); switch(_minutes) do { case 9: {_minutes = "09"}; case 8: {_minutes = "08"}; case 7: {_minutes = "07"}; case 6: {_minutes = "06"}; case 5: {_minutes = "05"}; case 4: {_minutes = "04"}; case 3: {_minutes = "03"}; case 2: {_minutes = "02"}; case 1: {_minutes = "01"}; case 0: {_minutes = "00"}; }; //Colour coding //Damage _colourDamage = _colourDefault; if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; if(_damage < 1) then{_colourDamage = _colourDead;}; //Hunger _colourHunger = _colourDefault; if(_hunger >= 100) then{_colourHunger = _colour100;}; if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;}; if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;}; if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;}; if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;}; if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;}; if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;}; if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;}; if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;}; if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;}; if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;}; if(_hunger < 1) then{_colourHunger = _colourDead;}; //Thirst _colourThirst = _colourDefault; if(_thirst >= 100) then{_colourThirst = _colour100;}; if((_thirst >= 90) && (_thirst < 100)) then {_colourThirst = _colour90;}; if((_thirst >= 80) && (_thirst < 90)) then {_colourThirst = _colour80;}; if((_thirst >= 70) && (_thirst < 80)) then {_colourThirst = _colour70;}; if((_thirst >= 60) && (_thirst < 70)) then {_colourThirst = _colour60;}; if((_thirst >= 50) && (_thirst < 60)) then {_colourThirst = _colour50;}; if((_thirst >= 40) && (_thirst < 50)) then {_colourThirst = _colour40;}; if((_thirst >= 30) && (_thirst < 40)) then {_colourThirst = _colour30;}; if((_thirst >= 20) && (_thirst < 30)) then {_colourThirst = _colour20;}; if((_thirst >= 10) && (_thirst < 20)) then {_colourThirst = _colour10;}; if((_thirst >= 1) && (_thirst < 10)) then {_colourThirst = _colour0;}; if(_thirst < 1) then{_colourThirst = _colourDead;}; //Energy _colourEnergy = _colourDefault; if(_energyPercent >= 100) then{_colourEnergy = _colour100;}; if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;}; if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;}; if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;}; if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;}; if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;}; if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;}; if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;}; if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;}; if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;}; if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;}; if(_energyPercent < 1) then{_colourEnergy = _colour0;}; //Stamina _colourStamina = _colourDefault; //display the information ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)ctrlSetStructuredText parseText format[" <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\players.paa' color='%10'/> %2</t> <t shadow='1' shadowColor='#000000' color='%11'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\damage.paa' color='%11'/> %3%1</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\krypto.paa' color='%10'/> %4</t> <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\hunger.paa' color='%12'/> %5%1</t> <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\thirst.paa' color='%13'/> %6%1</t> <t shadow='1' shadowColor='#000000' color='%15'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\stamina.paa' color='%15'/>%9</t> <t shadow='1' shadowColor='#000000' color='%14'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\energy.paa' color='%14'/>%8%1</t> <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t> <t shadow='1' shadowColor='#000000' color='%10'>POS: %16</t> <t shadow='1' shadowColor='#000000' color='%10'>DIR: %17</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\restart.paa' color='%10'/>%18:%19</t>", "%", count playableUnits, _damage, _wallet, _hunger, _thirst, _serverFPS, _energyPercent, _stamina, _colourDefault, _colourDamage, _colourHunger, _colourThirst, _colourEnergy, _colourStamina, format["%1/%2",_xx,_yy], _dir, _hours, _minutes ]; }; }; } else { _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBar","PLAIN"]; systemChat format["Loading Player info...", _rscLayer]; [] spawn { sleep 5; //set the color values. //Additional color codes can be found here: http://html-color-codes.com/ _colourDefault = parseText "#adadad"; //set your default colour here _colour100 = parseText "#336600"; _colour90 = parseText "#339900"; _colour80 = parseText "#33CC00"; _colour70 = parseText "#33FF00"; _colour60 = parseText "#66FF00"; _colour50 = parseText "#CCFF00"; _colour40 = parseText "#CCCC00"; _colour30 = parseText "#CC9900"; _colour20 = parseText "#CC6600"; _colour10 = parseText "#CC3300"; _colour0 = parseText "#CC0000"; _colourDead = parseText "#000000"; _uid = getPlayerUID player; while {true} do { sleep 1; //moved the creation of the status bar inside the loop and create it if it is null, //this is to handle instance where the status bar is disappearing if(isNull ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)) then { diag_log "statusbar is null create"; disableSerialization; _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer; _rscLayer cutRsc["osefStatusBar","PLAIN"]; }; //initialize variables and set values _unit = _this select 0; _damage = round ((1 - (damage player)) * 100); //_damage = (round(_damage * 100)); _hunger = round((EPOCH_playerHunger/5000) * 100); _thirst = round((EPOCH_playerThirst/2500) * 100); _wallet = EPOCH_playerCrypto; _stamina = round(EPOCH_playerStamina * 100) / 100; _energy = round(EPOCH_playerEnergy); _energyPercent = floor((_energy / 2500 ) * 100); _fps = format["%1", diag_fps]; _grid = mapGridPosition player; _xx = (format[_grid]) select [0,3]; _yy = (format[_grid]) select [3,3]; _time = (round(240-(serverTime)/60)); //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals _hours = (floor(_time/60)); _minutes = (_time - (_hours * 60)); switch(_minutes) do { case 9: {_minutes = "09"}; case 8: {_minutes = "08"}; case 7: {_minutes = "07"}; case 6: {_minutes = "06"}; case 5: {_minutes = "05"}; case 4: {_minutes = "04"}; case 3: {_minutes = "03"}; case 2: {_minutes = "02"}; case 1: {_minutes = "01"}; case 0: {_minutes = "00"}; }; //Colour coding //Damage _colourDamage = _colourDefault; if(_damage >= 100) then{_colourDamage = _colour100;}; if((_damage >= 90) && (_damage < 100)) then {_colourDamage = _colour90;}; if((_damage >= 80) && (_damage < 90)) then {_colourDamage = _colour80;}; if((_damage >= 70) && (_damage < 80)) then {_colourDamage = _colour70;}; if((_damage >= 60) && (_damage < 70)) then {_colourDamage = _colour60;}; if((_damage >= 50) && (_damage < 60)) then {_colourDamage = _colour50;}; if((_damage >= 40) && (_damage < 50)) then {_colourDamage = _colour40;}; if((_damage >= 30) && (_damage < 40)) then {_colourDamage = _colour30;}; if((_damage >= 20) && (_damage < 30)) then {_colourDamage = _colour20;}; if((_damage >= 10) && (_damage < 20)) then {_colourDamage = _colour10;}; if((_damage >= 1) && (_damage < 10)) then {_colourDamage = _colour0;}; if(_damage < 1) then{_colourDamage = _colourDead;}; //Hunger _colourHunger = _colourDefault; if(_hunger >= 100) then{_colourHunger = _colour100;}; if((_hunger >= 90) && (_hunger < 100)) then {_colourHunger = _colour90;}; if((_hunger >= 80) && (_hunger < 90)) then {_colourHunger = _colour80;}; if((_hunger >= 70) && (_hunger < 80)) then {_colourHunger = _colour70;}; if((_hunger >= 60) && (_hunger < 70)) then {_colourHunger = _colour60;}; if((_hunger >= 50) && (_hunger < 60)) then {_colourHunger = _colour50;}; if((_hunger >= 40) && (_hunger < 50)) then {_colourHunger = _colour40;}; if((_hunger >= 30) && (_hunger < 40)) then {_colourHunger = _colour30;}; if((_hunger >= 20) && (_hunger < 30)) then {_colourHunger = _colour20;}; if((_hunger >= 10) && (_hunger < 20)) then {_colourHunger = _colour10;}; if((_hunger >= 1) && (_hunger < 10)) then {_colourHunger = _colour0;}; if(_hunger < 1) then{_colourHunger = _colourDead;}; //Thirst _colourThirst = _colourDefault; if(_thirst >= 100) then{_colourThirst = _colour100;}; if((_thirst >= 90) && (_thirst < 100)) then {_colourThirst = _colour90;}; if((_thirst >= 80) && (_thirst < 90)) then {_colourThirst = _colour80;}; if((_thirst >= 70) && (_thirst < 80)) then {_colourThirst = _colour70;}; if((_thirst >= 60) && (_thirst < 70)) then {_colourThirst = _colour60;}; if((_thirst >= 50) && (_thirst < 60)) then {_colourThirst = _colour50;}; if((_thirst >= 40) && (_thirst < 50)) then {_colourThirst = _colour40;}; if((_thirst >= 30) && (_thirst < 40)) then {_colourThirst = _colour30;}; if((_thirst >= 20) && (_thirst < 30)) then {_colourThirst = _colour20;}; if((_thirst >= 10) && (_thirst < 20)) then {_colourThirst = _colour10;}; if((_thirst >= 1) && (_thirst < 10)) then {_colourThirst = _colour0;}; if(_thirst < 1) then{_colourThirst = _colourDead;}; //Energy _colourEnergy = _colourDefault; if(_energyPercent >= 100) then{_colourEnergy = _colour100;}; if((_energyPercent >= 90) && (_energyPercent < 100)) then {_colourEnergy = _colour90;}; if((_energyPercent >= 80) && (_energyPercent < 90)) then {_colourEnergy = _colour80;}; if((_energyPercent >= 70) && (_energyPercent < 80)) then {_colourEnergy = _colour70;}; if((_energyPercent >= 60) && (_energyPercent < 70)) then {_colourEnergy = _colour60;}; if((_energyPercent >= 50) && (_energyPercent < 60)) then {_colourEnergy = _colour50;}; if((_energyPercent >= 40) && (_energyPercent < 50)) then {_colourEnergy = _colour40;}; if((_energyPercent >= 30) && (_energyPercent < 40)) then {_colourEnergy = _colour30;}; if((_energyPercent >= 20) && (_energyPercent < 30)) then {_colourEnergy = _colour20;}; if((_energyPercent >= 10) && (_energyPercent < 20)) then {_colourEnergy = _colour10;}; if((_energyPercent >= 1) && (_energyPercent < 10)) then {_colourEnergy = _colour0;}; if(_energyPercent < 1) then{_colourEnergy = _colour0;}; //Stamina _colourStamina = _colourDefault; //display the information ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)ctrlSetStructuredText parseText format[" <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\players.paa' color='%10'/> %2</t> <t shadow='1' shadowColor='#000000' color='%11'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\damage.paa' color='%11'/> %3%1</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\krypto.paa' color='%10'/> %4</t> <t shadow='1' shadowColor='#000000' color='%12'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\hunger.paa' color='%12'/> %5%1</t> <t shadow='1' shadowColor='#000000' color='%13'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\thirst.paa' color='%13'/> %6%1</t> <t shadow='1' shadowColor='#000000' color='%15'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\stamina.paa' color='%16'/>%9</t> <t shadow='1' shadowColor='#000000' color='%14'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\energy.paa' color='%14'/>%8%1</t> <t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t> <t shadow='1' shadowColor='#000000' color='%10'>GRIDREF: %16</t> <t shadow='1' shadowColor='#000000' color='%10'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\restart.paa' color='%10'/>%17:%18</t>", "%", count playableUnits, _damage, _wallet, _hunger, _thirst, round diag_fps, _energyPercent, _stamina, _colourDefault, _colourDamage, _colourHunger, _colourThirst, _colourEnergy, _colourStamina, format["%1/%2",_xx,_yy], _hours, _minutes ]; }; }; }; statusBar.hpp #define ST_RIGHT 0x01 class osefStatusBarAdmin { idd = -1; onLoad = "uiNamespace setVariable ['osefStatusBarAdmin', _this select 0]"; onUnload = "uiNamespace setVariable ['osefStatusBarAdmin', objNull]"; onDestroy = "uiNamespace setVariable ['osefStatusBarAdmin', objNull]"; fadein = 0; fadeout = 0; duration = 10e10; movingEnable = 0; controlsBackground[] = {}; objects[] = {}; class controls { class statusBarText { idc = 55554; x = safezoneX + safezoneW - 2.0; y = safezoneY + safezoneH - 0.1; w = 1.5; h = 0.07; shadow = 2; colorBackground[] = { 0, 0, 0, 0.5 }; // uncomment and increase 4th number to have a background font = "PuristaSemibold"; size = 0.04; type = 13; style = 2; text=""; class Attributes { align="left"; color = "#ffffff";//#5fe60c }; }; }; }; 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 = 55555; x = safezoneX + safezoneW - 1.85; y = safezoneY + safezoneH - 0.1; w = 1.3; h = 0.07; shadow = 2; colorBackground[] = { 0, 0, 0, 0.5 }; // uncomment and increase 4th number to have a background font = "PuristaSemibold"; size = 0.04; type = 13; style = 2; text=""; class Attributes { align="left"; color = "#ffffff";//#5fe60c }; }; }; }; Link to comment Share on other sites More sharing options...
BenR Posted April 13, 2015 Report Share Posted April 13, 2015 I would suggest, just being picky, using switch do instead of if statements to set the colours, looks a bit neater and is better practice to use switch do case instead of if https://community.bistudio.com/wiki/switch_do Link to comment Share on other sites More sharing options...
Darth_Rogue Posted April 13, 2015 Author Report Share Posted April 13, 2015 Thanks, Salutesh! I'll update the main post shortly and credit you for the update. :) BenR - yes I looked at doing that but had some issues getting it right. I'll look into it for a future version. Thanks for the input! Salutesh 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now