Advertisement
Guest User

Untitled

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