Advertisement
Guest User

Untitled

a guest
May 28th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. //player_friendliesCheck.sqf
  2.  
  3. private["_charID", "_friendlies", "_rcharID", "_rfriendlyTo", "_tag", "_player", "_newTagList"];
  4. _charID = player getVariable ["characterID", "0"];
  5. _friendlies = player getVariable ["friendlies", []];
  6. _tagList = player getVariable ["tagList", []];
  7.  
  8. // create tags
  9. {
  10. if (isPlayer _x) then {
  11. _rcharID = _x getVariable ["characterID", "0"];
  12. _rfriendlies = _x getVariable ["friendlies", []];
  13. _rfriendlyTo = _x getVariable ["friendlyTo", []];
  14. if ((_rcharID in _friendlies) and (_charID in _rfriendlies)) then {
  15. if (!(_charID in _rfriendlyTo)) then {
  16. _position = [0,0,0];
  17. _tag = "Sign_sphere10cm_EP1" createVehicleLocal _position;
  18. _tag attachTo [_x,[0,0,5],"lwrist"];
  19. _tag setVariable ["belongsTo", _rcharID];
  20. _rfriendlyTo set [count _rfriendlyTo, _charID];
  21. _x setVariable ["friendlyTo", _rfriendlyTo, true];
  22. _tagList set [count _tagList, [_x, _tag]];
  23. player setVariable ["tagList", _tagList];
  24. titleText [format["You and %1 are now tagged as friendlies.", (name _x)], "PLAIN DOWN"];
  25. };
  26. };
  27. };
  28. } forEach call {
  29. _tempArrayVeh = (getpos player) nearEntities [["Air","Car","Motorcycle","Tank","Ship","StaticWeapon"],10000000];
  30. _tempArrayMan = (getpos player) nearEntities ["CAManBase",10000000];
  31.  
  32. {
  33. if !(isPlayer _x) then
  34. {
  35. _tempArrayMan = _tempArrayMan - [_x];
  36. };
  37. } foreach _tempArrayMan;
  38.  
  39. _tempCrewArray = [];
  40.  
  41. {
  42. _tempCrewArray = _tempCrewArray + crew _x;
  43.  
  44. } foreach _tempArrayVeh;
  45.  
  46. _tempCrewArray = _tempCrewArray - _tempArrayMan;
  47.  
  48. _tempArrayMan = _tempArrayMan + _tempCrewArray;
  49.  
  50. _tempArrayMan
  51. };
  52.  
  53. // keep track of tags created
  54. _newTagList = [];
  55. {
  56. _player = _x select 0;
  57. _tag = _x select 1;
  58.  
  59. // friendly player disconnected
  60. if (!(isPlayer _player)) then {
  61. deleteVehicle _tag;
  62. } else {
  63. _newTagList set [count _newTagList, [_player, _tag]];
  64. };
  65. } forEach _tagList;
  66.  
  67. player setVariable ["tagList", _newTagList];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement