Jump to content

4d4a5852

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Community Reputation

3 Neutral

About 4d4a5852

Recent Profile Visitors

525 profile views
  1. Some vehicle components have methods for the engine. class VehicleWheeledSimulation has proto external bool IsEngineOn(); and class VehicleControllerComponent has proto external bool EngineIsOn(); Both worked for me so far: SCR_CarControllerComponent.Cast(yourvehicle.FindComponent(SCR_CarControllerComponent)).IsEngineOn(); VehicleWheeledSimulation.Cast(yourvehicle.FindComponent(VehicleWheeledSimulation)).EngineIsOn();
  2. switch works by comparing the condition to the different cases. So doing something like switch (true) do { case (a > 5): {...}; case (a == 2): {...}; default {}; }; is fine - see Example 3 But when only comparing a variable to strings there's no reason to abuse switch in such a way - i.e. just use its standard syntax. Additionally switch (_projectile != "") do { will resolve to false when _projectile is an empty string and therefore the first case which also resolves to false will be executed - i.e. move the check into a separate if-block. But the reason for the code not working is that _finalDamage isn't declared in the main scope before the switch, i.e. the value assigned to it within the switch-cases will be lost afterwards e.g. define/declare it at the beginning of the script.
×