ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 6407

GTA 5 Array players

by NoNameV2345 - 01-09-2018 - 12:43 AM
#11
you must make struct to selectedOptions and put options to money drop
Reply
#12
GOOD WORK.............
Reply
#13
this is good! Thank you

I was saved by this! Appreciation
Reply
#14
Cool post man :D
Reply
#15
what does this code do im srry im quite new to c++
Judge Judy Is Sexy Asf Can We All Agree?  Love
& Lets Stop The Cracking War M8s Devil )
(Make Modding Fun Again 100emoji   )
Reply
#16
(01-22-2018 - 03:29 AM)Soviet Wrote: The reason most menus don't use this sort of setup is because of the overhead you incur with all those extra variables. For every new mod with a toggle option that affects another player (ex: nuke loop on player), you would now add 18 global variables to memory rather than 1. Think of how much this would inflate your menu if you had hundreds of these toggle options. If I were a user for a menu, I'd much rather be limited by nuking 1 player at a time than nuking multiple players at once with a laggy menu.

Personally, I would stick to using a single bool since it just makes life easier and you spend less time making each mod. If you need to have separate toggles for each player, here's an alternative. Instead of 1 player per bool, try using an unsigned int and treating the bits inside it as bools through bitmasking. For example, you could rework your code to be:

Code:
unsigned int moneyDropBits;//variable to hold all the player bits

bool isMoneyDropEnabled(int player)//method to see if a player's bit is enabled in moneyDropBits
{
    return moneyDropBits & (1 << player);
}
#define moneyDropEnabled(player)    ((moneyDropBits & (1 << player)) != 0)//define version of above method

//in your hook
for (int i = 0; i < 18; i++)
{
    if (isMoneyDropEnabled(i))
    {
        //example of method usage
        MoneyOnPlayer(i);
    }
    
    if (moneyDropEnabled(i))
    {
        //example of define usage
        MoneyOnPlayer(i);
    }
}

//in the menu case
addBoolOption("Money Drop", isMoneyDropEnabled(selectedPlayer));
//or
addBoolOption("Money Drop", moneyDropEnabled(selectedPlayer));
switch(getOption())
{
case 1:
    moneyDropBits ^= (1 << selectedPlayer);//switches the player's bit in moneyDropBits
    break;
}
break;

I would recommend using the #define version in this code because the method requires more space for instructions

Hey good stuff.......
Reply
#17
thank you so much
Reply

Users browsing: