internal Stage(configuration.Lights prml, configuration.Lights secl, configuration.Lights wrnl, int veh, string acttype, Lights lights) { PRML = prml; SECL = secl; WRNL = wrnl; CurrentStage = 0; vehicleId = veh; ActivationType = acttype.ToLower(); _lights = lights; }
public ELSVehicle(int handle, [Optional] IDictionary <string, object> data) : base(handle) { _vehicle = new Vehicle(handle); ModelLoaded(); lastdrivetime = Game.GameTime; API.SetVehRadioStation(_vehicle.Handle, "OFF"); API.SetVehicleRadioEnabled(_vehicle.Handle, false); if (_vehicle.DisplayName == "CARNOTFOUND") { throw new Exception("ELSVehicle.cs:Vehicle not found"); } else if (_vehicle.GetNetworkId() == 0) { throw new Exception("ELSVehicle.cs:NetworkId is 0"); } else if (VCF.ELSVehicle.ContainsKey(_vehicle.Model)) { _vcf = VCF.ELSVehicle[_vehicle.Model].root; } try { Function.Call((Hash)0x5f3a3574, _vehicle.Handle, true); } catch (Exception e) { Utils.ReleaseWriteLine("ELSVehicle.cs:Repair Fix is not enabled on this client"); } _light = new Light.Lights(_vehicle, _vcf, (IDictionary <string, object>)data?["light"]); _siren = new Siren.Siren(_vehicle, _vcf, (IDictionary <string, object>)data?["siren"], _light); _light.SetGTASirens(false); //_vehicle.SetExistOnAllMachines(true); cachedNetId = _vehicle.GetNetworkId(); #if DEBUG CitizenFX.Core.Debug.WriteLine(CitizenFX.Core.Native.API.IsEntityAMissionEntity(_vehicle.Handle).ToString()); CitizenFX.Core.Debug.WriteLine($"ELSVehicle.cs:registering netid:{_vehicle.GetNetworkId()}\n" + $"Does entity belong to this script:{CitizenFX.Core.Native.API.DoesEntityBelongToThisScript(_vehicle.Handle, false)}"); CitizenFX.Core.Debug.WriteLine($"ELSVehicle.cs:created vehicle"); #endif }
public ELSVehicle(int handle, [Optional] ELSVehicleFSData data) : base(handle) { _vehicle = new Vehicle(handle); if (!_vehicle.Exists()) { return; } ModelLoaded(); lastdrivetime = Game.GameTime; API.SetVehRadioStation(_vehicle.Handle, "OFF"); API.SetVehicleRadioEnabled(_vehicle.Handle, false); if (_vehicle.DisplayName == "CARNOTFOUND") { throw new Exception("ELSVehicle.cs: Vehicle not found"); } else if (VCF.ELSVehicle.ContainsKey(_vehicle.Model)) { _vcf = VCF.ELSVehicle[_vehicle.Model].root; } if (API.DecorExistOn(_vehicle.Handle, "elsplus_id")) { cachedElsID = _vehicle.GetElsId(); } else { Utils.ReleaseWriteLine("ELSVehicle.cs: Vehicle is being created without a els id attempting to set now"); if (data.Id > 0) { cachedElsID = data.Id; API.DecorSetInt(_vehicle.Handle, "elsplus_id", cachedElsID); } } try { Function.Call((Hash)0x5f3a3574, _vehicle.Handle, true); } catch (Exception e) { Utils.ReleaseWriteLine("ELSVehicle.cs: Repair Fix is not enabled on this client"); } Utils.DebugWriteLine($"ELS Vehicle Data: {JsonConvert.SerializeObject(data)}"); if (data.Id.Equals(null)) { _light = new Light.Lights(_vehicle, _vcf); _siren = new Siren.Siren(_vehicle, _vcf, _light); } else { _light = new Light.Lights(_vehicle, _vcf, data.Light); _siren = new Siren.Siren(_vehicle, _vcf, _light, data.Siren); } _light.SetGTASirens(false); Utils.DebugWriteLine(API.IsEntityAMissionEntity(_vehicle.Handle).ToString()); Utils.DebugWriteLine($"ELSVehicle.cs:registering \n" + $"Does entity belong to this script:{API.DoesEntityBelongToThisScript(_vehicle.Handle, false)}"); Utils.DebugWriteLine($"ELSVehicle.cs:created vehicle"); FullSync.FullSyncManager.SendDataBroadcast(JsonConvert.SerializeObject(GetData()), Game.Player.ServerId); }