Advertisement
Guest User

Untitled

a guest
Aug 26th, 2010
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 82.87 KB | None | 0 0
  1. //******************************************************************************************
  2. // #Version 1.3#
  3. //
  4. //      Includes: All command for the fire station.
  5. //
  6. //  - VcmdAlarm
  7. //  - VcmdRoof
  8. //  - VcmdGarageDoorsUp
  9. //  - VcmdGarageDoorsDown
  10. //  - VcmdCallEMT
  11. //  - VcmdCallEMTSCBA
  12. //  - VcmdCallEMTStretcher
  13. //  - VcmdCallPM
  14. //  - VcmdCallPMSCBA
  15. //  - VcmdCallPMStretcher
  16. //  - VcmdCallDiver
  17. //  - VcmdCallHazmat
  18. //  - VcmdCallUSARFF
  19. //  - VcmdEmptyFireStation
  20. //  - DummyDisableAlarm
  21. //  - DummyCallCrew
  22. //  - DummyGates
  23. //
  24. //      Script by Hoppah
  25. //     
  26. //      Usage of this script in other mods is NOT allowed without permission of Hoppah
  27. //
  28. //******************************************************************************************
  29.  
  30. const char NAME_FIRESTATION[]           = "fire_station";
  31. const char NAME_FIRESTATION_ROOF[]      = "fire_station_roof";
  32. const char NAME_FIRESTATION2[]          = "fire_station2";
  33. const char NAME_FIRESTATION2_ROOF[]     = "fire_station2_roof";
  34. const char NAME_FIRESTATION3[]          = "fire_station3";
  35. const char NAME_FIRESTATION3_ROOF[]     = "fire_station3_roof";
  36. const char NAME_CONTROLPANEL[]          = "fire_station_controlpanel";
  37. const char NAME_CONTROLPANEL2[]         = "fire_station_controlpanel2";
  38. const char NAME_CONTROLPANEL3[]         = "fire_station_controlpanel3";
  39.  
  40. const char OBJ_BATTALION[]          = "mod:Prototypes/Vehicles/02 LA Fire Department/battalion_chief_vehicle.e4p";
  41. const char OBJ_AMBULANCE01[]            = "mod:Prototypes/Vehicles/01 LA Ambulance/ambulance01.e4p";
  42. const char OBJ_AMBULANCE02[]            = "mod:Prototypes/Vehicles/01 LA Ambulance/ambulance02.e4p";
  43. const char OBJ_USAR[]               = "mod:Prototypes/Vehicles/02 LA Fire Department/heavy_rescue_crane.e4p";
  44. const char OBJ_LADDER[]             = "mod:Prototypes/Vehicles/02 LA Fire Department/aerial_ladder.e4p";
  45. const char OBJ_ENGINE01[]           = "mod:Prototypes/Vehicles/02 LA Fire Department/fire_engine1.e4p";
  46. const char OBJ_ENGINE02[]           = "mod:Prototypes/Vehicles/02 LA Fire Department/fire_engine2.e4p";
  47. const char OBJ_ENGINE06[]           = "mod:Prototypes/Vehicles/02 LA Fire Department/usar_squad.e4p";
  48. const char OBJ_HES[]                = "mod:Prototypes/Vehicles/02 LA Fire Department/heavy_equipment_squad.e4p";
  49. const char OBJ_LEV[]                = "mod:Prototypes/Vehicles/02 LA Fire Department/light_equipment_truck.e4p";
  50. const char OBJ_WATERTENDER[]            = "mod:Prototypes/Vehicles/02 LA Fire Department/water_tender.e4p";
  51.  
  52. const char OBJ_CHIEF[]              = "mod:Prototypes/Persons/02 LA Fire Department/battalion_chief.e4p";
  53. const char OBJ_EMT[]                = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt.e4p";
  54. const char OBJ_EMT_SCBA[]           = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_scba.e4p";
  55. const char OBJ_EMT_STRETCHER[]          = "mod:Prototypes/Persons/02 LA Fire Department/ff_emt_stretcher.e4p";
  56.  
  57. const char OBJ_PM[]             = "mod:Prototypes/Persons/01 LA Ambulance/ff_paramedic.e4p";
  58. const char OBJ_PM_SCBA[]            = "mod:Prototypes/Persons/01 LA Ambulance/ff_paramedic_scba.e4p";
  59. const char OBJ_PM_STRETCHER[]           = "mod:Prototypes/Persons/01 LA Ambulance/ff_paramedic_stretcher.e4p";
  60.  
  61. const char OBJ_HAZMAT[]             = "mod:Prototypes/Persons/02 LA Fire Department/ff_hazmat.e4p";
  62. const char OBJ_USARFF[]             = "mod:Prototypes/Persons/02 LA Fire Department/usar_ff.e4p";
  63. const char OBJ_DIVER[]              = "mod:Prototypes/Persons/02 LA Fire Department/ff_diver.e4p";
  64.  
  65. const char NAME_GATE01A[]           = "fs_gate01a";
  66. const char NAME_GATE02A[]           = "fs_gate02a";
  67. const char NAME_GATE03A[]           = "fs_gate03a";
  68. const char NAME_GATE04A[]           = "fs_gate04a";
  69. const char NAME_GATE05A[]           = "fs_gate05a";
  70. const char NAME_GATE06A[]           = "fs_gate06a";
  71. const char NAME_GATE07A[]           = "fs_gate07a";
  72. const char NAME_GATE08A[]           = "fs_gate08a";
  73. const char NAME_GATE09A[]           = "fs_gate09a";
  74. const char NAME_GATE10A[]           = "fs_gate10a";
  75. const char NAME_GATE11A[]           = "fs_gate11a";
  76. const char NAME_GATE01B[]           = "fs_gate01b";
  77. const char NAME_GATE02B[]           = "fs_gate02b";
  78. const char NAME_GATE03B[]           = "fs_gate03b";
  79. const char NAME_GATE04B[]           = "fs_gate04b";
  80. const char NAME_GATE05B[]           = "fs_gate05b";
  81. const char NAME_GATE06B[]           = "fs_gate06b";
  82. const char NAME_GATE07B[]           = "fs_gate07b";
  83. const char NAME_GATE08B[]           = "fs_gate08b";
  84. const char NAME_GATE09B[]           = "fs_gate09b";
  85. const char NAME_GATE10B[]           = "fs_gate10b";
  86. const char NAME_GATE11B[]           = "fs_gate11b";
  87. const char VO_GATE01A[]             = "fs_vogate01a";
  88. const char VO_GATE02A[]             = "fs_vogate02a";
  89. const char VO_GATE03A[]             = "fs_vogate03a";
  90. const char VO_GATE04A[]             = "fs_vogate04a";
  91. const char VO_GATE05A[]             = "fs_vogate05a";
  92. const char VO_GATE06A[]             = "fs_vogate06a";
  93. const char VO_GATE07A[]             = "fs_vogate07a";
  94. const char VO_GATE08A[]             = "fs_vogate08a";
  95. const char VO_GATE09A[]             = "fs_vogate09a";
  96. const char VO_GATE10A[]             = "fs_vogate10a";
  97. const char VO_GATE11A[]             = "fs_vogate11a";
  98. const char VO_GATE01B[]             = "fs_vogate01b";
  99. const char VO_GATE02B[]             = "fs_vogate02b";
  100. const char VO_GATE03B[]             = "fs_vogate03b";
  101. const char VO_GATE04B[]             = "fs_vogate04b";
  102. const char VO_GATE05B[]             = "fs_vogate05b";
  103. const char VO_GATE06B[]             = "fs_vogate06b";
  104. const char VO_GATE07B[]             = "fs_vogate07b";
  105. const char VO_GATE08B[]             = "fs_vogate08b";
  106. const char VO_GATE09B[]             = "fs_vogate09b";
  107. const char VO_GATE10B[]             = "fs_vogate10b";
  108. const char VO_GATE11B[]             = "fs_vogate11b";
  109.  
  110. const char DUMMY_GATES[]            = "DummyGates";
  111. const char DUMMY_ALARM[]            = "DummyDisableAlarm";
  112. const char DUMMY_CALLCREW[]         = "DummyCallCrew";
  113.  
  114. const char VO_BATTALION[]           = "fs_battalion";
  115. const char VO_AMBULANCE01[]         = "fs_ambulance01";
  116. const char VO_AMBULANCE02[]         = "fs_ambulance02";
  117. const char VO_AMBULANCE03[]         = "fs_ambulance03";
  118. const char VO_AMBULANCE04[]         = "fs_ambulance04";
  119. const char VO_USAR[]                = "fs_usar";
  120. const char VO_LADDER[]              = "fs_ladder";
  121. const char VO_ENGINE01[]            = "fs_engine01";
  122. const char VO_ENGINE02[]            = "fs_engine02";
  123. const char VO_ENGINE03[]            = "fs_engine03";
  124. const char VO_ENGINE04[]            = "fs_engine04";
  125. const char VO_ENGINE05[]            = "fs_engine05";
  126. const char VO_ENGINE06[]            = "fs_engine06";
  127. const char VO_HAZMAT[]              = "fs_hazmat";
  128. const char VO_LEV[]             = "fs_LEV";
  129. const char VO_WATERTENDER[]         = "fs_watertender";
  130.  
  131. const char VO_SPAWN01[]             = "fs_spawn01";
  132. const char VO_SPAWN02[]             = "fs_spawn02";
  133. const char VO_SPAWN03[]             = "fs_spawn03";
  134. const char VO_SPAWN04[]             = "fs_spawn04";
  135.  
  136. const char VO_MOVETO01[]            = "fs_moveto01";
  137. const char VO_MOVETO02[]            = "fs_moveto02";
  138. const char VO_MOVETO03[]            = "fs_moveto03";
  139.  
  140. const char VO_SQUAD01[]             = "fs_squad01";
  141. const char VO_SQUAD02[]             = "fs_squad02";
  142. const char VO_SQUAD03[]             = "fs_squad03";
  143.  
  144. const char SND_ALARM[]              = "mod:Audio/FX/Misc/fire_alarm.wav";
  145. const char SND_GATE[]               = "mod:Audio/FX/Misc/fire_gate.wav";
  146.  
  147. const char ANI_CLOSE[]              = "close";
  148. const char ANI_OPEN[]               = "open";
  149. const char VOSET_ROAD[]             = "Freely Accessible";
  150. const char VOSET_BARRICADE[]            = "Barricade";
  151.  
  152. const char UNNAMED[]                = "Unnamed";
  153.  
  154. int DummyGroup = 20;
  155.  
  156. object VcmdAlarm : CommandScript
  157. {
  158.     VcmdAlarm()
  159.     {
  160.         SetCursor("alarm");
  161.         SetIcon("alarm");
  162.         SetPriority(200);
  163.     }
  164.  
  165.     bool CheckPossible(GameObject *Caller)
  166.     {
  167.         if (!Caller->IsValid())
  168.             return false;
  169.  
  170.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  171.             return false;
  172.  
  173.         Vehicle v(Caller);
  174.         if (v.HasCommand(DUMMY_ALARM))
  175.             return false;
  176.  
  177.         return true;
  178.     }
  179.  
  180.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  181.     {
  182.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  183.             return false;
  184.  
  185.         return true;
  186.     }
  187.  
  188.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  189.     {
  190.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  191.         {
  192.             Caller->AssignCommand(DUMMY_ALARM);
  193.             Caller->PushActionWait(ACTION_NEWLIST, 1.5f);
  194.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 1, false);
  195.             Caller->PushActionWait(ACTION_APPEND, 13.0f);
  196.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_ALARM, Caller, 1, false);
  197.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION);
  198.             for(int i=0; i < l1.GetNumObjects(); i++)
  199.             {
  200.                 GameObject *obj = l1.GetObject(i);
  201.                 if (!obj->IsSpecialLightEnabled())
  202.                 {
  203.                     obj->EnableSpecialLights(true);
  204.                     Vector AlarmSnd = obj->GetPosition();
  205.                     int soundID = Audio::PlaySample3D(SND_ALARM, AlarmSnd, true);
  206.                     obj->SetUserData(soundID);
  207.                     obj->AttachSound(soundID);
  208.                 }
  209.             }
  210.             GameObjectList l2;
  211.             Game::CollectObstaclesOnVirtualObject(VO_BATTALION, l2, ACTOR_VEHICLE);
  212.             if(l2.GetNumObjects() > 0)
  213.             {
  214.                 Vehicle m = l2.GetObject(0);
  215.                 PersonList passengers = m.GetPassengers();
  216.                 if (passengers.GetNumPersons() == 0)
  217.                 {
  218.                     m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 4, false);
  219.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  220.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  221.                 }
  222.             }
  223.             GameObjectList l3;
  224.             Game::CollectObstaclesOnVirtualObject(VO_AMBULANCE01, l3, ACTOR_VEHICLE);
  225.             if(l3.GetNumObjects() > 0)
  226.             {
  227.                 Vehicle m = l3.GetObject(0);
  228.                 PersonList passengers = m.GetPassengers();
  229.                 if (passengers.GetNumPersons() == 0)
  230.                 {
  231.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_AMBULANCE01) == 0)
  232.                     {
  233.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 7, false);
  234.                         //m.PushActionWait(ACTION_APPEND, 0.5f);
  235.                         //m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  236.  
  237.                     } else
  238.                     {
  239.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);
  240.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  241.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);
  242.                     }
  243.                 }
  244.             }
  245.             GameObjectList l4;
  246.             Game::CollectObstaclesOnVirtualObject(VO_AMBULANCE02, l4, ACTOR_VEHICLE);
  247.             if(l4.GetNumObjects() > 0)
  248.             {
  249.                 Vehicle m = l4.GetObject(0);
  250.                 PersonList passengers = m.GetPassengers();
  251.                 if (passengers.GetNumPersons() == 0)
  252.                 {
  253.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_AMBULANCE01) == 0)
  254.                     {
  255.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 7, false);
  256.                         //m.PushActionWait(ACTION_APPEND, 0.5f);
  257.                         //m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  258.                     } else
  259.                     {
  260.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);
  261.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  262.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);
  263.                     }
  264.                 }
  265.             }
  266.             GameObjectList l5;
  267.             Game::CollectObstaclesOnVirtualObject(VO_AMBULANCE03, l5, ACTOR_VEHICLE);
  268.             if(l5.GetNumObjects() > 0)
  269.             {
  270.                 Vehicle m = l5.GetObject(0);
  271.                 PersonList passengers = m.GetPassengers();
  272.                 if (passengers.GetNumPersons() == 0)
  273.                 {
  274.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_AMBULANCE01) == 0)
  275.                     {
  276.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 7, false);
  277.                         //m.PushActionWait(ACTION_APPEND, 0.5f);
  278.                         //m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  279.                     } else
  280.                     {
  281.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);
  282.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  283.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);
  284.                     }
  285.                 }
  286.             }
  287.             GameObjectList l6;
  288.             Game::CollectObstaclesOnVirtualObject(VO_LADDER, l6, ACTOR_VEHICLE);
  289.             if(l6.GetNumObjects() > 0)
  290.             {
  291.                 Vehicle m = l6.GetObject(0);
  292.                 PersonList passengers = m.GetPassengers();
  293.                 if (passengers.GetNumPersons() == 0)
  294.                 {
  295.                     m.PushActionWait(ACTION_NEWLIST, 1.4f);
  296.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  297.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  298.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  299.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  300.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  301.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  302.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  303.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  304.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  305.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  306.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  307.                 }
  308.             }
  309.             GameObjectList l7;
  310.             Game::CollectObstaclesOnVirtualObject(VO_USAR, l7, ACTOR_VEHICLE);
  311.             if(l7.GetNumObjects() > 0)
  312.             {
  313.                 Vehicle m = l7.GetObject(0);
  314.                 PersonList passengers = m.GetPassengers();
  315.                 if (passengers.GetNumPersons() == 0)
  316.                 {
  317.                     m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 3, false);
  318.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  319.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  320.                 }
  321.             }
  322.             GameObjectList l8;
  323.             Game::CollectObstaclesOnVirtualObject(VO_ENGINE01, l8, ACTOR_VEHICLE);
  324.             if(l8.GetNumObjects() > 0)
  325.             {
  326.                 Vehicle m = l8.GetObject(0);
  327.                 PersonList passengers = m.GetPassengers();
  328.                 if (passengers.GetNumPersons() == 0)
  329.                 {
  330.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  331.                     {
  332.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  333.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  334.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  335.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  336.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  337.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  338.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  339.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  340.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  341.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  342.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  343.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  344.                     } else
  345.                     {
  346.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  347.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  348.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  349.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  350.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  351.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  352.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  353.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  354.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  355.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  356.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  357.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  358.                     }
  359.                 }
  360.             }
  361.             GameObjectList l9;
  362.             Game::CollectObstaclesOnVirtualObject(VO_ENGINE02, l9, ACTOR_VEHICLE);
  363.             if(l9.GetNumObjects() > 0)
  364.             {
  365.                 Vehicle m = l9.GetObject(0);
  366.                 PersonList passengers = m.GetPassengers();
  367.                 if (passengers.GetNumPersons() == 0)
  368.                 {
  369.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  370.                     {
  371.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  372.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  373.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  374.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  375.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  376.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  377.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  378.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  379.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  380.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  381.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  382.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  383.                     } else
  384.                     {
  385.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  386.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  387.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  388.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  389.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  390.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  391.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  392.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  393.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  394.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  395.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  396.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  397.                     }
  398.                 }
  399.             }
  400.             GameObjectList l10;
  401.             Game::CollectObstaclesOnVirtualObject(VO_ENGINE03, l10, ACTOR_VEHICLE);
  402.             if(l10.GetNumObjects() > 0)
  403.             {
  404.                 Vehicle m = l10.GetObject(0);
  405.                 PersonList passengers = m.GetPassengers();
  406.                 if (passengers.GetNumPersons() == 0)
  407.                 {
  408.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  409.                     {
  410.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  411.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  412.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  413.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  414.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  415.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  416.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  417.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  418.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  419.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  420.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  421.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  422.                     } else
  423.                     {
  424.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  425.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  426.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  427.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  428.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  429.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  430.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  431.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  432.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  433.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  434.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  435.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  436.                     }
  437.                 }
  438.             }
  439.             GameObjectList l11;
  440.             Game::CollectObstaclesOnVirtualObject(VO_ENGINE04, l11, ACTOR_VEHICLE);
  441.             if(l11.GetNumObjects() > 0)
  442.             {
  443.                 Vehicle m = l11.GetObject(0);
  444.                 PersonList passengers = m.GetPassengers();
  445.                 if (passengers.GetNumPersons() == 0)
  446.                 {
  447.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  448.                     {
  449.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  450.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  451.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  452.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  453.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  454.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  455.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  456.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  457.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  458.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  459.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  460.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  461.                     } else
  462.                     {
  463.                         m.PushActionWait(ACTION_NEWLIST, 2.0f);
  464.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  465.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  466.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  467.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  468.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  469.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  470.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  471.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  472.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  473.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  474.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  475.                     }
  476.                 }
  477.             }
  478.         }
  479.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  480.         {
  481.             Caller->AssignCommand(DUMMY_ALARM);
  482.             Caller->PushActionWait(ACTION_NEWLIST, 1.5f);
  483.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 3, false);
  484.             Caller->PushActionWait(ACTION_APPEND, 14.0f);
  485.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_ALARM, Caller, 1, false);
  486.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION2);
  487.             for(int i=0; i < l1.GetNumObjects(); i++)
  488.             {
  489.                 GameObject *obj = l1.GetObject(i);
  490.                 if (!obj->IsSpecialLightEnabled())
  491.                 {
  492.                     obj->EnableSpecialLights(true);
  493.                     Vector AlarmSnd = obj->GetPosition();
  494.                     int soundID = Audio::PlaySample3D(SND_ALARM, AlarmSnd, true);
  495.                     obj->SetUserData(soundID);
  496.                     obj->AttachSound(soundID);
  497.                 }
  498.             }
  499.             GameObjectList l2;
  500.             Game::CollectObstaclesOnVirtualObject(VO_AMBULANCE04, l2, ACTOR_VEHICLE);
  501.             if(l2.GetNumObjects() > 0)
  502.             {
  503.                 Vehicle m = l2.GetObject(0);
  504.                 PersonList passengers = m.GetPassengers();
  505.                 if (passengers.GetNumPersons() == 0)
  506.                 {
  507.                     if(StrCompare(m.GetPrototypeFileName(), OBJ_AMBULANCE01) == 0)
  508.                     {
  509.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  510.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  511.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);
  512.                     } else
  513.                     {
  514.                         m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);
  515.                         m.PushActionWait(ACTION_APPEND, 0.5f);
  516.                         m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);
  517.                     }
  518.                 }
  519.             }
  520.             GameObjectList l3;
  521.             Game::CollectObstaclesOnVirtualObject(VO_ENGINE05, l3, ACTOR_VEHICLE);
  522.             if(l3.GetNumObjects() > 0)
  523.             {
  524.                 Vehicle m = l3.GetObject(0);
  525.                 PersonList passengers = m.GetPassengers();
  526.                 if (passengers.GetNumPersons() == 0)
  527.                 {
  528.                     m.PushActionWait(ACTION_NEWLIST, 2.0f);
  529.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  530.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  531.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  532.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  533.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  534.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  535.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  536.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  537.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  538.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  539.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  540.                 }
  541.             }
  542.             GameObjectList l4;
  543.             Game::CollectObstaclesOnVirtualObject(VO_HAZMAT, l4, ACTOR_VEHICLE);
  544.             if(l4.GetNumObjects() > 0)
  545.             {
  546.                 Vehicle m = l4.GetObject(0);
  547.                 PersonList passengers = m.GetPassengers();
  548.                 if (passengers.GetNumPersons() == 0)
  549.                 {
  550.                     m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);
  551.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  552.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  553.                     m.PushActionWait(ACTION_APPEND, 1.0f);
  554.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  555.                     m.PushActionWait(ACTION_APPEND, 1.0f);
  556.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  557.                 }
  558.             }
  559.         }
  560.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  561.         {
  562.             Caller->AssignCommand(DUMMY_ALARM);
  563.             Caller->PushActionWait(ACTION_NEWLIST, 1.5f);
  564.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 5, false);
  565.             Caller->PushActionWait(ACTION_APPEND, 15.0f);
  566.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_ALARM, Caller, 1, false);
  567.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION3);
  568.             for(int i=0; i < l1.GetNumObjects(); i++)
  569.             {
  570.                 GameObject *obj = l1.GetObject(i);
  571.                 if (!obj->IsSpecialLightEnabled())
  572.                 {
  573.                     obj->EnableSpecialLights(true);
  574.                     Vector AlarmSnd = obj->GetPosition();
  575.                     int soundID = Audio::PlaySample3D(SND_ALARM, AlarmSnd, true);
  576.                     obj->SetUserData(soundID);
  577.                     obj->AttachSound(soundID);
  578.                 }
  579.             }
  580.             GameObjectList l2;
  581.             Game::CollectObstaclesOnVirtualObject(VO_LEV, l2, ACTOR_VEHICLE);
  582.             if(l2.GetNumObjects() > 0)
  583.             {
  584.                 Vehicle m = l2.GetObject(0);
  585.                 PersonList passengers = m.GetPassengers();
  586.                 if (passengers.GetNumPersons() == 0)
  587.                 {
  588.                     m.PushActionWait(ACTION_NEWLIST, 2.0f);
  589.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  590.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  591.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  592.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  593.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
  594.                    
  595.                 }
  596.             }
  597.             GameObjectList l3;
  598.             Game::CollectObstaclesOnVirtualObject(VO_WATERTENDER, l3, ACTOR_VEHICLE);
  599.             if(l3.GetNumObjects() > 0)
  600.             {
  601.                 Vehicle m = l3.GetObject(0);
  602.                 PersonList passengers = m.GetPassengers();
  603.                 if (passengers.GetNumPersons() == 0)
  604.                 {
  605.                     m.PushActionWait(ACTION_NEWLIST, 2.0f);
  606.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  607.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  608.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
  609.                 }
  610.             }
  611.             GameObjectList l4;
  612.             Game::CollectObstaclesOnVirtualObject(VO_ENGINE06, l4, ACTOR_VEHICLE);
  613.             if(l4.GetNumObjects() > 0)
  614.             {
  615.                 Vehicle m = l4.GetObject(0);
  616.                 PersonList passengers = m.GetPassengers();
  617.                 if (passengers.GetNumPersons() == 0)
  618.                 {
  619.                     m.PushActionWait(ACTION_NEWLIST, 2.0f);
  620.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
  621.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  622.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
  623.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  624.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
  625.                     m.PushActionWait(ACTION_APPEND, 0.5f);
  626.                     m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
  627.                 }
  628.             }
  629.         }
  630.     }
  631. };
  632.  
  633. object VcmdRoof : CommandScript
  634. {
  635.     VcmdRoof()
  636.     {
  637.         SetCursor("roof");
  638.         SetIcon("roof");
  639.     }
  640.  
  641.     bool CheckPossible(GameObject *Caller)
  642.     {
  643.         if (!Caller->IsValid())
  644.             return false;
  645.  
  646.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  647.             return false;
  648.  
  649.         return true;
  650.     }
  651.  
  652.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  653.     {
  654.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  655.             return false;
  656.  
  657.         return true;
  658.     }
  659.  
  660.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  661.     {
  662.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  663.         {
  664.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION_ROOF);
  665.             for(int i=0; i < l1.GetNumObjects(); i++)
  666.             {
  667.                 GameObject *obj = l1.GetObject(i);
  668.                 if(obj->GetUserData() == 0)
  669.                 {
  670.                     obj->Hide();
  671.                     obj->SetUserData(1);
  672.                 } else
  673.                 {
  674.                     obj->Show();
  675.                     obj->SetUserData(0);
  676.                 }
  677.             }
  678.         }
  679.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  680.         {
  681.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION2_ROOF);
  682.             for(int i=0; i < l1.GetNumObjects(); i++)
  683.             {
  684.                 GameObject *obj = l1.GetObject(i);
  685.                 if(obj->GetUserData() == 0)
  686.                 {
  687.                     obj->Hide();
  688.                     obj->SetUserData(1);
  689.                 } else
  690.                 {
  691.                     obj->Show();
  692.                     obj->SetUserData(0);
  693.                 }
  694.             }
  695.         }
  696.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  697.         {
  698.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION3_ROOF);
  699.             for(int i=0; i < l1.GetNumObjects(); i++)
  700.             {
  701.                 GameObject *obj = l1.GetObject(i);
  702.                 if(obj->GetUserData() == 0)
  703.                 {
  704.                     obj->Hide();
  705.                     obj->SetUserData(1);
  706.                 } else
  707.                 {
  708.                     obj->Show();
  709.                     obj->SetUserData(0);
  710.                 }
  711.             }
  712.         }
  713.     }
  714. };
  715.  
  716. object VcmdGarageDoorsUp : CommandScript
  717. {
  718.     VcmdGarageDoorsUp()
  719.     {
  720.         SetCursor("garagedoorup");
  721.         SetIcon("garagedoorup");
  722.     }
  723.  
  724.     bool CheckPossible(GameObject *Caller)
  725.     {
  726.         if (!Caller->IsValid())
  727.             return false;
  728.  
  729.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  730.             return false;
  731.  
  732.         Vehicle v(Caller);
  733.         if (v.HasCommand(DUMMY_ALARM))
  734.             return false;
  735.  
  736.         return true;
  737.     }
  738.  
  739.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  740.     {
  741.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  742.             return false;
  743.  
  744.         return true;
  745.     }
  746.  
  747.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  748.     {
  749.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  750.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 1, false);
  751.         else if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  752.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 3, false);
  753.         else if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  754.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 5, false);
  755.     }
  756. };
  757.  
  758. object VcmdGarageDoorsDown : CommandScript
  759. {
  760.     VcmdGarageDoorsDown()
  761.     {
  762.         SetCursor("garagedoordown");
  763.         SetIcon("garagedoordown");
  764.     }
  765.  
  766.     bool CheckPossible(GameObject *Caller)
  767.     {
  768.         if (!Caller->IsValid())
  769.             return false;
  770.  
  771.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  772.             return false;
  773.  
  774.         Vehicle v(Caller);
  775.         if (v.HasCommand(DUMMY_ALARM))
  776.             return false;
  777.  
  778.         return true;
  779.     }
  780.  
  781.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  782.     {
  783.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  784.             return false;
  785.  
  786.         return true;
  787.     }
  788.  
  789.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  790.     {
  791.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  792.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 2, false);
  793.         else if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  794.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 4, false);
  795.         else if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  796.             Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 6, false);
  797.     }
  798. };
  799.  
  800. object VcmdCallEMT : CommandScript
  801. {
  802.     VcmdCallEMT()
  803.     {
  804.         SetCursor("alarm");
  805.         SetIcon("callemt");
  806.     }
  807.  
  808.     bool CheckPossible(GameObject *Caller)
  809.     {
  810.         if (!Caller->IsValid())
  811.             return false;
  812.  
  813.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  814.             return false;
  815.  
  816.         Vehicle v(Caller);
  817.         if (v.HasCommand(DUMMY_ALARM))
  818.             return false;
  819.  
  820.         return true;
  821.     }
  822.  
  823.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  824.     {
  825.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  826.             return false;
  827.  
  828.         return true;
  829.     }
  830.  
  831.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  832.     {
  833.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  834.         {
  835.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  836.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  837.         }
  838.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  839.         {
  840.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  841.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  842.         }
  843.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  844.         {
  845.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  846.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  847.         }
  848.         if(l1.GetNumActors() > 0)
  849.             Vector Spawn = l1.GetActor(0)->GetPosition();
  850.  
  851.         if(l2.GetNumActors() > 0)
  852.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  853.        
  854.         Person p = Game::CreatePerson(OBJ_EMT, UNNAMED);
  855.         if (Game::FindFreePosition(&p, Spawn))
  856.         {
  857.             p.SetUpgradeLevel(3);
  858.             Game::FindFreePosition(&p, Spawn);
  859.             p.SetPosition(Spawn);
  860.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  861.         }
  862.     }
  863. };
  864.  
  865. object VcmdCallEMTSCBA : CommandScript
  866. {
  867.     VcmdCallEMTSCBA()
  868.     {
  869.         SetCursor("alarm");
  870.         SetIcon("callemtscba");
  871.     }
  872.  
  873.     bool CheckPossible(GameObject *Caller)
  874.     {
  875.         if (!Caller->IsValid())
  876.             return false;
  877.  
  878.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  879.             return false;
  880.  
  881.         Vehicle v(Caller);
  882.         if (v.HasCommand(DUMMY_ALARM))
  883.             return false;
  884.  
  885.         return true;
  886.     }
  887.  
  888.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  889.     {
  890.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  891.             return false;
  892.  
  893.         return true;
  894.     }
  895.  
  896.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  897.     {
  898.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  899.         {
  900.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  901.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  902.         }
  903.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  904.         {
  905.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  906.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  907.         }
  908.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  909.         {
  910.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  911.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  912.         }
  913.         if(l1.GetNumActors() > 0)
  914.             Vector Spawn = l1.GetActor(0)->GetPosition();
  915.  
  916.         if(l2.GetNumActors() > 0)
  917.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  918.        
  919.         Person p = Game::CreatePerson(OBJ_EMT_SCBA, UNNAMED);
  920.         if (Game::FindFreePosition(&p, Spawn))
  921.         {
  922.             p.SetUpgradeLevel(3);
  923.             Game::FindFreePosition(&p, Spawn);
  924.             p.SetPosition(Spawn);
  925.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  926.         }
  927.     }
  928. };
  929.  
  930. object VcmdCallEMTStretcher : CommandScript
  931. {
  932.     VcmdCallEMTStretcher()
  933.     {
  934.         SetCursor("alarm");
  935.         SetIcon("callemtstretcher");
  936.     }
  937.  
  938.     bool CheckPossible(GameObject *Caller)
  939.     {
  940.         if (!Caller->IsValid())
  941.             return false;
  942.  
  943.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  944.             return false;
  945.  
  946.         Vehicle v(Caller);
  947.         if (v.HasCommand(DUMMY_ALARM))
  948.             return false;
  949.  
  950.         return true;
  951.     }
  952.  
  953.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  954.     {
  955.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  956.             return false;
  957.  
  958.         return true;
  959.     }
  960.  
  961.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  962.     {
  963.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  964.         {
  965.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  966.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  967.         }
  968.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  969.         {
  970.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  971.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  972.         }
  973.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  974.         {
  975.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  976.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  977.         }
  978.         if(l1.GetNumActors() > 0)
  979.             Vector Spawn = l1.GetActor(0)->GetPosition();
  980.  
  981.         if(l2.GetNumActors() > 0)
  982.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  983.        
  984.         Person p = Game::CreatePerson(OBJ_EMT_STRETCHER, UNNAMED);
  985.         if (Game::FindFreePosition(&p, Spawn))
  986.         {
  987.             p.SetUpgradeLevel(3);
  988.             Game::FindFreePosition(&p, Spawn);
  989.             p.SetPosition(Spawn);
  990.             //p.SetAutoHealDistance(0.1f);
  991.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  992.         }
  993.     }
  994. };
  995.  
  996. object VcmdCallPM : CommandScript
  997. {
  998.     VcmdCallPM()
  999.     {
  1000.         SetCursor("alarm");
  1001.         SetIcon("callpm");
  1002.     }
  1003.  
  1004.     bool CheckPossible(GameObject *Caller)
  1005.     {
  1006.         if (!Caller->IsValid())
  1007.             return false;
  1008.  
  1009.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  1010.             return false;
  1011.  
  1012.         Vehicle v(Caller);
  1013.         if (v.HasCommand(DUMMY_ALARM))
  1014.             return false;
  1015.  
  1016.         return true;
  1017.     }
  1018.  
  1019.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1020.     {
  1021.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1022.             return false;
  1023.  
  1024.         return true;
  1025.     }
  1026.  
  1027.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1028.     {
  1029.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1030.         {
  1031.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1032.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  1033.         }
  1034.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1035.         {
  1036.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1037.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  1038.         }
  1039.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1040.         {
  1041.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1042.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  1043.         }
  1044.         if(l1.GetNumActors() > 0)
  1045.             Vector Spawn = l1.GetActor(0)->GetPosition();
  1046.  
  1047.         if(l2.GetNumActors() > 0)
  1048.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  1049.        
  1050.         Person p = Game::CreatePerson(OBJ_PM, UNNAMED);
  1051.         if (Game::FindFreePosition(&p, Spawn))
  1052.         {
  1053.             p.SetUpgradeLevel(3);
  1054.             Game::FindFreePosition(&p, Spawn);
  1055.             p.SetPosition(Spawn);
  1056.             p.SetEquipment(EQUIP_EMERGENCY_CASE);
  1057.             //p.SetAutoHealDistance(1000.f);
  1058.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  1059.         }
  1060.     }
  1061. };
  1062.  
  1063. object VcmdCallPMSCBA : CommandScript
  1064. {
  1065.     VcmdCallPMSCBA()
  1066.     {
  1067.         SetCursor("alarm");
  1068.         SetIcon("callpmscba");
  1069.     }
  1070.  
  1071.     bool CheckPossible(GameObject *Caller)
  1072.     {
  1073.         if (!Caller->IsValid())
  1074.             return false;
  1075.  
  1076.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  1077.             return false;
  1078.  
  1079.         Vehicle v(Caller);
  1080.         if (v.HasCommand(DUMMY_ALARM))
  1081.             return false;
  1082.  
  1083.         return true;
  1084.     }
  1085.  
  1086.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1087.     {
  1088.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1089.             return false;
  1090.  
  1091.         return true;
  1092.     }
  1093.  
  1094.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1095.     {
  1096.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1097.         {
  1098.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1099.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  1100.         }
  1101.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1102.         {
  1103.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1104.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  1105.         }
  1106.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1107.         {
  1108.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1109.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  1110.         }
  1111.         if(l1.GetNumActors() > 0)
  1112.             Vector Spawn = l1.GetActor(0)->GetPosition();
  1113.  
  1114.         if(l2.GetNumActors() > 0)
  1115.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  1116.        
  1117.         Person p = Game::CreatePerson(OBJ_PM_SCBA, UNNAMED);
  1118.         if (Game::FindFreePosition(&p, Spawn))
  1119.         {
  1120.             p.SetUpgradeLevel(3);
  1121.             Game::FindFreePosition(&p, Spawn);
  1122.             p.SetPosition(Spawn);
  1123.             //p.SetEquipment(EQUIP_EMERGENCY_CASE);
  1124.             //p.SetAutoHealDistance(0.1f);
  1125.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  1126.         }
  1127.     }
  1128. };
  1129.  
  1130. object VcmdCallPMStretcher : CommandScript
  1131. {
  1132.     VcmdCallPMStretcher()
  1133.     {
  1134.         SetCursor("alarm");
  1135.         SetIcon("callpmstretcher");
  1136.     }
  1137.  
  1138.     bool CheckPossible(GameObject *Caller)
  1139.     {
  1140.         if (!Caller->IsValid())
  1141.             return false;
  1142.  
  1143.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  1144.             return false;
  1145.  
  1146.         Vehicle v(Caller);
  1147.         if (v.HasCommand(DUMMY_ALARM))
  1148.             return false;
  1149.  
  1150.         return true;
  1151.     }
  1152.  
  1153.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1154.     {
  1155.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1156.             return false;
  1157.  
  1158.         return true;
  1159.     }
  1160.  
  1161.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1162.     {
  1163.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1164.         {
  1165.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1166.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  1167.         }
  1168.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1169.         {
  1170.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1171.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  1172.         }
  1173.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1174.         {
  1175.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1176.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  1177.         }
  1178.         if(l1.GetNumActors() > 0)
  1179.             Vector Spawn = l1.GetActor(0)->GetPosition();
  1180.  
  1181.         if(l2.GetNumActors() > 0)
  1182.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  1183.                
  1184.         Person p = Game::CreatePerson(OBJ_PM_STRETCHER, UNNAMED);
  1185.         if (Game::FindFreePosition(&p, Spawn))
  1186.         {
  1187.             p.SetUpgradeLevel(3);
  1188.             Game::FindFreePosition(&p, Spawn);
  1189.             p.SetPosition(Spawn);
  1190.             //p.SetAutoHealDistance(0.1f);
  1191.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  1192.         }
  1193.     }
  1194. };
  1195.  
  1196. object VcmdCallDiver : CommandScript
  1197. {
  1198.     VcmdCallDiver()
  1199.     {
  1200.         SetCursor("alarm");
  1201.         SetIcon("calldiver");
  1202.     }
  1203.  
  1204.     bool CheckPossible(GameObject *Caller)
  1205.     {
  1206.         if (!Caller->IsValid())
  1207.             return false;
  1208.  
  1209.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  1210.             return false;
  1211.  
  1212.         Vehicle v(Caller);
  1213.         if (v.HasCommand(DUMMY_ALARM))
  1214.             return false;
  1215.  
  1216.         return true;
  1217.     }
  1218.  
  1219.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1220.     {
  1221.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1222.             return false;
  1223.  
  1224.         return true;
  1225.     }
  1226.  
  1227.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1228.     {
  1229.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1230.         {
  1231.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1232.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  1233.         }
  1234.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1235.         {
  1236.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1237.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  1238.         }
  1239.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1240.         {
  1241.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1242.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  1243.         }
  1244.         if(l1.GetNumActors() > 0)
  1245.             Vector Spawn = l1.GetActor(0)->GetPosition();
  1246.  
  1247.         if(l2.GetNumActors() > 0)
  1248.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  1249.                
  1250.         Person p = Game::CreatePerson(OBJ_DIVER, UNNAMED);
  1251.         if (Game::FindFreePosition(&p, Spawn))
  1252.         {
  1253.             p.SetUpgradeLevel(3);
  1254.             Game::FindFreePosition(&p, Spawn);
  1255.             p.SetPosition(Spawn);
  1256.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  1257.         }
  1258.     }
  1259. };
  1260.  
  1261. object VcmdCallHazmat : CommandScript
  1262. {
  1263.     VcmdCallHazmat()
  1264.     {
  1265.         SetCursor("alarm");
  1266.         SetIcon("callhazmat");
  1267.     }
  1268.  
  1269.     bool CheckPossible(GameObject *Caller)
  1270.     {
  1271.         if (!Caller->IsValid())
  1272.             return false;
  1273.  
  1274.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  1275.             return false;
  1276.  
  1277.         Vehicle v(Caller);
  1278.         if (v.HasCommand(DUMMY_ALARM))
  1279.             return false;
  1280.  
  1281.         return true;
  1282.     }
  1283.  
  1284.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1285.     {
  1286.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1287.             return false;
  1288.  
  1289.         return true;
  1290.     }
  1291.  
  1292.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1293.     {
  1294.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1295.         {
  1296.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1297.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  1298.         }
  1299.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1300.         {
  1301.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1302.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  1303.         }
  1304.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1305.         {
  1306.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1307.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  1308.         }
  1309.         if(l1.GetNumActors() > 0)
  1310.             Vector Spawn = l1.GetActor(0)->GetPosition();
  1311.  
  1312.         if(l2.GetNumActors() > 0)
  1313.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  1314.                
  1315.         Person p = Game::CreatePerson(OBJ_HAZMAT, UNNAMED);
  1316.         if (Game::FindFreePosition(&p, Spawn))
  1317.         {
  1318.             p.SetUpgradeLevel(3);
  1319.             p.SetPosition(Spawn);
  1320.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  1321.         }
  1322.     }
  1323. };
  1324.  
  1325. object VcmdCallUSARFF : CommandScript
  1326. {
  1327.     VcmdCallUSARFF()
  1328.     {
  1329.         SetCursor("alarm");
  1330.         SetIcon("callusar");
  1331.     }
  1332.  
  1333.     bool CheckPossible(GameObject *Caller)
  1334.     {
  1335.         if (!Caller->IsValid())
  1336.             return false;
  1337.  
  1338.         if (!Game::IsFreeplay() && !Game::IsMultiplayer())
  1339.             return false;
  1340.  
  1341.         Vehicle v(Caller);
  1342.         if (v.HasCommand(DUMMY_ALARM))
  1343.             return false;
  1344.  
  1345.         return true;
  1346.     }
  1347.  
  1348.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1349.     {
  1350.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1351.             return false;
  1352.  
  1353.         return true;
  1354.     }
  1355.  
  1356.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1357.     {
  1358.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1359.         {
  1360.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1361.             ActorList l2 = Game::GetActors(VO_MOVETO01);
  1362.         }
  1363.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1364.         {
  1365.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1366.             ActorList l2 = Game::GetActors(VO_MOVETO02);
  1367.         }
  1368.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1369.         {
  1370.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1371.             ActorList l2 = Game::GetActors(VO_MOVETO03);
  1372.         }
  1373.         if(l1.GetNumActors() > 0)
  1374.             Vector Spawn = l1.GetActor(0)->GetPosition();
  1375.  
  1376.         if(l2.GetNumActors() > 0)
  1377.             Vector MoveTo = l2.GetActor(0)->GetPosition();
  1378.                
  1379.         Person p = Game::CreatePerson(OBJ_USARFF, UNNAMED);
  1380.         if (Game::FindFreePosition(&p, Spawn))
  1381.         {
  1382.             p.SetUpgradeLevel(3);
  1383.             p.SetPosition(Spawn);
  1384.             p.PushActionMove(ACTION_NEWLIST, MoveTo);
  1385.         }
  1386.     }
  1387. };
  1388.  
  1389. object VcmdEmptyFireStation : CommandScript
  1390. {
  1391.     VcmdEmptyFireStation()
  1392.     {
  1393.         SetIcon("enterhouse");
  1394.         SetCursor("enterhouse");
  1395.     }
  1396.  
  1397.     bool CheckPossible(GameObject *Caller)
  1398.     {
  1399.         if (!Caller->IsValid())
  1400.             return false;
  1401.  
  1402.         if (!Game::IsFreeplay())
  1403.             return false;
  1404.  
  1405.         return true;
  1406.     }
  1407.  
  1408.     bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
  1409.     {
  1410.         if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))
  1411.             return false;
  1412.  
  1413.         return true;
  1414.     }
  1415.  
  1416.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1417.     {
  1418.         if(Caller->HasName(NAME_CONTROLPANEL)) //= fire station 1
  1419.         {
  1420.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1421.             if(l1.GetNumActors() > 0)
  1422.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1423.  
  1424.             GameObjectList l2;
  1425.             Game::CollectObstaclesOnVirtualObject(VO_SQUAD01, l2, ACTOR_PERSON);
  1426.             for(int i = 0; i < l2.GetNumObjects(); i++)
  1427.             {
  1428.                 GameObject *obj = l2.GetObject(i);
  1429.                 if (obj->GetType() == ACTOR_PERSON)
  1430.                 {
  1431.                     Person p(obj);
  1432.                     p.PushActionMove(ACTION_NEWLIST, Spawn);
  1433.                     p.PushActionDeleteOwner(ACTION_APPEND);
  1434.                 }
  1435.             }
  1436.         }
  1437.         if(Caller->HasName(NAME_CONTROLPANEL2)) //= fire station 2
  1438.         {
  1439.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1440.             if(l1.GetNumActors() > 0)
  1441.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1442.  
  1443.             GameObjectList l2;
  1444.             Game::CollectObstaclesOnVirtualObject(VO_SQUAD02, l2, ACTOR_PERSON);
  1445.             for(int i = 0; i < l2.GetNumObjects(); i++)
  1446.             {
  1447.                 GameObject *obj = l2.GetObject(i);
  1448.                 if (obj->GetType() == ACTOR_PERSON)
  1449.                 {
  1450.                     Person p(obj);
  1451.                     p.PushActionMove(ACTION_NEWLIST, Spawn);
  1452.                     p.PushActionDeleteOwner(ACTION_APPEND);
  1453.                 }
  1454.             }
  1455.         }
  1456.         if(Caller->HasName(NAME_CONTROLPANEL3)) //= fire station 3
  1457.         {
  1458.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1459.             if(l1.GetNumActors() > 0)
  1460.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1461.  
  1462.             GameObjectList l2;
  1463.             Game::CollectObstaclesOnVirtualObject(VO_SQUAD03, l2, ACTOR_PERSON);
  1464.             for(int i = 0; i < l2.GetNumObjects(); i++)
  1465.             {
  1466.                 GameObject *obj = l2.GetObject(i);
  1467.                 if (obj->GetType() == ACTOR_PERSON)
  1468.                 {
  1469.                     Person p(obj);
  1470.                     p.PushActionMove(ACTION_NEWLIST, Spawn);
  1471.                     p.PushActionDeleteOwner(ACTION_APPEND);
  1472.                 }
  1473.             }
  1474.         }
  1475.     }
  1476. };
  1477.  
  1478. object DummyDisableAlarm : CommandScript
  1479. {
  1480.     DummyDisableAlarm()
  1481.     {
  1482.         SetGroupID(DummyGroup);
  1483.     }
  1484.  
  1485.     bool CheckGroupVisibility(GameObject *Caller)
  1486.     {
  1487.         return false;
  1488.     }
  1489.  
  1490.     bool CheckPossible(GameObject *Caller)
  1491.     {
  1492.         return false;
  1493.     }
  1494.  
  1495.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1496.     {
  1497.         Vehicle v(Caller);
  1498.         if (v.HasCommand(DUMMY_ALARM))
  1499.             v.RemoveCommand(DUMMY_ALARM);
  1500.  
  1501.         if(Caller->HasName(NAME_CONTROLPANEL) || Caller->HasName(NAME_FIRESTATION)) //= fire station 1
  1502.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION);
  1503.         else if(Caller->HasName(NAME_CONTROLPANEL2) || Caller->HasName(NAME_FIRESTATION2)) //= fire station 2
  1504.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION2);
  1505.         else if(Caller->HasName(NAME_CONTROLPANEL3) || Caller->HasName(NAME_FIRESTATION3)) //= fire station 3
  1506.             GameObjectList l1 = Game::GetGameObjects(NAME_FIRESTATION3);
  1507.  
  1508.         for(int i=0; i < l1.GetNumObjects(); i++)
  1509.         {
  1510.             GameObject *obj = l1.GetObject(i);
  1511.             obj->EnableSpecialLights(false);
  1512.             int ref = obj->GetUserData();
  1513.             obj->UnattachSound(ref);
  1514.             Audio::StopSample(ref);
  1515.         }
  1516.     }
  1517. };
  1518.  
  1519. object DummyCallCrew : CommandScript
  1520. {
  1521.     DummyCallCrew()
  1522.     {
  1523.         SetGroupID(DummyGroup);
  1524.     }
  1525.  
  1526.     bool CheckGroupVisibility(GameObject *Caller)
  1527.     {
  1528.         return false;
  1529.     }
  1530.  
  1531.     bool CheckPossible(GameObject *Caller)
  1532.     {
  1533.         return false;
  1534.     }
  1535.  
  1536.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1537.     {
  1538.         Vehicle v(Caller);
  1539.         if(v.IsCollidingWithVirtualObject(VO_SQUAD01))
  1540.         {
  1541.             ActorList l1 = Game::GetActors(VO_SPAWN01);
  1542.             if(l1.GetNumActors() > 0)
  1543.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1544.  
  1545.             GameObjectList l2 = Game::GetGameObjects(NAME_FIRESTATION);
  1546.             for(int i=0; i < l2.GetNumObjects(); i++)
  1547.             {
  1548.                 GameObject *obj = l2.GetObject(i);
  1549.                 if (!obj->IsSpecialLightEnabled())
  1550.                 {
  1551.                     obj->EnableSpecialLights(true);
  1552.                     obj->PushActionWait(ACTION_NEWLIST, 16.0f);
  1553.                     obj->PushActionExecuteCommand(ACTION_APPEND, DUMMY_ALARM, Caller, 1, false);
  1554.                     Vector AlarmSnd = obj->GetPosition();
  1555.                     int soundID = Audio::PlaySample3D(SND_ALARM, AlarmSnd, true);
  1556.                     obj->SetUserData(soundID);
  1557.                     obj->AttachSound(soundID);
  1558.                 }
  1559.             }
  1560.         }
  1561.         else if(v.IsCollidingWithVirtualObject(VO_SQUAD02))
  1562.         {
  1563.             ActorList l1 = Game::GetActors(VO_SPAWN03);
  1564.             if(l1.GetNumActors() > 0)
  1565.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1566.  
  1567.             GameObjectList l2 = Game::GetGameObjects(NAME_FIRESTATION2);
  1568.             for(int i=0; i < l2.GetNumObjects(); i++)
  1569.             {
  1570.                 GameObject *obj = l2.GetObject(i);
  1571.                 if (!obj->IsSpecialLightEnabled())
  1572.                 {
  1573.                     obj->EnableSpecialLights(true);
  1574.                     obj->PushActionWait(ACTION_NEWLIST, 16.0f);
  1575.                     obj->PushActionExecuteCommand(ACTION_APPEND, DUMMY_ALARM, Caller, 1, false);
  1576.                     Vector AlarmSnd = obj->GetPosition();
  1577.                     int soundID = Audio::PlaySample3D(SND_ALARM, AlarmSnd, true);
  1578.                     obj->SetUserData(soundID);
  1579.                     obj->AttachSound(soundID);
  1580.                 }
  1581.             }
  1582.         }
  1583.         else if(v.IsCollidingWithVirtualObject(VO_SQUAD03))
  1584.         {
  1585.             ActorList l1 = Game::GetActors(VO_SPAWN04);
  1586.             if(l1.GetNumActors() > 0)
  1587.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1588.  
  1589.             GameObjectList l2 = Game::GetGameObjects(NAME_FIRESTATION3);
  1590.             for(int i=0; i < l2.GetNumObjects(); i++)
  1591.             {
  1592.                 GameObject *obj = l2.GetObject(i);
  1593.                 if (!obj->IsSpecialLightEnabled())
  1594.                 {
  1595.                     obj->EnableSpecialLights(true);
  1596.                     obj->PushActionWait(ACTION_NEWLIST, 16.0f);
  1597.                     obj->PushActionExecuteCommand(ACTION_APPEND, DUMMY_ALARM, Caller, 1, false);
  1598.                     Vector AlarmSnd = obj->GetPosition();
  1599.                     int soundID = Audio::PlaySample3D(SND_ALARM, AlarmSnd, true);
  1600.                     obj->SetUserData(soundID);
  1601.                     obj->AttachSound(soundID);
  1602.                 }
  1603.             }
  1604.         }
  1605.         else
  1606.         {
  1607.             ActorList l1 = Game::GetActors(VO_SPAWN02);
  1608.             if(l1.GetNumActors() > 0)
  1609.                 Vector Spawn = l1.GetActor(0)->GetPosition();
  1610.         }
  1611.  
  1612.         PersonList passengers = v.GetPassengers();
  1613.         if (ChildID == 1)
  1614.         {
  1615.             Person p = Game::CreatePerson(OBJ_PM, UNNAMED);
  1616.             p.SetEquipment(EQUIP_EMERGENCY_CASE);
  1617.         }
  1618.         else if (ChildID == 2)
  1619.             Person p = Game::CreatePerson(OBJ_PM_STRETCHER, UNNAMED);
  1620.         else if (ChildID == 3)
  1621.             Person p = Game::CreatePerson(OBJ_EMT, UNNAMED);
  1622.         else if (ChildID == 4)
  1623.             Person p = Game::CreatePerson(OBJ_CHIEF, UNNAMED);
  1624.         else if (ChildID == 5)
  1625.             Person p = Game::CreatePerson(OBJ_HAZMAT, UNNAMED);
  1626.         else if (ChildID == 6)
  1627.             Person p = Game::CreatePerson(OBJ_USARFF, UNNAMED);
  1628.         else if (ChildID == 7)
  1629.             Person p = Game::CreatePerson(OBJ_EMT_STRETCHER, UNNAMED);
  1630.         else
  1631.             return;
  1632.  
  1633.         p.SetUpgradeLevel(3);
  1634.         Game::FindFreePosition(&p, Spawn, 250);
  1635.         p.SetPosition(Spawn);
  1636.         p.PushActionMove(ACTION_NEWLIST, &v, TARGET_ANY);
  1637.         p.PushActionTurnTo(ACTION_APPEND, &v);
  1638.         p.PushActionEnterCar(ACTION_APPEND, &v);
  1639.     }
  1640. };
  1641.  
  1642. object DummyGates : CommandScript
  1643. {
  1644.     DummyGates()
  1645.     {
  1646.         SetGroupID(DummyGroup);
  1647.     }
  1648.  
  1649.     bool CheckGroupVisibility(GameObject *Caller)
  1650.     {
  1651.         return false;
  1652.     }
  1653.  
  1654.     bool CheckPossible(GameObject *Caller)
  1655.     {
  1656.         return false;
  1657.     }
  1658.  
  1659.     void PushActions(GameObject *Caller, Actor *Target, int ChildID)
  1660.     {
  1661.         GameObjectList gate01a = Game::GetGameObjects(NAME_GATE01A);
  1662.         GameObjectList gate02a = Game::GetGameObjects(NAME_GATE02A);
  1663.         GameObjectList gate03a = Game::GetGameObjects(NAME_GATE03A);
  1664.         GameObjectList gate04a = Game::GetGameObjects(NAME_GATE04A);
  1665.         GameObjectList gate05a = Game::GetGameObjects(NAME_GATE05A);
  1666.         GameObjectList gate06a = Game::GetGameObjects(NAME_GATE06A);
  1667.         GameObjectList gate07a = Game::GetGameObjects(NAME_GATE07A);
  1668.         GameObjectList gate08a = Game::GetGameObjects(NAME_GATE08A);
  1669.         GameObjectList gate09a = Game::GetGameObjects(NAME_GATE09A);
  1670.         GameObjectList gate10a = Game::GetGameObjects(NAME_GATE10A);
  1671.         GameObjectList gate11a = Game::GetGameObjects(NAME_GATE11A);
  1672.         GameObjectList gate01b = Game::GetGameObjects(NAME_GATE01B);
  1673.         GameObjectList gate02b = Game::GetGameObjects(NAME_GATE02B);
  1674.         GameObjectList gate03b = Game::GetGameObjects(NAME_GATE03B);
  1675.         GameObjectList gate04b = Game::GetGameObjects(NAME_GATE04B);
  1676.         GameObjectList gate05b = Game::GetGameObjects(NAME_GATE05B);
  1677.         GameObjectList gate06b = Game::GetGameObjects(NAME_GATE06B);
  1678.         GameObjectList gate07b = Game::GetGameObjects(NAME_GATE07B);
  1679.         GameObjectList gate08b = Game::GetGameObjects(NAME_GATE08B);
  1680.         GameObjectList gate09b = Game::GetGameObjects(NAME_GATE09B);
  1681.         GameObjectList gate10b = Game::GetGameObjects(NAME_GATE10B);
  1682.         GameObjectList gate11b = Game::GetGameObjects(NAME_GATE11B);
  1683.         ActorList vogate01a = Game::GetActors(VO_GATE01A);
  1684.         ActorList vogate02a = Game::GetActors(VO_GATE02A);
  1685.         ActorList vogate03a = Game::GetActors(VO_GATE03A);
  1686.         ActorList vogate04a = Game::GetActors(VO_GATE04A);
  1687.         ActorList vogate05a = Game::GetActors(VO_GATE05A);
  1688.         ActorList vogate06a = Game::GetActors(VO_GATE06A);
  1689.         ActorList vogate07a = Game::GetActors(VO_GATE07A);
  1690.         ActorList vogate08a = Game::GetActors(VO_GATE08A);
  1691.         ActorList vogate09a = Game::GetActors(VO_GATE09A);
  1692.         ActorList vogate10a = Game::GetActors(VO_GATE10A);
  1693.         ActorList vogate11a = Game::GetActors(VO_GATE11A);
  1694.         ActorList vogate01b = Game::GetActors(VO_GATE01B);
  1695.         ActorList vogate02b = Game::GetActors(VO_GATE02B);
  1696.         ActorList vogate03b = Game::GetActors(VO_GATE03B);
  1697.         ActorList vogate04b = Game::GetActors(VO_GATE04B);
  1698.         ActorList vogate05b = Game::GetActors(VO_GATE05B);
  1699.         ActorList vogate06b = Game::GetActors(VO_GATE06B);
  1700.         ActorList vogate07b = Game::GetActors(VO_GATE07B);
  1701.         ActorList vogate08b = Game::GetActors(VO_GATE08B);
  1702.         ActorList vogate09b = Game::GetActors(VO_GATE09B);
  1703.         ActorList vogate10b = Game::GetActors(VO_GATE10B);
  1704.         ActorList vogate11b = Game::GetActors(VO_GATE11B);
  1705.  
  1706.         if(ChildID == 1) //= Open front gates fire station 1
  1707.         {
  1708.             for(int i=0; i < gate01a.GetNumObjects(); i++)
  1709.             {
  1710.                 GameObject *gate = gate01a.GetObject(i);
  1711.                 Actor *vogate = vogate01a.GetActor(i);
  1712.                 if (gate->GetUserData() == 0)
  1713.                 {
  1714.                     gate->SetUserData(1);
  1715.                     gate->SetAnimation(ANI_OPEN);
  1716.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1717.                 }
  1718.             }
  1719.             for(int i=0; i < gate02a.GetNumObjects(); i++)
  1720.             {
  1721.                 GameObject *gate = gate02a.GetObject(i);
  1722.                 Actor *vogate = vogate02a.GetActor(i);
  1723.                 if (gate->GetUserData() == 0)
  1724.                 {
  1725.                     gate->SetUserData(1);
  1726.                     gate->SetAnimation(ANI_OPEN);
  1727.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1728.                 }
  1729.             }
  1730.             for(int i=0; i < gate03a.GetNumObjects(); i++)
  1731.             {
  1732.                 GameObject *gate = gate03a.GetObject(i);
  1733.                 Actor *vogate = vogate03a.GetActor(i);
  1734.                 Vector GateSnd = gate->GetPosition();
  1735.                 if (gate->GetUserData() == 0)
  1736.                 {
  1737.                     gate->SetUserData(1);
  1738.                     gate->SetAnimation(ANI_OPEN);
  1739.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1740.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  1741.                 }
  1742.             }
  1743.             for(int i=0; i < gate04a.GetNumObjects(); i++)
  1744.             {
  1745.                 GameObject *gate = gate04a.GetObject(i);
  1746.                 Actor *vogate = vogate04a.GetActor(i);
  1747.                 if (gate->GetUserData() == 0)
  1748.                 {
  1749.                     gate->SetUserData(1);
  1750.                     gate->SetAnimation(ANI_OPEN);
  1751.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1752.                 }
  1753.             }
  1754.             for(int i=0; i < gate05a.GetNumObjects(); i++)
  1755.             {
  1756.                 GameObject *gate = gate05a.GetObject(i);
  1757.                 Actor *vogate = vogate05a.GetActor(i);
  1758.                 if (gate->GetUserData() == 0)
  1759.                 {
  1760.                     gate->SetUserData(1);
  1761.                     gate->SetAnimation(ANI_OPEN);
  1762.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1763.                 }
  1764.             }
  1765.         }
  1766.         if(ChildID == 2) //= Close all opened gates fire station 1
  1767.         {
  1768.             for(int i=0; i < gate01a.GetNumObjects(); i++)
  1769.             {
  1770.                 GameObject *gate = gate01a.GetObject(i);
  1771.                 Actor *vogate = vogate01a.GetActor(i);
  1772.                 if (gate->GetUserData() == 1)
  1773.                 {
  1774.                     gate->SetUserData(0);
  1775.                     gate->SetAnimation(ANI_CLOSE);
  1776.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1777.                 }
  1778.             }
  1779.             for(int i=0; i < gate02a.GetNumObjects(); i++)
  1780.             {
  1781.                 GameObject *gate = gate02a.GetObject(i);
  1782.                 Actor *vogate = vogate02a.GetActor(i);
  1783.                 if (gate->GetUserData() == 1)
  1784.                 {
  1785.                     gate->SetUserData(0);
  1786.                     gate->SetAnimation(ANI_CLOSE);
  1787.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1788.                 }
  1789.             }
  1790.             for(int i=0; i < gate03a.GetNumObjects(); i++)
  1791.             {
  1792.                 GameObject *gate = gate03a.GetObject(i);
  1793.                 Actor *vogate = vogate03a.GetActor(i);
  1794.                 Vector GateSnd = gate->GetPosition();
  1795.                 if (gate->GetUserData() == 1)
  1796.                 {
  1797.                     gate->SetUserData(0);
  1798.                     gate->SetAnimation(ANI_CLOSE);
  1799.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1800.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  1801.                 }
  1802.             }
  1803.             for(int i=0; i < gate04a.GetNumObjects(); i++)
  1804.             {
  1805.                 GameObject *gate = gate04a.GetObject(i);
  1806.                 Actor *vogate = vogate04a.GetActor(i);
  1807.                 if (gate->GetUserData() == 1)
  1808.                 {
  1809.                     gate->SetUserData(0);
  1810.                     gate->SetAnimation(ANI_CLOSE);
  1811.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1812.                 }
  1813.             }
  1814.             for(int i=0; i < gate05a.GetNumObjects(); i++)
  1815.             {
  1816.                 GameObject *gate = gate05a.GetObject(i);
  1817.                 Actor *vogate = vogate05a.GetActor(i);
  1818.                 if (gate->GetUserData() == 1)
  1819.                 {
  1820.                     gate->SetUserData(0);
  1821.                     gate->SetAnimation(ANI_CLOSE);
  1822.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1823.                 }
  1824.             }
  1825.             for(int i=0; i < gate01b.GetNumObjects(); i++)
  1826.             {
  1827.                 GameObject *gate = gate01b.GetObject(i);
  1828.                 Actor *vogate = vogate01b.GetActor(i);
  1829.                 if (gate->GetUserData() == 1)
  1830.                 {
  1831.                     gate->SetUserData(0);
  1832.                     gate->SetAnimation(ANI_CLOSE);
  1833.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1834.                 }
  1835.             }
  1836.             for(int i=0; i < gate02b.GetNumObjects(); i++)
  1837.             {
  1838.                 GameObject *gate = gate02b.GetObject(i);
  1839.                 Actor *vogate = vogate02b.GetActor(i);
  1840.                 if (gate->GetUserData() == 1)
  1841.                 {
  1842.                     gate->SetUserData(0);
  1843.                     gate->SetAnimation(ANI_CLOSE);
  1844.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1845.                 }
  1846.             }
  1847.             for(int i=0; i < gate03b.GetNumObjects(); i++)
  1848.             {
  1849.                 GameObject *gate = gate03b.GetObject(i);
  1850.                 Actor *vogate = vogate03b.GetActor(i);
  1851.                 Vector GateSnd = gate->GetPosition();
  1852.                 if (gate->GetUserData() == 1)
  1853.                 {
  1854.                     gate->SetUserData(0);
  1855.                     gate->SetAnimation(ANI_CLOSE);
  1856.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1857.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  1858.                 }
  1859.             }
  1860.             for(int i=0; i < gate04b.GetNumObjects(); i++)
  1861.             {
  1862.                 GameObject *gate = gate04b.GetObject(i);
  1863.                 Actor *vogate = vogate04b.GetActor(i);
  1864.                 if (gate->GetUserData() == 1)
  1865.                 {
  1866.                     gate->SetUserData(0);
  1867.                     gate->SetAnimation(ANI_CLOSE);
  1868.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1869.                 }
  1870.             }
  1871.             for(int i=0; i < gate05b.GetNumObjects(); i++)
  1872.             {
  1873.                 GameObject *gate = gate05b.GetObject(i);
  1874.                 Actor *vogate = vogate05b.GetActor(i);
  1875.                 if (gate->GetUserData() == 1)
  1876.                 {
  1877.                     gate->SetUserData(0);
  1878.                     gate->SetAnimation(ANI_CLOSE);
  1879.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1880.                 }
  1881.             }
  1882.         }
  1883.         if(ChildID == 3) //= Open front gates fire station 2
  1884.         {
  1885.             for(int i=0; i < gate06a.GetNumObjects(); i++)
  1886.             {
  1887.                 GameObject *gate = gate06a.GetObject(i);
  1888.                 Actor *vogate = vogate06a.GetActor(i);
  1889.                 if (gate->GetUserData() == 0)
  1890.                 {
  1891.                     gate->SetUserData(1);
  1892.                     gate->SetAnimation(ANI_OPEN);
  1893.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1894.                 }
  1895.             }
  1896.             for(int i=0; i < gate07a.GetNumObjects(); i++)
  1897.             {
  1898.                 GameObject *gate = gate07a.GetObject(i);
  1899.                 Actor *vogate = vogate07a.GetActor(i);
  1900.                 if (gate->GetUserData() == 0)
  1901.                 {
  1902.                     gate->SetUserData(1);
  1903.                     gate->SetAnimation(ANI_OPEN);
  1904.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1905.                 }
  1906.             }
  1907.             for(int i=0; i < gate08a.GetNumObjects(); i++)
  1908.             {
  1909.                 GameObject *gate = gate08a.GetObject(i);
  1910.                 Actor *vogate = vogate08a.GetActor(i);
  1911.                 Vector GateSnd = gate->GetPosition();
  1912.                 if (gate->GetUserData() == 0)
  1913.                 {
  1914.                     gate->SetUserData(1);
  1915.                     gate->SetAnimation(ANI_OPEN);
  1916.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  1917.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  1918.                 }
  1919.             }
  1920.         }
  1921.         if(ChildID == 4) //= Close all opened gates fire station 2
  1922.         {
  1923.             for(int i=0; i < gate06a.GetNumObjects(); i++)
  1924.             {
  1925.                 GameObject *gate = gate06a.GetObject(i);
  1926.                 Actor *vogate = vogate06a.GetActor(i);
  1927.                 if (gate->GetUserData() == 1)
  1928.                 {
  1929.                     gate->SetUserData(0);
  1930.                     gate->SetAnimation(ANI_CLOSE);
  1931.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1932.                 }
  1933.             }
  1934.             for(int i=0; i < gate07a.GetNumObjects(); i++)
  1935.             {
  1936.                 GameObject *gate = gate07a.GetObject(i);
  1937.                 Actor *vogate = vogate07a.GetActor(i);
  1938.                 if (gate->GetUserData() == 1)
  1939.                 {
  1940.                     gate->SetUserData(0);
  1941.                     gate->SetAnimation(ANI_CLOSE);
  1942.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1943.                 }
  1944.             }
  1945.             for(int i=0; i < gate08a.GetNumObjects(); i++)
  1946.             {
  1947.                 GameObject *gate = gate08a.GetObject(i);
  1948.                 Actor *vogate = vogate08a.GetActor(i);
  1949.                 Vector GateSnd = gate->GetPosition();
  1950.                 if (gate->GetUserData() == 1)
  1951.                 {
  1952.                     gate->SetUserData(0);
  1953.                     gate->SetAnimation(ANI_CLOSE);
  1954.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1955.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  1956.                 }
  1957.             }
  1958.             for(int i=0; i < gate06b.GetNumObjects(); i++)
  1959.             {
  1960.                 GameObject *gate = gate06b.GetObject(i);
  1961.                 Actor *vogate = vogate06b.GetActor(i);
  1962.                 if (gate->GetUserData() == 1)
  1963.                 {
  1964.                     gate->SetUserData(0);
  1965.                     gate->SetAnimation(ANI_CLOSE);
  1966.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1967.                 }
  1968.             }
  1969.             for(int i=0; i < gate07b.GetNumObjects(); i++)
  1970.             {
  1971.                 GameObject *gate = gate07b.GetObject(i);
  1972.                 Actor *vogate = vogate07b.GetActor(i);
  1973.                 if (gate->GetUserData() == 1)
  1974.                 {
  1975.                     gate->SetUserData(0);
  1976.                     gate->SetAnimation(ANI_CLOSE);
  1977.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1978.                 }
  1979.             }
  1980.             for(int i=0; i < gate08b.GetNumObjects(); i++)
  1981.             {
  1982.                 GameObject *gate = gate08b.GetObject(i);
  1983.                 Actor *vogate = vogate08b.GetActor(i);
  1984.                 Vector GateSnd = gate->GetPosition();
  1985.                 if (gate->GetUserData() == 1)
  1986.                 {
  1987.                     gate->SetUserData(0);
  1988.                     gate->SetAnimation(ANI_CLOSE);
  1989.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  1990.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  1991.                 }
  1992.             }
  1993.         }
  1994.         if(ChildID == 5) //= Open front gates fire station 3
  1995.         {
  1996.             for(int i=0; i < gate09a.GetNumObjects(); i++)
  1997.             {
  1998.                 GameObject *gate = gate09a.GetObject(i);
  1999.                 Actor *vogate = vogate09a.GetActor(i);
  2000.                 if (gate->GetUserData() == 0)
  2001.                 {
  2002.                     gate->SetUserData(1);
  2003.                     gate->SetAnimation(ANI_OPEN);
  2004.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2005.                 }
  2006.             }
  2007.             for(int i=0; i < gate10a.GetNumObjects(); i++)
  2008.             {
  2009.                 GameObject *gate = gate10a.GetObject(i);
  2010.                 Actor *vogate = vogate10a.GetActor(i);
  2011.                 if (gate->GetUserData() == 0)
  2012.                 {
  2013.                     gate->SetUserData(1);
  2014.                     gate->SetAnimation(ANI_OPEN);
  2015.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2016.                 }
  2017.             }
  2018.             for(int i=0; i < gate11a.GetNumObjects(); i++)
  2019.             {
  2020.                 GameObject *gate = gate11a.GetObject(i);
  2021.                 Actor *vogate = vogate11a.GetActor(i);
  2022.                 Vector GateSnd = gate->GetPosition();
  2023.                 if (gate->GetUserData() == 0)
  2024.                 {
  2025.                     gate->SetUserData(1);
  2026.                     gate->SetAnimation(ANI_OPEN);
  2027.                     vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2028.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  2029.                 }
  2030.             }
  2031.         }
  2032.         if(ChildID == 6) //= Close all opened gates fire station 3
  2033.         {
  2034.             for(int i=0; i < gate09a.GetNumObjects(); i++)
  2035.             {
  2036.                 GameObject *gate = gate09a.GetObject(i);
  2037.                 Actor *vogate = vogate09a.GetActor(i);
  2038.                 if (gate->GetUserData() == 1)
  2039.                 {
  2040.                     gate->SetUserData(0);
  2041.                     gate->SetAnimation(ANI_CLOSE);
  2042.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2043.                 }
  2044.             }
  2045.             for(int i=0; i < gate10a.GetNumObjects(); i++)
  2046.             {
  2047.                 GameObject *gate = gate10a.GetObject(i);
  2048.                 Actor *vogate = vogate10a.GetActor(i);
  2049.                 if (gate->GetUserData() == 1)
  2050.                 {
  2051.                     gate->SetUserData(0);
  2052.                     gate->SetAnimation(ANI_CLOSE);
  2053.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2054.                 }
  2055.             }
  2056.             for(int i=0; i < gate11a.GetNumObjects(); i++)
  2057.             {
  2058.                 GameObject *gate = gate11a.GetObject(i);
  2059.                 Actor *vogate = vogate11a.GetActor(i);
  2060.                 Vector GateSnd = gate->GetPosition();
  2061.                 if (gate->GetUserData() == 1)
  2062.                 {
  2063.                     gate->SetUserData(0);
  2064.                     gate->SetAnimation(ANI_CLOSE);
  2065.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2066.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  2067.                 }
  2068.             }
  2069.             for(int i=0; i < gate09b.GetNumObjects(); i++)
  2070.             {
  2071.                 GameObject *gate = gate09b.GetObject(i);
  2072.                 Actor *vogate = vogate09b.GetActor(i);
  2073.                 if (gate->GetUserData() == 1)
  2074.                 {
  2075.                     gate->SetUserData(0);
  2076.                     gate->SetAnimation(ANI_CLOSE);
  2077.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2078.                 }
  2079.             }
  2080.             for(int i=0; i < gate10b.GetNumObjects(); i++)
  2081.             {
  2082.                 GameObject *gate = gate10b.GetObject(i);
  2083.                 Actor *vogate = vogate10b.GetActor(i);
  2084.                 if (gate->GetUserData() == 1)
  2085.                 {
  2086.                     gate->SetUserData(0);
  2087.                     gate->SetAnimation(ANI_CLOSE);
  2088.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2089.                 }
  2090.             }
  2091.             for(int i=0; i < gate11b.GetNumObjects(); i++)
  2092.             {
  2093.                 GameObject *gate = gate11b.GetObject(i);
  2094.                 Actor *vogate = vogate11b.GetActor(i);
  2095.                 Vector GateSnd = gate->GetPosition();
  2096.                 if (gate->GetUserData() == 1)
  2097.                 {
  2098.                     gate->SetUserData(0);
  2099.                     gate->SetAnimation(ANI_CLOSE);
  2100.                     vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2101.                     Audio::PlaySample3D(SND_GATE, GateSnd);
  2102.                 }
  2103.             }
  2104.         }
  2105.         if(ChildID == 7) //= Battalion chief 'calls vehicle cmds' for opening/closing front gates fire station 1
  2106.         {
  2107.             Vehicle v(Caller);
  2108.             if (v.GetVehicleType() == VT_AMBULANCE_RTW)
  2109.             {
  2110.                 for(int i=0; i < gate01a.GetNumObjects(); i++)
  2111.                 {
  2112.                     GameObject *gate = gate01a.GetObject(i);
  2113.                     Actor *vogate = vogate01a.GetActor(i);
  2114.                     Vector GateSnd = gate->GetPosition();
  2115.                     if (gate->GetUserData() == 0)
  2116.                     {
  2117.                         gate->SetUserData(1);
  2118.                         gate->SetAnimation(ANI_OPEN);
  2119.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2120.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2121.                     } else
  2122.                     {
  2123.                         gate->SetUserData(0);
  2124.                         gate->SetAnimation(ANI_CLOSE);
  2125.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2126.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2127.                     }
  2128.                 }
  2129.             }
  2130.             if(StrCompare(v.GetPrototypeFileName(), OBJ_USAR) == 0)
  2131.             {
  2132.                 for(int i=0; i < gate02a.GetNumObjects(); i++)
  2133.                 {
  2134.                     GameObject *gate = gate02a.GetObject(i);
  2135.                     Actor *vogate = vogate02a.GetActor(i);
  2136.                     Vector GateSnd = gate->GetPosition();
  2137.                     if (gate->GetUserData() == 0)
  2138.                     {
  2139.                         gate->SetUserData(1);
  2140.                         gate->SetAnimation(ANI_OPEN);
  2141.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2142.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2143.                     } else
  2144.                     {
  2145.                         gate->SetUserData(0);
  2146.                         gate->SetAnimation(ANI_CLOSE);
  2147.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2148.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2149.                     }
  2150.                 }
  2151.             }
  2152.             if(StrCompare(v.GetPrototypeFileName(), OBJ_LADDER) == 0)
  2153.             {
  2154.                 for(int i=0; i < gate03a.GetNumObjects(); i++)
  2155.                 {
  2156.                     GameObject *gate = gate03a.GetObject(i);
  2157.                     Actor *vogate = vogate03a.GetActor(i);
  2158.                     Vector GateSnd = gate->GetPosition();
  2159.                     if (gate->GetUserData() == 0)
  2160.                     {
  2161.                         gate->SetUserData(1);
  2162.                         gate->SetAnimation(ANI_OPEN);
  2163.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2164.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2165.                     } else
  2166.                     {
  2167.                         gate->SetUserData(0);
  2168.                         gate->SetAnimation(ANI_CLOSE);
  2169.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2170.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2171.                     }
  2172.                 }
  2173.             }
  2174.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  2175.             {
  2176.                 for(int i=0; i < gate04a.GetNumObjects(); i++)
  2177.                 {
  2178.                     GameObject *gate = gate04a.GetObject(i);
  2179.                     Actor *vogate = vogate04a.GetActor(i);
  2180.                     Vector GateSnd = gate->GetPosition();
  2181.                     if (gate->GetUserData() == 0)
  2182.                     {
  2183.                         gate->SetUserData(1);
  2184.                         gate->SetAnimation(ANI_OPEN);
  2185.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2186.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2187.                     } else
  2188.                     {
  2189.                         gate->SetUserData(0);
  2190.                         gate->SetAnimation(ANI_CLOSE);
  2191.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2192.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2193.                     }
  2194.                 }  
  2195.             }
  2196.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE02) == 0)
  2197.             {
  2198.                 for(int i=0; i < gate05a.GetNumObjects(); i++)
  2199.                 {
  2200.                     GameObject *gate = gate05a.GetObject(i);
  2201.                     Actor *vogate = vogate05a.GetActor(i);
  2202.                     Vector GateSnd = gate->GetPosition();
  2203.                     if (gate->GetUserData() == 0)
  2204.                     {
  2205.                         gate->SetUserData(1);
  2206.                         gate->SetAnimation(ANI_OPEN);
  2207.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2208.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2209.                     } else
  2210.                     {
  2211.                         gate->SetUserData(0);
  2212.                         gate->SetAnimation(ANI_CLOSE);
  2213.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2214.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2215.                     }
  2216.                 }
  2217.             }
  2218.         }
  2219.         if(ChildID == 8) //= Battalion chief 'calls vehicle cmds' for opening/closing front gates fire station 2
  2220.         {
  2221.             Vehicle v(Caller);
  2222.             if(StrCompare(v.GetPrototypeFileName(), OBJ_HES) == 0)
  2223.             {
  2224.                 for(int i=0; i < gate06a.GetNumObjects(); i++)
  2225.                 {
  2226.                     GameObject *gate = gate06a.GetObject(i);
  2227.                     Actor *vogate = vogate06a.GetActor(i);
  2228.                     Vector GateSnd = gate->GetPosition();
  2229.                     if (gate->GetUserData() == 0)
  2230.                     {
  2231.                         gate->SetUserData(1);
  2232.                         gate->SetAnimation(ANI_OPEN);
  2233.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2234.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2235.                     } else
  2236.                     {
  2237.                         gate->SetUserData(0);
  2238.                         gate->SetAnimation(ANI_CLOSE);
  2239.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2240.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2241.                     }
  2242.                 }
  2243.             }
  2244.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE02) == 0)
  2245.             {
  2246.                 for(int i=0; i < gate07a.GetNumObjects(); i++)
  2247.                 {
  2248.                     GameObject *gate = gate07a.GetObject(i);
  2249.                     Actor *vogate = vogate07a.GetActor(i);
  2250.                     Vector GateSnd = gate->GetPosition();
  2251.                     if (gate->GetUserData() == 0)
  2252.                     {
  2253.                         gate->SetUserData(1);
  2254.                         gate->SetAnimation(ANI_OPEN);
  2255.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2256.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2257.                     } else
  2258.                     {
  2259.                         gate->SetUserData(0);
  2260.                         gate->SetAnimation(ANI_CLOSE);
  2261.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2262.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2263.                     }
  2264.                 }  
  2265.             }
  2266.             if (v.GetVehicleType() == VT_AMBULANCE_RTW)
  2267.             {
  2268.                 for(int i=0; i < gate08a.GetNumObjects(); i++)
  2269.                 {
  2270.                     GameObject *gate = gate08a.GetObject(i);
  2271.                     Actor *vogate = vogate08a.GetActor(i);
  2272.                     Vector GateSnd = gate->GetPosition();
  2273.                     if (gate->GetUserData() == 0)
  2274.                     {
  2275.                         gate->SetUserData(1);
  2276.                         gate->SetAnimation(ANI_OPEN);
  2277.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2278.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2279.                     } else
  2280.                     {
  2281.                         gate->SetUserData(0);
  2282.                         gate->SetAnimation(ANI_CLOSE);
  2283.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2284.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2285.                     }
  2286.                 }
  2287.             }
  2288.  
  2289.         }
  2290.         if(ChildID == 9) //To fire station cmd to open rear gates fire station 1
  2291.         {
  2292.             Vehicle v(Caller);
  2293.             if (v.GetVehicleType() == VT_AMBULANCE_RTW)
  2294.             {
  2295.                 for(int i=0; i < gate01b.GetNumObjects(); i++)
  2296.                 {
  2297.                     GameObject *gate = gate01b.GetObject(i);
  2298.                     Actor *vogate = vogate01b.GetActor(i);
  2299.                     Vector GateSnd = gate->GetPosition();
  2300.                     if (gate->GetUserData() == 0)
  2301.                     {
  2302.                         gate->SetUserData(1);
  2303.                         gate->SetAnimation(ANI_OPEN);
  2304.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2305.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2306.                     }
  2307.                 }
  2308.             }
  2309.             if(StrCompare(v.GetPrototypeFileName(), OBJ_USAR) == 0)
  2310.             {
  2311.                 for(int i=0; i < gate02b.GetNumObjects(); i++)
  2312.                 {
  2313.                     GameObject *gate = gate02b.GetObject(i);
  2314.                     Actor *vogate = vogate02b.GetActor(i);
  2315.                     Vector GateSnd = gate->GetPosition();
  2316.                     if (gate->GetUserData() == 0)
  2317.                     {
  2318.                         gate->SetUserData(1);
  2319.                         gate->SetAnimation(ANI_OPEN);
  2320.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2321.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2322.                     }
  2323.                 }
  2324.             }
  2325.             if(StrCompare(v.GetPrototypeFileName(), OBJ_LADDER) == 0)
  2326.             {
  2327.                 for(int i=0; i < gate03b.GetNumObjects(); i++)
  2328.                 {
  2329.                     GameObject *gate = gate03b.GetObject(i);
  2330.                     Actor *vogate = vogate03b.GetActor(i);
  2331.                     Vector GateSnd = gate->GetPosition();
  2332.                     if (gate->GetUserData() == 0)
  2333.                     {
  2334.                         gate->SetUserData(1);
  2335.                         gate->SetAnimation(ANI_OPEN);
  2336.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2337.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2338.                     }
  2339.                 }
  2340.             }
  2341.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  2342.             {
  2343.                 for(int i=0; i < gate04b.GetNumObjects(); i++)
  2344.                 {
  2345.                     GameObject *gate = gate04b.GetObject(i);
  2346.                     Actor *vogate = vogate04b.GetActor(i);
  2347.                     Vector GateSnd = gate->GetPosition();
  2348.                     if (gate->GetUserData() == 0)
  2349.                     {
  2350.                         gate->SetUserData(1);
  2351.                         gate->SetAnimation(ANI_OPEN);
  2352.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2353.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2354.                     }
  2355.                 }  
  2356.             }
  2357.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE02) == 0)
  2358.             {
  2359.                 for(int i=0; i < gate05b.GetNumObjects(); i++)
  2360.                 {
  2361.                     GameObject *gate = gate05b.GetObject(i);
  2362.                     Actor *vogate = vogate05b.GetActor(i);
  2363.                     Vector GateSnd = gate->GetPosition();
  2364.                     if (gate->GetUserData() == 0)
  2365.                     {
  2366.                         gate->SetUserData(1);
  2367.                         gate->SetAnimation(ANI_OPEN);
  2368.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2369.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2370.                     }
  2371.                 }
  2372.             }
  2373.         }
  2374.         if(ChildID == 10) //To fire station cmd to open rear gates fire station 2
  2375.         {
  2376.             Vehicle v(Caller);
  2377.             if(StrCompare(v.GetPrototypeFileName(), OBJ_HES) == 0)
  2378.             {
  2379.                 for(int i=0; i < gate06b.GetNumObjects(); i++)
  2380.                 {
  2381.                     GameObject *gate = gate06b.GetObject(i);
  2382.                     Actor *vogate = vogate06b.GetActor(i);
  2383.                     Vector GateSnd = gate->GetPosition();
  2384.                     if (gate->GetUserData() == 0)
  2385.                     {
  2386.                         gate->SetUserData(1);
  2387.                         gate->SetAnimation(ANI_OPEN);
  2388.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2389.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2390.                     }
  2391.                 }
  2392.             }
  2393.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE02) == 0)
  2394.             {
  2395.                 for(int i=0; i < gate07b.GetNumObjects(); i++)
  2396.                 {
  2397.                     GameObject *gate = gate07b.GetObject(i);
  2398.                     Actor *vogate = vogate07b.GetActor(i);
  2399.                     Vector GateSnd = gate->GetPosition();
  2400.                     if (gate->GetUserData() == 0)
  2401.                     {
  2402.                         gate->SetUserData(1);
  2403.                         gate->SetAnimation(ANI_OPEN);
  2404.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2405.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2406.                     }
  2407.                 }  
  2408.             }
  2409.             if (v.GetVehicleType() == VT_AMBULANCE_RTW)
  2410.             {
  2411.                 for(int i=0; i < gate08b.GetNumObjects(); i++)
  2412.                 {
  2413.                     GameObject *gate = gate08b.GetObject(i);
  2414.                     Actor *vogate = vogate08b.GetActor(i);
  2415.                     Vector GateSnd = gate->GetPosition();
  2416.                     if (gate->GetUserData() == 0)
  2417.                     {
  2418.                         gate->SetUserData(1);
  2419.                         gate->SetAnimation(ANI_OPEN);
  2420.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2421.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2422.                     }
  2423.                 }
  2424.             }
  2425.         }
  2426.         if(ChildID == 11) //To fire station cmd to open rear gates fire station 3
  2427.         {
  2428.             Vehicle v(Caller);
  2429.             if(StrCompare(v.GetPrototypeFileName(), OBJ_LEV) == 0)
  2430.             {
  2431.                 for(int i=0; i < gate09b.GetNumObjects(); i++)
  2432.                 {
  2433.                     GameObject *gate = gate09b.GetObject(i);
  2434.                     Actor *vogate = vogate09b.GetActor(i);
  2435.                     Vector GateSnd = gate->GetPosition();
  2436.                     if (gate->GetUserData() == 0)
  2437.                     {
  2438.                         gate->SetUserData(1);
  2439.                         gate->SetAnimation(ANI_OPEN);
  2440.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2441.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2442.                     }
  2443.                 }
  2444.             }
  2445.             if(StrCompare(v.GetPrototypeFileName(), OBJ_WATERTENDER) == 0)
  2446.             {
  2447.                 for(int i=0; i < gate10b.GetNumObjects(); i++)
  2448.                 {
  2449.                     GameObject *gate = gate10b.GetObject(i);
  2450.                     Actor *vogate = vogate10b.GetActor(i);
  2451.                     Vector GateSnd = gate->GetPosition();
  2452.                     if (gate->GetUserData() == 0)
  2453.                     {
  2454.                         gate->SetUserData(1);
  2455.                         gate->SetAnimation(ANI_OPEN);
  2456.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2457.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2458.                     }
  2459.                 }  
  2460.             }
  2461.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE06) == 0)
  2462.             {
  2463.                 for(int i=0; i < gate11b.GetNumObjects(); i++)
  2464.                 {
  2465.                     GameObject *gate = gate11b.GetObject(i);
  2466.                     Actor *vogate = vogate11b.GetActor(i);
  2467.                     Vector GateSnd = gate->GetPosition();
  2468.                     if (gate->GetUserData() == 0)
  2469.                     {
  2470.                         gate->SetUserData(1);
  2471.                         gate->SetAnimation(ANI_OPEN);
  2472.                         vogate->SetVirtualObjectTerrain(VOSET_ROAD);
  2473.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2474.                     }
  2475.                 }
  2476.             }
  2477.         }
  2478.         if(ChildID == 12) //To fire station cmd to close rear gates fire station 1
  2479.         {
  2480.             Vehicle v(Caller);
  2481.             if (v.GetVehicleType() == VT_AMBULANCE_RTW)
  2482.             {
  2483.                 for(int i=0; i < gate01b.GetNumObjects(); i++)
  2484.                 {
  2485.                     GameObject *gate = gate01b.GetObject(i);
  2486.                     Actor *vogate = vogate01b.GetActor(i);
  2487.                     Vector GateSnd = gate->GetPosition();
  2488.                     if (gate->GetUserData() == 1)
  2489.                     {
  2490.                         gate->SetUserData(0);
  2491.                         gate->SetAnimation(ANI_CLOSE);
  2492.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2493.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2494.                     }
  2495.                 }
  2496.             }
  2497.             if(StrCompare(v.GetPrototypeFileName(), OBJ_USAR) == 0)
  2498.             {
  2499.                 for(int i=0; i < gate02b.GetNumObjects(); i++)
  2500.                 {
  2501.                     GameObject *gate = gate02b.GetObject(i);
  2502.                     Actor *vogate = vogate02b.GetActor(i);
  2503.                     Vector GateSnd = gate->GetPosition();
  2504.                     if (gate->GetUserData() == 1)
  2505.                     {
  2506.                         gate->SetUserData(0);
  2507.                         gate->SetAnimation(ANI_CLOSE);
  2508.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2509.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2510.                     }
  2511.                 }
  2512.             }
  2513.             if(StrCompare(v.GetPrototypeFileName(), OBJ_LADDER) == 0)
  2514.             {
  2515.                 for(int i=0; i < gate03b.GetNumObjects(); i++)
  2516.                 {
  2517.                     GameObject *gate = gate03b.GetObject(i);
  2518.                     Actor *vogate = vogate03b.GetActor(i);
  2519.                     Vector GateSnd = gate->GetPosition();
  2520.                     if (gate->GetUserData() == 1)
  2521.                     {
  2522.                         gate->SetUserData(0);
  2523.                         gate->SetAnimation(ANI_CLOSE);
  2524.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2525.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2526.                     }
  2527.                 }
  2528.             }
  2529.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE01) == 0)
  2530.             {
  2531.                 for(int i=0; i < gate04b.GetNumObjects(); i++)
  2532.                 {
  2533.                     GameObject *gate = gate04b.GetObject(i);
  2534.                     Actor *vogate = vogate04b.GetActor(i);
  2535.                     Vector GateSnd = gate->GetPosition();
  2536.                     if (gate->GetUserData() == 1)
  2537.                     {
  2538.                         gate->SetUserData(0);
  2539.                         gate->SetAnimation(ANI_CLOSE);
  2540.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2541.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2542.                     }
  2543.                 }
  2544.             }
  2545.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE02) == 0)
  2546.             {
  2547.                 for(int i=0; i < gate05b.GetNumObjects(); i++)
  2548.                 {
  2549.                     GameObject *gate = gate05b.GetObject(i);
  2550.                     Actor *vogate = vogate05b.GetActor(i);
  2551.                     Vector GateSnd = gate->GetPosition();
  2552.                     if (gate->GetUserData() == 1)
  2553.                     {
  2554.                         gate->SetUserData(0);
  2555.                         gate->SetAnimation(ANI_CLOSE);
  2556.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2557.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2558.                     }
  2559.                 }
  2560.             }
  2561.         }
  2562.         if(ChildID == 13) //To fire station cmd to close rear gates fire station 2
  2563.         {
  2564.             Vehicle v(Caller);
  2565.             if(StrCompare(v.GetPrototypeFileName(), OBJ_HES) == 0)
  2566.             {
  2567.                 for(int i=0; i < gate06b.GetNumObjects(); i++)
  2568.                 {
  2569.                     GameObject *gate = gate06b.GetObject(i);
  2570.                     Actor *vogate = vogate06b.GetActor(i);
  2571.                     Vector GateSnd = gate->GetPosition();
  2572.                     if (gate->GetUserData() == 1)
  2573.                     {
  2574.                         gate->SetUserData(0);
  2575.                         gate->SetAnimation(ANI_CLOSE);
  2576.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2577.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2578.                     }
  2579.                 }
  2580.             }
  2581.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE02) == 0)
  2582.             {
  2583.                 for(int i=0; i < gate07b.GetNumObjects(); i++)
  2584.                 {
  2585.                     GameObject *gate = gate07b.GetObject(i);
  2586.                     Actor *vogate = vogate07b.GetActor(i);
  2587.                     Vector GateSnd = gate->GetPosition();
  2588.                     if (gate->GetUserData() == 1)
  2589.                     {
  2590.                         gate->SetUserData(0);
  2591.                         gate->SetAnimation(ANI_CLOSE);
  2592.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2593.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2594.                     }
  2595.                 }
  2596.             }
  2597.             if (v.GetVehicleType() == VT_AMBULANCE_RTW)
  2598.             {
  2599.                 for(int i=0; i < gate08b.GetNumObjects(); i++)
  2600.                 {
  2601.                     GameObject *gate = gate08b.GetObject(i);
  2602.                     Actor *vogate = vogate08b.GetActor(i);
  2603.                     Vector GateSnd = gate->GetPosition();
  2604.                     if (gate->GetUserData() == 1)
  2605.                     {
  2606.                         gate->SetUserData(0);
  2607.                         gate->SetAnimation(ANI_CLOSE);
  2608.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2609.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2610.                     }
  2611.                 }
  2612.             }
  2613.         }
  2614.         if(ChildID == 14) //To fire station cmd to close rear gates fire station 3
  2615.         {
  2616.             Vehicle v(Caller);
  2617.             if(StrCompare(v.GetPrototypeFileName(), OBJ_LEV) == 0)
  2618.             {
  2619.                 for(int i=0; i < gate09b.GetNumObjects(); i++)
  2620.                 {
  2621.                     GameObject *gate = gate09b.GetObject(i);
  2622.                     Actor *vogate = vogate09b.GetActor(i);
  2623.                     Vector GateSnd = gate->GetPosition();
  2624.                     if (gate->GetUserData() == 1)
  2625.                     {
  2626.                         gate->SetUserData(0);
  2627.                         gate->SetAnimation(ANI_CLOSE);
  2628.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2629.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2630.                     }
  2631.                 }
  2632.             }
  2633.             if(StrCompare(v.GetPrototypeFileName(), OBJ_WATERTENDER) == 0)
  2634.             {
  2635.                 for(int i=0; i < gate10b.GetNumObjects(); i++)
  2636.                 {
  2637.                     GameObject *gate = gate10b.GetObject(i);
  2638.                     Actor *vogate = vogate10b.GetActor(i);
  2639.                     Vector GateSnd = gate->GetPosition();
  2640.                     if (gate->GetUserData() == 1)
  2641.                     {
  2642.                         gate->SetUserData(0);
  2643.                         gate->SetAnimation(ANI_CLOSE);
  2644.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2645.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2646.                     }
  2647.                 }
  2648.             }
  2649.             if(StrCompare(v.GetPrototypeFileName(), OBJ_ENGINE06) == 0)
  2650.             {
  2651.                 for(int i=0; i < gate11b.GetNumObjects(); i++)
  2652.                 {
  2653.                     GameObject *gate = gate11b.GetObject(i);
  2654.                     Actor *vogate = vogate11b.GetActor(i);
  2655.                     Vector GateSnd = gate->GetPosition();
  2656.                     if (gate->GetUserData() == 1)
  2657.                     {
  2658.                         gate->SetUserData(0);
  2659.                         gate->SetAnimation(ANI_CLOSE);
  2660.                         vogate->SetVirtualObjectTerrain(VOSET_BARRICADE);
  2661.                         Audio::PlaySample3D(SND_GATE, GateSnd);
  2662.                     }
  2663.                 }
  2664.             }
  2665.         }
  2666.     }
  2667. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement