void OnTimerBeforeStoppingPhotoElapsed(object status) { _timerBeforeStoppingPhoto.Dispose(); _timerBeforeStoppingPhoto = null; GridPhoto.Dispatcher.Invoke(() => Stop()); }
private void StopWithErrorMessage() { _error = true; GridPhoto.Dispatcher.Invoke(() => VisibilityManagement(-1)); if (_liveView != null) { _liveView.Stop(); _liveView = null; } // Stop all timers if (_timerStartCapture != null) { _timerStartCapture.Dispose(); _timerStartCapture = null; } if (_timerWatchDog != null) { _timerWatchDog.Dispose(); _timerWatchDog = null; } StopAfterTimer(); }
public void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seat) { if (vehicle.GetVehicle() == null) { return; } if (API.GetEntityModel(vehicle) == (int)VehicleHash.Flatbed && player.GetCharacter().JobOne.Type == JobManager.JobTypes.Lumberjack) { GameVehicle veh = NAPI.Data.GetEntityData(vehicle, "Vehicle"); if (veh.Job?.Type != JobManager.JobTypes.Lumberjack) { return; } Tree tree = NAPI.Data.GetEntityData(vehicle, "TREE_OBJ"); if (tree == null) { return; } if (NAPI.Data.HasEntityData(vehicle, "TREE_DRIVER")) { int id = NAPI.Data.GetEntityData(vehicle, "TREE_DRIVER"); if (id != player.GetCharacter().Id) { //API.Delay(1000, true, () => API.WarpPlayerOutOfVehicle(player)); Task.Delay(1000).ContinueWith(t => API.WarpPlayerOutOfVehicle(player)); // CONV NOTE: delay fixme NAPI.Chat.SendChatMessageToPlayer(player, "This is not yours."); return; } } if (NAPI.Data.HasEntityData(vehicle, "Tree_Cancel_Timer")) { System.Threading.Timer timer = NAPI.Data.GetEntityData(vehicle, "Tree_Cancel_Timer"); timer.Dispose(); NAPI.Data.ResetEntityData(vehicle, "Tree_Cancel_Timer"); NAPI.Chat.SendChatMessageToPlayer(player, "You've got back into your vehicle."); } } }
private void API_onPlayerEnterVehicle(Client player, NetHandle vehicle, int seat) { if (vehicle.GetVehicle() == null) { return; } if (API.GetEntityModel(vehicle) == (int)VehicleHash.Flatbed && player.GetCharacter().JobOne.Type == JobManager.JobTypes.Lumberjack) { Vehicle veh = API.GetEntityData(vehicle, "Vehicle"); if (veh.Job?.Type != JobManager.JobTypes.Lumberjack) { return; } Tree tree = API.GetEntityData(vehicle, "TREE_OBJ"); if (tree == null) { return; } if (API.HasEntityData(vehicle, "TREE_DRIVER")) { int id = API.GetEntityData(vehicle, "TREE_DRIVER"); if (id != player.GetCharacter().Id) { API.Delay(1000, true, () => API.WarpPlayerOutOfVehicle(player));; API.SendChatMessageToPlayer(player, "This is not yours."); return; } } if (API.HasEntityData(vehicle, "Tree_Cancel_Timer")) { System.Threading.Timer timer = API.GetEntityData(vehicle, "Tree_Cancel_Timer"); timer.Dispose(); API.ResetEntityData(vehicle, "Tree_Cancel_Timer"); API.SendChatMessageToPlayer(player, "You've got back into your vehicle."); } } }
void OnTimerWatchDogElapsed(object status) { _timerWatchDog.Dispose(); _timerWatchDog = null; GridPhoto.Dispatcher.Invoke(() => StopWithErrorMessage()); }