Vehicles/VehicleScripts/NetworkEvents/EventVehicleSetMotorOn.lua

This file contains an event that synchronizes whether the motor of a Vehicle is turned on or off.

  24  EventVehicleSetMotorOn          = EventVehicleSetMotorOn or ExtensionOf(BaseEvent);
  25  
  26  InitVanillaEvent(EventVehicleSetMotorOn, "EventVehicleSetMotorOn");
  27  
  28  function EventVehicleSetMotorOn:sendData(entity, isOn)
  29      streamWriteEntityId(entity);
  30      streamWriteBool(isOn);
  31  end;
  32  
  33  function EventVehicleSetMotorOn:receiveData(connection)
  34      local entity                = streamReadEntityId();
  35      local isOn                  = streamReadBool();
  36  
  37      if entity ~= nil then
  38          entity:setIsMotorOn(isOn, true);
  39  
  40          self:broadcastEvent(connection, entity, isOn);
  41      end;
  42  end;

All contents of this page may be used for modding use for Winter Resort Simulator - Season 2 only. Any use exceeding this regulation is not permitted.

Copyright (C) HR Innoways, 2021. All Rights Reserved.