Advertisement
TheGamingChief

Untitled

Jul 31st, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. /*
  2. ScriptName: Easy NameTags
  3. Version: 1.01
  4. Author: Aloe {itfruit@mail.ru}
  5. Forum: http://arma.at.ua/forum/46-10864-1
  6. Game: Arma2
  7. Multiplayer: not supported
  8.  
  9. Description: Only for Units! Display over head the name and type of non playble units.
  10. Script use the 8th element in addAction params array for execute (very little CPU cost).
  11. Thank ?? for the excellent idea!
  12.  
  13. reserved prefix: ENT_
  14.  
  15. This cscript was edited by [ILG] Jonny for use on the ILG island life server,
  16. all credits to original author though.
  17. */
  18.  
  19. 10 cutRsc ["ENT_playertags", "PLAIN"];
  20.  
  21.  
  22. ENT_addTag = {
  23.  
  24. if(isNil {_this getVariable "ENT_tag"})then{
  25.  
  26. _this setVariable ["ENT_tag", _this addAction ["", "", "", 0, false, false, "", "
  27.  
  28. _display = (uiNamespace getVariable 'ENT_playertag') select 0;
  29. _idc = (uiNamespace getVariable 'ENT_playertag') select 1;
  30. _control = _display displayCtrl _idc;
  31.  
  32. _h = switch(toLower (unitPos _target))do{case 'auto':{2};case 'up':{2};case 'middle':{1.5};case 'down':{0.5};default {0}};
  33. _p = getPosATL _target;
  34. _pos = worldToScreen [_p select 0, _p select 1, _h];
  35.  
  36. _maxDist = 15;
  37. _dist = round (_target distance player);
  38.  
  39. if( _maxDist > _dist && alive _target && cursorTarget == _target && count _pos > 0 )then{
  40. if( _pos select 0 > 0.4 && _pos select 0 < 0.6 && _pos select 1 < 0.4 && _pos select 1 > 0.03 )then{
  41.  
  42. _text = gettext(configFile >> 'CfgVehicles' >> (typeof _target) >> 'displayName');
  43. _wanted = call compile format ['%1_wanted', _target];
  44. _name = switch (true) do
  45. {
  46. case (_target in civarray):
  47. {
  48. parseText format [""<t size='%4' shadow='true' align='center' color='#FFFFFF'>%1<br/>%2</t><br/><t size='1.2' shadow='true' align='center' color='#dfd7a5'>INTERACT(E)</t>"", _target, name _target, _dist, 1.75];
  49. };
  50. };
  51. _control ctrlShow true;
  52. _control ctrlSetStructuredText _name;
  53. _control ctrlSetPosition [(_pos select 0)-0.125,_pos select 1];
  54. _control ctrlCommit 0;
  55. _control ctrlSetFade ( _dist / _maxDist );
  56.  
  57. }else{_control ctrlShow false;};
  58. }else{_control ctrlShow false;};
  59.  
  60. if(!alive _target)then{_target removeAction (_target getVariable 'ENT_tag')};
  61. false
  62.  
  63. "]];
  64. };
  65. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement