Changed Player variable to not subtract 1. Status bar will now show all players logged in.

This commit is contained in:
Zepheris 2020-02-20 16:11:10 -07:00
parent 3fe39a1d25
commit 4aa2e8ee87
3 changed files with 126 additions and 126 deletions

View File

@ -22,22 +22,22 @@ disableSerialization;
_colour10 = parseText "#CC3300";
_colour0 = parseText "#CC0000";
_colourDead = parseText "#000000";
while {true} do
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
//this is to handle instance where the status bar is disappearing
if(isNull ((uiNamespace getVariable "statusBar")displayCtrl 55555)) then
{
diag_log "statusbar is null create";
disableSerialization;
_rscLayer = "statusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["statusBar","PLAIN"];
};
};
//initialize variables and set values
_unit = _this select 0;
_damage = round ((1 - (damage player)) * 100);
@ -52,13 +52,13 @@ disableSerialization;
_pos = getPosATL player; //switch to this below if you want to have world space coords displayed instead of gridref
_dir = getDir (vehicle player);
_grid = mapGridPosition player;
_xx = (format[_grid]) select [0,3];
_yy = (format[_grid]) select [3,3];
_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));
_players = (count playableUnits -1);
_players = (count playableUnits);
switch(_minutes) do {
case 9: {_minutes = "09"};
case 8: {_minutes = "08"};
@ -71,11 +71,11 @@ disableSerialization;
case 1: {_minutes = "01"};
case 0: {_minutes = "00"};
};
//Colour coding
//Damage
_colourDamage = _colourDefault;
switch true do {
case(_damage >= 100) : {_colourDamage = _colour100;};
case((_damage >= 90) && (_damage < 100)) : {_colourDamage = _colour90;};
@ -90,8 +90,8 @@ disableSerialization;
case((_damage >= 1) && (_damage < 10)) : {_colourDamage = _colour0;};
case(_damage < 1) : {_colourDamage = _colourDead;};
};
//Hunger
_colourHunger = _colourDefault;
switch true do {
@ -108,9 +108,9 @@ disableSerialization;
case((_hunger >= 1) && (_hunger < 10)) : {_colourHunger = _colour0;};
case(_hunger < 1) : {_colourHunger = _colourDead;};
};
//Thirst
_colourThirst = _colourDefault;
_colourThirst = _colourDefault;
switch true do{
case(_thirst >= 100) : {_colourThirst = _colour100;};
case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour90;};
@ -125,7 +125,7 @@ disableSerialization;
case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
case(_thirst < 1) : {_colourThirst = _colourDead;};
};
//Energy
_colourEnergy = _colourDefault;
switch true do{
@ -142,7 +142,7 @@ disableSerialization;
case((_energyPercent >= 1) && (_energyPercent < 10)) : {_colourEnergy = _colour0;};
case(_energyPercent < 1) : {_colourEnergy = _colour0;};
};
//Toxicity
_colourToxicity = _colourDefault;
switch true do{
@ -159,45 +159,45 @@ disableSerialization;
case((_toxPercent >= 1) && (_toxPercent < 10)) : {_colourToxicity = _colour90;};
case(_toxPercent < 1) : {_colourToxicity = _colour100;};
};
//Stamina
_colourStamina = _colourDefault;
((uiNamespace getVariable "statusBar")displayCtrl 55555)ctrlSetStructuredText parseText
((uiNamespace getVariable "statusBar")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='%15'/>%9</t>
<t shadow='1' shadowColor='#000000' color='%17'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\toxicity.paa' color='%17'/>%18</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='%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='%17'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\toxicity.paa' color='%17'/>%18</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'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\restart.paa' color='%10'/>%19:%20</t>
<t shadow='1' shadowColor='#000000' color='%10'>FPS: %7</t>
<t shadow='1' shadowColor='#000000' color='%10'>GRIDREF: %16</t>",
"%",
"%",
_players,
_damage,
_wallet,
_hunger,
_thirst,
_serverFPS,
_energyPercent,
_stamina,
_wallet,
_hunger,
_thirst,
_serverFPS,
_energyPercent,
_stamina,
_colourDefault,
_colourDamage,
_colourHunger,
_colourThirst,
_colourEnergy,
_colourStamina,
format["%1/%2",_xx,_yy],
format["%1/%2",_xx,_yy],
_colourToxicity,
_toxPercent,
_hours,
_minutes
];
};
};
};

View File

@ -22,24 +22,24 @@ disableSerialization;
_colour10 = parseText "#CC3300";
_colour0 = parseText "#CC0000";
_colourDead = parseText "#000000";
while {true} do
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
//this is to handle instance where the status bar is disappearing
if(isNull ((uiNamespace getVariable "statusBar")displayCtrl 55555)) then
{
diag_log "statusbar is null create";
disableSerialization;
_rscLayer = "statusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["statusBar","PLAIN"];
};
};
//initialize variables and set values
_unit = _this select 0;
_damage = round ((1 - (damage player)) * 100);
@ -53,13 +53,13 @@ disableSerialization;
_serverFPS = if (typeName EPOCH_diag_fps == "SCALAR") then [{EPOCH_diag_fps},{"MANIPULATED"}],
_pos = getPosATL player; //switch to this below if you want to have world space coords displayed instead of gridref
_dir = getDir (vehicle player);
_grid = mapGridPosition player; _xx = (format[_grid]) select [0,3];
_yy = (format[_grid]) select [3,3];
_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));
_players = (count playableunits -1);
_players = (count playableunits);
switch(_minutes) do {
case 9: {_minutes = "09"};
case 8: {_minutes = "08"};
@ -72,11 +72,11 @@ disableSerialization;
case 1: {_minutes = "01"};
case 0: {_minutes = "00"};
};
//Colour coding
//Damage
_colourDamage = _colourDefault;
switch true do {
case(_damage >= 100) : {_colourDamage = _colour100;};
case((_damage >= 90) && (_damage < 100)) : {_colourDamage = _colour90;};
@ -91,8 +91,8 @@ disableSerialization;
case((_damage >= 1) && (_damage < 10)) : {_colourDamage = _colour0;};
case(_damage < 1) : {_colourDamage = _colourDead;};
};
//Hunger
_colourHunger = _colourDefault;
switch true do {
@ -109,9 +109,9 @@ disableSerialization;
case((_hunger >= 1) && (_hunger < 10)) : {_colourHunger = _colour0;};
case(_hunger < 1) : {_colourHunger = _colourDead;};
};
//Thirst
_colourThirst = _colourDefault;
_colourThirst = _colourDefault;
switch true do{
case(_thirst >= 100) : {_colourThirst = _colour100;};
case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour90;};
@ -126,7 +126,7 @@ disableSerialization;
case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
case(_thirst < 1) : {_colourThirst = _colourDead;};
};
//Energy
_colourEnergy = _colourDefault;
switch true do{
@ -143,7 +143,7 @@ disableSerialization;
case((_energyPercent >= 1) && (_energyPercent < 10)) : {_colourEnergy = _colour0;};
case(_energyPercent < 1) : {_colourEnergy = _colour0;};
};
//Toxicity
_colourToxicity = _colourDefault;
switch true do{
@ -160,44 +160,44 @@ disableSerialization;
case((_toxPercent >= 1) && (_toxPercent < 10)) : {_colourToxicity = _colour90;};
case(_toxPercent < 1) : {_colourToxicity = _colour100;};
};
//Stamina
_colourStamina = _colourDefault;
//display the information
((uiNamespace getVariable "statusBar")displayCtrl 55555)ctrlSetStructuredText parseText
//display the information
((uiNamespace getVariable "statusBar")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='%15'/>%9</t>
<t shadow='1' shadowColor='#000000' color='%18'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\toxicity.paa' color='%18'/>%19</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='%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='%18'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\toxicity.paa' color='%18'/>%19</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>",
"%",
"%",
_players,
_damage,
_wallet,
_hunger,
_thirst,
_serverFPS,
_energyPercent,
_stamina,
_wallet,
_hunger,
_thirst,
_serverFPS,
_energyPercent,
_stamina,
_colourDefault,
_colourDamage,
_colourHunger,
_colourThirst,
_colourEnergy,
_colourStamina,
_pos,
_pos,
_dir,
_colourToxicity,
_toxPercent
];
};
};
};

View File

@ -22,22 +22,22 @@ disableSerialization;
_colour10 = parseText "#CC3300";
_colour0 = parseText "#CC0000";
_colourDead = parseText "#000000";
while {true} do
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
//this is to handle instance where the status bar is disappearing
if(isNull ((uiNamespace getVariable "statusBar")displayCtrl 55555)) then
{
diag_log "statusbar is null create";
disableSerialization;
_rscLayer = "statusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["statusBar","PLAIN"];
};
};
//initialize variables and set values
_unit = _this select 0;
_damage = round ((1 - (damage player)) * 100);
@ -50,15 +50,15 @@ disableSerialization;
_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];
_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));
_players = (count playableUnits -1);
_players = (count playableUnits);
switch(_minutes) do {
case 9: {_minutes = "09"};
case 8: {_minutes = "08"};
@ -71,12 +71,12 @@ disableSerialization;
case 1: {_minutes = "01"};
case 0: {_minutes = "00"};
};
//Colour coding
//Damage
_colourDamage = _colourDefault;
switch true do {
case(_damage >= 100) : {_colourDamage = _colour100;};
case((_damage >= 90) && (_damage < 100)) : {_colourDamage = _colour90;};
@ -91,7 +91,7 @@ disableSerialization;
case((_damage >= 1) && (_damage < 10)) : {_colourDamage = _colour0;};
case(_damage < 1) : {_colourDamage = _colourDead;};
};
//Hunger
_colourHunger = _colourDefault;
switch true do {
@ -108,11 +108,11 @@ disableSerialization;
case((_hunger >= 1) && (_hunger < 10)) : {_colourHunger = _colour0;};
case(_hunger < 1) : {_colourHunger = _colourDead;};
};
//Thirst
_colourThirst = _colourDefault;
_colourThirst = _colourDefault;
switch true do{
case(_thirst >= 100) : {_colourThirst = _colour100;};
case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour90;};
case((_thirst >= 80) && (_thirst < 90)) : {_colourThirst = _colour80;};
@ -126,11 +126,11 @@ disableSerialization;
case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
case(_thirst < 1) : {_colourThirst = _colourDead;};
};
//Energy
_colourEnergy = _colourDefault;
switch true do{
case(_energyPercent >= 100) : {_colourEnergy = _colour100;};
case((_energyPercent >= 90) && (_energyPercent < 100)) : {_colourEnergy = _colour90;};
case((_energyPercent >= 80) && (_energyPercent < 90)) : {_colourEnergy = _colour80;};
@ -144,7 +144,7 @@ disableSerialization;
case((_energyPercent >= 1) && (_energyPercent < 10)) : {_colourEnergy = _colour0;};
case(_energyPercent < 1) : {_colourEnergy = _colour0;};
};
//Toxicity
_colourToxicity = _colourDefault;
switch true do{
@ -161,32 +161,32 @@ disableSerialization;
case((_toxPercent >= 1) && (_toxPercent < 10)) : {_colourToxicity = _colour90;};
case(_toxPercent < 1) : {_colourToxicity = _colour100;};
};
//Stamina
_colourStamina = _colourDefault;
//display the information
((uiNamespace getVariable "statusBar")displayCtrl 55555)ctrlSetStructuredText parseText
//display the information
((uiNamespace getVariable "statusBar")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='%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='%19'><img size='1.6' shadowColor='#000000' image='addons\status_bar\images\toxicity.paa' color='%19'/>%20</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='%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>",
"%",
"%",
_players,
_damage,
_wallet,
_hunger,
_thirst,
round diag_fps,
_energyPercent,
_wallet,
_hunger,
_thirst,
round diag_fps,
_energyPercent,
_stamina,
_colourDefault,
_colourDamage,
@ -199,11 +199,11 @@ disableSerialization;
_minutes,
_colourToxicity,
_toxPercent
];
};
};
};
};