private void CharacterEditorController_OnPlayerFinishedCharacterEditor(Client client, Account e) { if (e.CurrentCharacter == null) { logger.Debug($"Player: {client.socialClubName} ({e.Id}) Character is Null"); } CharacterController.ApplyCharacterClothing(client); // Spawn at last Position if (e.CurrentCharacter.Position == null || e.CurrentCharacter.Position == "" || e.CurrentCharacter.Position.FromJson <Vector3>().DistanceTo(new Vector3(0, 0, 0)) <= 2f) { AntiCheatController.TeleportPlayer(client, Constants.DefaultSpawnPosition, new Vector3(0, 0, Constants.DefaultSpawnRotation)); client.position = Constants.DefaultSpawnPosition; client.rotation = new Vector3(0, 0, Constants.DefaultSpawnRotation); API.sendColoredNotificationToPlayer(client, "Deine Spawnposition war fehlerhaft, deshalb wurdest du an den Anfangspunkt zurückgebracht.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_ORANGE); e.CurrentCharacter.Position = Constants.DefaultSpawnPosition.ToJson(); e.CurrentCharacter.Rotation = Constants.DefaultSpawnRotation; return; } AntiCheatController.TeleportPlayer(client, e.CurrentCharacter.Position.FromJson <Vector3>(), new Vector3(0, 0, e.CurrentCharacter.Rotation)); client.Account().IsSpawned = true; client.BlockInteractionKeys(false); DimensionManager.GoToNormalWorldDimension(client); InteractionController.UpdateInteractableObjectsForPlayer(client); if (client.Account().AdminLevel == AdminLevel.AdminLevel4) { client.AdminMode(true); API.sendColoredNotificationToPlayer(client, "AdminMode aktiviert", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_BLUE); } }
private void GameMode_OnWorldStartup() { using (var db = new Database()) { db.OwnedVehicles.Where(x => !x.InGarage || !x.CanParkOutEverywhere).ToList().ForEach(veh => { veh.InGarage = true; veh.CanParkOutEverywhere = true; }); db.SaveChangesAsync(); } InteractionController.AddInteractionDelegate(EntityType.Vehicle, InteractionMenuPositions.FIRST, AddVehicleInteractionMenu); }