public static void LoginMenu(Client player) { API.shared.triggerClientEvent(player, "interpolateCamera", 2000, StartCamPos, StopCamPos, new Vector3(0.0, 0.0, -80.0), new Vector3(0.0, 0.0, -115.0)); player.position = StartPos; player.rotation = StartRot; player.freeze(true); player.transparency = 0; var character = ContextFactory.Instance.Character.FirstOrDefault(x => x.SocialClub == player.socialClubName); if (character == null) { CharacterController.CreateCharacter(player); } else { var face = ContextFactory.Instance.Faces.FirstOrDefault(x => x.CharacterId == character.Id); if (face != null) { SpawnManager.SetCharacterFace(player, character); ClothesManager.SetPlayerSkinClothes(player, 0, character, false); player.transparency = 255; API.shared.triggerClientEvent(player, "login_char_menu", character.Language); } else { CharacterController.InitializePedFace(player.handle); API.shared.triggerClientEvent(player, "face_custom"); } } }
public static void SpawnCharacter(Client player, CharacterController characterController) { API.shared.triggerClientEvent(player, "destroyCamera"); API.shared.resetPlayerNametagColor(player); if (characterController.Character.RegistrationStep == 0) { var face = ContextFactory.Instance.Faces.FirstOrDefault(x => x.CharacterId == characterController.Character.Id); if (face == null) { CharacterController.InitializePedFace(player.handle); API.shared.triggerClientEvent(player, "face_custom"); return; } SetCharacterFace(player, characterController.Character); ClothesManager.SetPlayerSkinClothes(player, 0, characterController.Character, true); ClothesManager.WardrobeInit(characterController.Character); 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, false); WeaponManager.SetPlayerWeapon(player, characterController.Character, 1); API.shared.setEntityPosition(player, NewPlayerPosition); API.shared.setEntityRotation(player, NewPlayerRotation); } if (CharacterController.IsCharacterArmySoldier(characterController)) { var placeArmy = characterController.Character.ActiveGroupID < 2003 ? ContextFactory.Instance.Property.FirstOrDefault(x => x.GroupId == 2000) : 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.IntPosX, userHouse.IntPosY, userHouse.IntPosZ)); API.shared.setEntityRotation(player, NewPlayerRotation); } if (player.getData("ISDYED") == true && !CharacterController.IsCharacterInGang(characterController)) { API.shared.setEntityPosition(player, new Vector3(260.26f, -1357.64f, 24.54f)); player.setData("ISDYED", false); player.health = 20; } ContextFactory.Instance.SaveChanges(); }