Jump to content
Sign in to follow this  
coolfact

problem with nametag script

Recommended Posts

I have borrowed Marker and Melbo's nametag script and done some changes, which seems to work fine until someone respawn, then it won't show that persons nametag, any idea why?

if (isDedicated) exitWith {};

//#define _debug true   //UNCOMMENT TO RUN DEBUG, WILL SHOW TIME TAKEN AND ANY LOSS OF FRAMES
#define _refresh 0.34
#define _distance 20

while{true}do{
       #ifdef _debug
               _initTime = diag_tickTime;
               _frameNo = diag_frameNo;
       #endif

  _blank = " ";

  // PLAYER NAME CHECK AND DISPLAY
       _target = cursorTarget;
       if (_target isKindOf "Man" && player == vehicle player) then{
               if((side _target == playerSide) && (player distance _target) < _distance)then{

			_name = name _target;

                       _nameString = "<t size='0.4' shadow='2' color='#7FFF00'>" + format['%1 %2',_target getVariable ['unitname', name _target]] + "</t>";


// PRINT THE NAME

					[_nameString,0,0.5,_refresh,0,0,0.3] spawn bis_fnc_dynamicText;

               };
       };

// VEHICLE DISPLAY TARGETS

       if ((_target isKindOf "Car" || _target isKindOf "Motorcycle" ||  _target isKindOf "boat" || _target isKindOf "air" || _target isKindOf "Tank") && player == vehicle player) then{
               if((side _target == playerSide) && (player distance _target) < _distance && ((count crew _target) > 0))then{

					_driver = driver _target;
					_gunner =  gunner _target;
					_commander = commander _target;


// Main Driver / GUNNER / COMMANDER Check


										if (Alive _driver) then
										{
										_driver = name _driver;
										}
										else
										{
										_driver = "no driver";
										};

										if (Alive _gunner) then
										{
										_gunner = name _gunner;
										}
										else
										{
										_gunner = "no gunner";
										};

										if (Alive _commander) then
										{
										_commander = name _commander;
										}
										else
										{
										_commander = "no leader";
										};
// PASSENGER/CARGO COUNT

			_freePassengerSpaces = _target emptyPositions "cargo";

			_passengerSpaces = getNumber (configFile >> "CfgVehicles" >>(typeOf _target) >> "transportSoldier");


// SETTING UP THE NAME AND IMAGE FORMATION
							_driver = format ["%1 %2 < /><br/>",_blank, _driver];
							_gunner = format ["%1 %2 < /><br/>",_blank,_gunner];
							_commander = format ["%1 %2 < /><br/>",_blank,_commander];
							_cargo = format ["%1 / %2 < /><br/>",_freePassengerSpaces, _passengerSpaces];

// PRINTING OUT ON SCREEN. TO MOVE POSITION, CHANGE THE X,Y CORODINATES AFTER _printname WITHIN THE DYNAMICTEXT
					_printname = format ["<t size='0.4' color='#7FFF00'>%2</t><t size='0.4' color='#7FFF00'>%3</t><t size='0.4' color='#7FFF00'>%6</t><t size='0.4' color='#7FFF00'>%4</t>"," ", _driver, _gunner, _cargo," ",_commander];

                       [_printname,0,0.5,_refresh,0,0,3] spawn bis_fnc_dynamicText;

               };
       };

       #ifdef _debug
       player sidechat format["time: %1, frames: %2",_initTime - diag_tickTime,_frameNo - diag_frameNo];
       #endif
       sleep _refresh;
};

And gets called in init.sqf

[] execVM "core\Common\Nametag.sqf";

Share this post


Link to post
Share on other sites

Oh, and it's considered rude to remove the headers from scripts! :)

:D will remember that, had just added some stuff in my native language.

Share this post


Link to post
Share on other sites
Have you tried calling it from the players init?

this = execVM "tags.sqf";

Or even an eventhandler?

https://community.bistudio.com/wiki/addEventHandler

After some more testing I have found out that that when a person respawn there is a chance that other people can't see his nametag, however when the person who can't see the nametag pings zeus, it all work again :confused: is there a way to modify the script so you don't have to ping zeus?

Share this post


Link to post
Share on other sites

Does not seems to work, with eventhandlers, have following code in my init.sqf:

[] execVM "core\Common\Nametag.sqf";
player addEventHandler ["Respawn", {
	_this execVM "core\Common\Nametag.sqf";
}
];

Seems like the script see the person who is respawned as dead, and won't show their nametag. any help is much appreciated.

Share this post


Link to post
Share on other sites

Okay seems like respawnOnStart was the cause of trouble

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×