Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 1st, 2012  |  syntax: C++  |  size: 0.67 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //chaircheck.sqf
  2.  
  3.  
  4. sitting = false;
  5. _distToChair = 2;
  6.  
  7.  
  8. while {true} do {
  9.         waitUntil {!sitting};
  10.         _c  = nearestObject [player, "FoldChair_with_Cargo"];
  11.                 if ((player  distance _c) < _distToChair && !sitting) then {
  12.                         if ((_c emptyPositions "cargo")> 0) then {
  13.                                 chairAction = player addaction ["Sit in chair", "sitInChair.sqf",_c];
  14.                                 waituntil {sleep 0.5; (player distance _c) > 4 || sitting;};
  15.                                 player removeAction chairAction;
  16.                         };
  17.                 };
  18.         sleep 0.2;
  19. };
  20.  
  21.  
  22. //sitInChair.sqf
  23.  
  24. sitting = true;
  25. _c = _this select 3;
  26.  
  27. if ((_c emptyPositions "cargo")> 0) then {
  28.         player moveInCargo _c;
  29.         waitUntil {sleep 0.2; ((vehicle player) == player)};
  30. };
  31. sitting = false;