leihebi Posted January 18, 2021 Share Posted January 18, 2021 For example. If it is Michael, then prompt 1 If it is Franklin, then prompt 2 If Trevor, prompt 3 Please have the wisdom to help answer, thank you! Link to comment Share on other sites More sharing options...
LeeC22 Posted January 18, 2021 Share Posted January 18, 2021 58 minutes ago, leihebi said: For example. If it is Michael, then prompt 1 If it is Franklin, then prompt 2 If Trevor, prompt 3 Please have the wisdom to help answer, thank you! PedHash.Michael PedHash.Franklin PedHash.Trevor Compare Game.Player.Character.Model.Hash with each of those. if (Game.Player.Character.Model.Hash == (int)PedHash.Michael) { // Do Michael related prompt here } leihebi 1 Link to comment Share on other sites More sharing options...
leihebi Posted January 18, 2021 Author Share Posted January 18, 2021 36 minutes ago, LeeC22 said: 佩德哈什. 迈克尔 佩德哈什. 弗兰克林 佩德哈什. 特雷弗 比较游戏. 玩家. 字符. 模型. 哈希与每个。 if (Game.Player.Character.Model.Hash == (int)PedHash.Michael) { // Do Michael related prompt here } Thank you very much, my friend. I wish you well. LeeC22 1 Link to comment Share on other sites More sharing options...
leihebi Posted January 18, 2021 Author Share Posted January 18, 2021 (edited) 1 hour ago, LeeC22 said: PedHash.Michael PedHash.Franklin PedHash.Trevor Compare Game.Player.Character.Model.Hash with each of those. if (Game.Player.Character.Model.Hash == (int)PedHash.Michael) { // Do Michael related prompt here } Hi, I'm having a little bit of a problem, judging that Michael is fine, but the other protagonists show: the constant value "Hierarchy value of the protagonist" cannot be converted to "int" (using the "unchecked" syntax) rewrite) Now I'll tell you what I think, I want it to be like this, if it's Michael then it's 1, or if it's Franklin then it's 2, or if it's Trevor then it's 3. The code might look like this if () else if () else () Edited January 18, 2021 by leihebi Link to comment Share on other sites More sharing options...
LeeC22 Posted January 18, 2021 Share Posted January 18, 2021 2 hours ago, leihebi said: Hi, I'm having a little bit of a problem, judging that Michael is fine, but the other protagonists show: the constant value "Hierarchy value of the protagonist" cannot be converted to "int" (using the "unchecked" syntax) rewrite) Now I'll tell you what I think, I want it to be like this, if it's Michael then it's 1, or if it's Franklin then it's 2, or if it's Trevor then it's 3. The code might look like this if () else if () else () Try this. int playerHash = Game.Player.Character.Model.Hash; if (playerHash == Game.GenerateHash("player_zero")) { UI.ShowSubtitle("Michael"); } else if (playerHash == Game.GenerateHash("player_one")) { UI.ShowSubtitle("Franklin"); } else if (playerHash == Game.GenerateHash("player_two")) { UI.ShowSubtitle("Trevor"); } leihebi 1 Link to comment Share on other sites More sharing options...
leihebi Posted January 18, 2021 Author Share Posted January 18, 2021 35 minutes ago, LeeC22 said: Try this. int playerHash = Game.Player.Character.Model.Hash; if (playerHash == Game.GenerateHash("player_zero")) { UI.ShowSubtitle("Michael"); } else if (playerHash == Game.GenerateHash("player_one")) { UI.ShowSubtitle("Franklin"); } else if (playerHash == Game.GenerateHash("player_two")) { UI.ShowSubtitle("Trevor"); } Thank you so much, my friend! I wish you all the best and happiness! LeeC22 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now