private void MenuIdentity() { Menu MainMenu = new Menu("Identity", "Choice the sex of you character") { TitleFont = 2, CanExit = false }; MainMenu.Register(MainMenu); MainMenu.AddItem("Male", "This is a real men."); MainMenu.AddItem("Female", "This is a real woman."); MainMenu.AddItem("Finish", "Done m**********r!"); MainMenu.OnItemSelect += (name, index) => { if (index == 1) { Skin.SetModelToPlayer("mp_m_freemode_01"); Skin.DefaultCharacterComponents("Male"); SexChoice = "Male"; } else if (index == 2) { Skin.SetModelToPlayer("mp_f_freemode_01"); Skin.DefaultCharacterComponents("Female"); SexChoice = "Female"; } else if (index == 3) { if (string.IsNullOrEmpty(SexChoice)) { Screen.ShowNotification("~r~[ERROR]~w~ Select a gender to continue."); } else { LockKey = false; TriggerServerEvent("Outbreak.Core.Player:SetPlayerGender", SexChoice); MainMenu.ClosedMenu(); Screen.ShowNotification("~b~[INFO]~w~ Player register complete!"); } } }; Tick += async() => { MainMenu.Initiation(); if (MainMenu.IsAnyMenuOpen()) { LockKeys(LockKey); } await Task.FromResult(0); }; }
private void MenuIdentity() { MenuSkin(); SkinMenu.ClosedMenu(); Skin.SetModelToPlayer("mp_m_freemode_01"); Skin.DefaultCharacterComponents("Male"); CreateCamera(); Vector3 PlayerCoords = GetEntityCoords(PlayerPedId(), false); SetCamCoord(Cam, PlayerCoords.X - 2f, PlayerCoords.Y, PlayerCoords.Z); MainMenu = new Menu("Identity", "Character creation") { TitleFont = 2, CanExit = false }; MainMenu.Register(MainMenu); MainMenu.AddItem("First Name", "First name of your character"); MainMenu.AddItem("Last Name", "Last name of your character"); List <string> Age = new List <string>(); for (int i = 18; i < 60; i++) { Age.Add(i.ToString()); } MainMenu.AddItemList("Age:", "Age of your character", Age); List <string> Sex = new List <string> { "Male", "Female" }; MainMenu.AddItemList("Sex:", "Gender of your character", Sex); MainMenu.AddItem("Edit Character", "Edit your f*****g character"); MainMenu.AddItem("Finish", "Done m**********r!"); MainMenu.OnItemSelect += (name, index) => { if (index == 1) { if (EntryTextIsOpen) { EntryTextIsOpen = false; EntryTextFirstName(); } else { EntryTextIsOpen = true; } } else if (index == 2) { if (EntryTextIsOpen) { EntryTextIsOpen = false; EntryTextLastName(); } else { EntryTextIsOpen = true; } } else if (name == "Edit Character") { MainMenu.ClosedMenu(); SkinMenu.OpenMenu(); SetCamCoord(Cam, PlayerCoords.X - 1f, PlayerCoords.Y, PlayerCoords.Z + 0.3f); } else if (name == "Finish") { if (string.IsNullOrEmpty(PlayerFirstName) || string.IsNullOrEmpty(PlayerLastName)) { Screen.ShowNotification("~r~[ERROR]~w~ Enter character name to continue"); } else if (PlayerFirstName.Contains(" ") || PlayerLastName.Contains(" ")) { Screen.ShowNotification("~r~[ERROR]~w~ Remove spaces in your name to continue"); } /*else if (char.IsUpper(char.Parse(PlayerFirstName.First().ToString().ToUpper())) || char.IsUpper(char.Parse(PlayerLastName.First().ToString().ToUpper()))) * { * Screen.ShowNotification("~r~[ERROR]~w~ Change capital initials to continue"); * }*/ else if (string.IsNullOrEmpty(PlayerSex)) { Screen.ShowNotification("~r~[ERROR]~w~ Select a gender to continue"); } else { PlayerSkinDictionary.Add("Skin", Skin_.ToString()); PlayerSkinDictionary.Add("Face", Face_.ToString()); PlayerSkinDictionary.Add("Hair", Hair_.ToString()); PlayerSkinDictionary.Add("HairColor", HairColor_.ToString()); PlayerSkinDictionary.Add("Eyes", Eyes_.ToString()); PlayerSkinDictionary.Add("Eyebrows", Eyebrows_.ToString()); PlayerSkinDictionary.Add("Beard", Beard_.ToString()); string PlayerSkin = Utils.String.DictionaryToString(PlayerSkinDictionary); LockKey = false; Skin.PlayerLoaded = true; TriggerServerEvent("Outbreak.Core.Player:SetPlayerRegistered", PlayerFirstName + " " + PlayerLastName, PlayerAge, PlayerSex, PlayerSkin); Screen.ShowNotification("~b~[INFO]~w~ Player register completed!"); MainMenu.ClosedMenu(); DeleteCam(); } } }; MainMenu.OnItemListSelectSides += (name, index, namelist, indexlist) => { if (index == 3) { PlayerAge = Convert.ToInt32(namelist); } else if (index == 4) { if (indexlist == 1) { if (PlayerSex != "Male") { Skin.SetPlayerModels("Male", Skin_, Face_, Hair_, HairColor_, Eyes_, Eyebrows_, Beard_); PlayerSex = "Male"; } } else if (indexlist == 2) { if (PlayerSex != "Female") { Skin.SetPlayerModels("Female", Skin_, Face_, Hair_, HairColor_, Eyes_, Eyebrows_, Beard_); PlayerSex = "Female"; } } } }; Tick += async() => { MainMenu.Initiation(); if (LockKey) { LockKeys(true); } MainMenu.ListOfItems[1] = $"First Name: {PlayerFirstName}"; MainMenu.ListOfItems[2] = $"Last Name: {PlayerLastName}"; await Task.FromResult(0); }; }