frodzet Posted May 25, 2015 Share Posted May 25, 2015 (edited) new GTA.MenuButton("Set player skin", () => { Model test = new Model(PedHash.Chimp); test.Request(500); if (test.IsInCdImage && test.IsValid) { while (!test.IsLoaded) Wait(100); Function.Call(Hash.SET_PLAYER_MODEL, player, test.Hash); Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, player); } test.MarkAsNoLongerNeeded(); }) Works just as intended, however as soon as the character die the game ends up in some kind of infinite loop. How can i work around this issue? :-) Edited May 25, 2015 by frodzet Link to comment Share on other sites More sharing options...
Quazaka Posted May 25, 2015 Share Posted May 25, 2015 Couldn't you just check in your if statement about the player being alive? if (test.IsInCdImage && test.IsValid && Game.Player.Character.IsAlive){ while (!test.IsLoaded) Wait(100); Function.Call(Hash.SET_PLAYER_MODEL, player, test.Hash); Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, player);} Link to comment Share on other sites More sharing options...
quickfingers Posted May 26, 2015 Share Posted May 26, 2015 The way its done in native trainer and I copied that way was to have it revert back to Trevorr Michael or Franklin on death. So in C# land, something like this (this is a direct translation from the cpp in native trainer) : if (Function.Call<bool>(Hash.IS_ENTITY_DEAD, player)) || Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, player, true)) {if (Game.Player.Character.Model != PedHash.Michael && Game.Player.Character.Model != PedHash.Trevor && Game.Player.Character.Model != PedHash.Franklin) {UI.Notify("Turning to normal");Wait(1000);ChangePlayer(PedHash.Franklin, false);}} frodzet 1 Link to comment Share on other sites More sharing options...
frodzet Posted May 26, 2015 Author Share Posted May 26, 2015 (edited) Couldn't you just check in your if statement about the player being alive? if (test.IsInCdImage && test.IsValid && Game.Player.Character.IsAlive){ while (!test.IsLoaded) Wait(100); Function.Call(Hash.SET_PLAYER_MODEL, player, test.Hash); Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, player);} That won't work, unfortunately :-) That will only prevent you from changing while dead, you need to make sure that you will change back to normal skin when you die, are being arrested and what not :-) The way its done in native trainer and I copied that way was to have it revert back to Trevorr Michael or Franklin on death. So in C# land, something like this (this is a direct translation from the cpp in native trainer) : if (Function.Call<bool>(Hash.IS_ENTITY_DEAD, player)) || Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, player, true)) {if (Game.Player.Character.Model != PedHash.Michael && Game.Player.Character.Model != PedHash.Trevor && Game.Player.Character.Model != PedHash.Franklin) {UI.Notify("Turning to normal");Wait(1000);ChangePlayer(PedHash.Franklin, false);}} Thank you :-) Edited May 26, 2015 by frodzet Link to comment Share on other sites More sharing options...
Inco Posted May 26, 2015 Share Posted May 26, 2015 (edited) By the way, small suggestion: Model test = new Model(PedHash.Chimp);if (test.IsInCdImage && test.IsValid && test.Request(500)){ Function.Call(Hash.SET_PLAYER_MODEL, player, test.Hash); Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, player);} Request() method returns true if model was loaded in time specified by you. Edited May 26, 2015 by Inco frodzet 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