@JohnFromGWN said in Would: A Complete ScriptHookVDotNet Mod Menu Guide be something of interrest?:
@KimonoBoy I'll share an example with you.
One of the first things I wanted to do when I started playing GTA 5 and modding was the ability to switch between the player and another ped.
I searched everywhere. Nada, nothing.
I posted here and other forums. Nope, not even a nibble.
Finally I figured it out on my own and honestly I'm shocked nobody could help, or nobody wanted to help, with something so simple.
My code lacks elegance, once more I'm not a programmer, but it works.
if (e.KeyCode == Keys.NumPad0) //SWITCH FROM PLAYER TO PED AND BACK
{
if (Game.Player.Character == Player1)
{
Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, CurrentPed, true, true); // Player 1 is declared above
PedGroup PlayerGroup = Game.Player.Character.PedGroup; //make them buddies
Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Player1, PlayerGroup);
}
else if (Game.Player.Character == CurrentPed)
{
Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, Player1, true, true);
PedGroup PlayerGroup = Game.Player.Character.PedGroup; //make them buddies
Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, CurrentPed, PlayerGroup);
}
}
If it works, it works, and for this script, I don't really see how this should be written any better? Yeah, maybe a method containing it's logic to remove duplicate code, but the code is simple and readable.