public static void PromptLoginScreen(Client player) { var character = ContextFactory.Instance.Character.FirstOrDefault(x => x.SocialClub == player.socialClubName); if (character == null) { CharacterController.CreateCharacter(player); } else { SpawnManager.SetCharacterFace(player, character); ClothesManager.SetPlayerSkinClothes(player, 0, character, 1); player.transparency = 255; API.shared.triggerClientEvent(player, "login_char_menu", character.Language); } }
private void OnPlayerDeath(Client player, NetHandle entityKiller, int weapon) { Character killerCharacter = null; Client killer = API.getPlayerFromHandle(entityKiller); if (killer != null) { // TODO: Lokalize API.sendNotificationToAll(killer.name + Localize.Lang(2, "killed") + player.name); killerCharacter = ContextFactory.Instance.Character.FirstOrDefault(x => x.SocialClub == killer.socialClubName); var caption = ContextFactory.Instance.Caption.First(x => x.Id == 1); if (caption.Sector != "0;0") { var getAttackGroup = ContextFactory.Instance.Group.FirstOrDefault(x => x.Id == caption.GangAttack * 100); var groupAttackType = (GroupType)Enum.Parse(typeof(GroupType), getAttackGroup.Type.ToString()); var getDefendGroup = ContextFactory.Instance.Group.FirstOrDefault(x => x.Id == caption.GangDefend * 100); var groupDefendType = (GroupType)Enum.Parse(typeof(GroupType), getAttackGroup.Type.ToString()); if (killerCharacter.GroupType == caption.GangAttack) { caption.FragsAttack += 1; } if (killerCharacter.GroupType == caption.GangDefend) { caption.FragsDefend += 1; } API.shared.sendChatMessageToAll("Фрагов у банды " + EntityManager.GetDisplayName(groupAttackType) + ": " + caption.FragsAttack + "\nФрагов у банды " + EntityManager.GetDisplayName(groupDefendType) + ": " + caption.FragsDefend); ContextFactory.Instance.SaveChanges(); } } else { // TODO: Lokalize API.sendNotificationToAll(player.name + Localize.Lang(2, "death")); } CharacterController characterController = player.getData("CHARACTER"); if (characterController == null) { return; } WeaponManager.SetPlayerWeapon(player, characterController.Character, 2); // Army change cloth after death if (CharacterController.IsCharacterInArmy(characterController)) { if (killerCharacter != null && CharacterController.IsCharacterInGhetto(killer)) { switch (characterController.Character.ActiveClothes) { case 2: killerCharacter.ClothesTypes = 2; API.sendNotificationToPlayer(killer, Localize.Lang(killerCharacter.Language, "kill_cloth_soldier")); break; case 3: killerCharacter.ClothesTypes = 3; API.sendNotificationToPlayer(killer, Localize.Lang(killerCharacter.Language, "kill_cloth_officer")); break; case 4: killerCharacter.ClothesTypes = 4; API.sendNotificationToPlayer(killer, Localize.Lang(killerCharacter.Language, "kill_cloth_general")); break; } ClothesManager.SetPlayerSkinClothesToDb(player, 101, characterController.Character, 1); ContextFactory.Instance.SaveChanges(); } else { API.sendNotificationToAll("[DEBUG]: Ошибка передачи формы!"); } } // Gang change clothes after death if (CharacterController.IsCharacterInGang(characterController) && CharacterController.IsCharacterInActiveArmyCloth(characterController.Character)) { characterController.Character.ClothesTypes = 0; ContextFactory.Instance.SaveChanges(); } }
public static void SpawnCharacter(Client player, CharacterController characterController) { API.shared.triggerClientEvent(player, "destroyCamera"); API.shared.resetPlayerNametagColor(player); if (characterController.Character.RegistrationStep == 0) { SetCharacterFace(player, characterController.Character); ClothesManager.SetPlayerSkinClothes(player, 0, characterController.Character, 0); WeaponManager.SetPlayerWeapon(player, characterController.Character, 0); API.shared.setEntityPosition(player, FirstPlayerPosition); API.shared.setEntityRotation(player, FirstPlayerRotation); characterController.Character.RegistrationStep = -1; // 'Tutorial Done' } else { SetCharacterFace(player, characterController.Character); ClothesManager.SetPlayerSkinClothes(player, 0, characterController.Character, 1); WeaponManager.SetPlayerWeapon(player, characterController.Character, 1); API.shared.setEntityPosition(player, NewPlayerPosition); API.shared.setEntityRotation(player, NewPlayerRotation); } if (CharacterController.IsCharacterArmySoldier(characterController)) { var placeArmy = new Data.Property(); if (characterController.Character.ActiveGroupID < 2003) { placeArmy = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 2000); } else { placeArmy = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 2100); } if (placeArmy != null) { API.shared.setEntityPosition(player, new Vector3(placeArmy.ExtPosX, placeArmy.ExtPosY, placeArmy.ExtPosZ)); API.shared.setEntityRotation(player, NewPlayerRotation); } } if (CharacterController.IsCharacterInGang(characterController)) { var placeGangs = new Data.Property(); if (characterController.Character.ActiveGroupID > 1300 && characterController.Character.ActiveGroupID <= 1310) { placeGangs = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 1300); } if (characterController.Character.ActiveGroupID > 1400 && characterController.Character.ActiveGroupID <= 1410) { placeGangs = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 1400); } if (characterController.Character.ActiveGroupID > 1500 && characterController.Character.ActiveGroupID <= 1510) { placeGangs = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 1500); } if (characterController.Character.ActiveGroupID > 1600 && characterController.Character.ActiveGroupID <= 1610) { placeGangs = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 1600); } if (characterController.Character.ActiveGroupID > 1700 && characterController.Character.ActiveGroupID <= 1710) { placeGangs = ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 1700); } if (placeGangs != null) { API.shared.setEntityPosition(player, new Vector3(placeGangs.ExtPosX, placeGangs.ExtPosY, placeGangs.ExtPosZ)); API.shared.setEntityRotation(player, NewPlayerRotation); } } var userHouse = ContextFactory.Instance.Property.FirstOrDefault(x => x.CharacterId == characterController.Character.Id); if (userHouse != null) { API.shared.setEntityPosition(player, new Vector3(userHouse.ExtPosX, userHouse.ExtPosY, userHouse.ExtPosZ)); API.shared.setEntityRotation(player, NewPlayerRotation); } ContextFactory.Instance.SaveChanges(); }