What's new

Mod Menu Basic Menu for colours

  • Thread starter Liquid44
  • Start date
  • Views 1,484
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
I wrote a very basic menu to select any colour you want and then do something with it like setting the current vehicle to your specified colour. I don't exactly know what the numbers for each colour is as its not RGB format, im just going by the fact that the range of colours is between 0 and 133.

Its mainly a system for other developers to tweak to their liking.

There is an example of usage in the comments

All you need to do is thread:


Code:
colourMenu();
selectColour();

Also you need to define the usual core includes of scocl, I have compiled it without any errors.

Key A turns the menu on or off
key M and B will cycle through the list of colours and print the current number
Key Enter will do something with the current colour selected.

Enjoy.


Code:
#define NO_OF_COLOURS 133
 
bool isKeyPressed(uint key)
{
        return IS_GAME_KEYBOARD_KEY_JUST_PRESSED(key);
}
 
void print(char *string)
{
        PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", string, 5000, 1);
}
 
uint colourIndex = 0;
bool inColourMenu = false;
uint finalColour = 0;
 
void colourMenu(void)
{
      if(isKeyPressed(KEY_A))
      {
              if(inColourMenu)
              {
                     inColourMenu = false;
                     print("Colour menu closed");
               }
              else
              {
                     inColourMenu = true;
                     print("Colour menu activated");
              }
 
      }
 
}
 
void selectColour(void)
{
      if(inColourMenu)
      {
             print(colourIndex);
 
             if(isKeyPressed(KEY_M))
            {
                  colourIndex += 1;
                  if(colourIndex > ( NO_OF_COLOURS ) )
                           colourIndex = 0;
                  print( colourIndex );
                  finalColour = colourIndex;
             }
 
             if(isKeyPressed(KEY_B))
            {
                  colourIndex -= 1;
                  if(colourIndex < 0 )
                           colourIndex = 0;
                  print( colourIndex );
                  finalColour = colourIndex;
             }
 
             if(isKeyPressed(KEY_ENTER))
             {
 
                          //Do stuff with the desired colour here
                          //using the var finalColour
                          /****************Example********************
 
                           Car car;
                           GET_CAR_CHAR_IS_USING(GetPlayerPed(), &car);
                           CHANGE_CAR_COLOUR(car, finalColour, finalColour);
 
                           **********************************************/
              }
 
      }
}

The formatting and indenting is a bit off due to the forum code tags so you might need to adjust the spacing in a editor of your choice.

This is an example of how to make a simple menu, so you could change it to make a menu for anything.

If you have no idea what to do with this then its not for you...
 
S

sudo

Enthusiast
Messages
92
Reaction score
12
Points
55
Sin$
7
Great stuff with this mate. I was gonna write a simple menu myself for all the 4 colours and the livery. Just one thing about the livery, it takes one uint number so im assuming that number will be the bit order for the various upgrades eg a uint of 4 will be the 3rd bit(upgrade) or for example 5 will be upgrades 3 and 1 if you follow me. What do you think? I know Threesocks has done the mod shop, but it's a monster of code and i only need a simple text menu. Anyway thanks for this bit code, it gives some ideas :wink:
 
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
Great stuff with this mate. I was gonna write a simple menu myself for all the 4 colours and the livery. Just one thing about the livery, it takes one uint number so im assuming that number will be the bit order for the various upgrades eg a uint of 4 will be the 3rd bit(upgrade) or for example 5 will be upgrades 3 and 1 if you follow me. What do you think? I know Threesocks has done the mod shop, but it's a monster of code and i only need a simple text menu. Anyway thanks for this bit code, it gives some ideas :wink:

I'm not sure what you mean but

CHANGE_CAR_COLOUR(car, colourOne, colourTwo);
SET_EXTRA_CAR_COLOURS(car,colourThree, colourFour);

is what you need to use to set the colour of the vehicle. Not sure which one affects the livery.


copy pasted from psx scene...

cant find the post now but i know i've seen it posted before,.

umm lol I don't need to copy and paste something as simple as this...I wrote this but if you say you've seen it before then show me link.
 
D

Deleted member 117745

Reefer Smoker
Messages
2,393
Reaction score
1,924
Points
365
Sin$
0
umm lol I don't need to copy and paste something as simple as this...I wrote this but if you say you've seen it before then show me link.
i realize its simple but i know i've seen that posted on psx before, i haven't been able to find it from the digging i've done over there, which isn't much as its not nearly as active as these forums. i don't care enough to continue looking though, so i'll just edit my other post out.
 
S

sudo

Enthusiast
Messages
92
Reaction score
12
Points
55
Sin$
7
I'm not sure what you mean but

CHANGE_CAR_COLOUR(car, colourOne, colourTwo);
SET_EXTRA_CAR_COLOURS(car,colourThree, colourFour);

is what you need to use to set the colour of the vehicle. Not sure which one affects the livery.

The livery is the car's different options like spoilers and double exhaust etc. There's a native for pulling the amount of options each vehicle has and also for setting those options. The setting of the options only requires one integer so i think it must be setting on bit order, for example a 8 bit byte goes upto 255 with all bits set on, so to set for example bits 1 and 4 (upgrades for the cars maybe), the number would be 9. I'm only assuming thats how the various upgrade options are sent to the SET_LIVERY native.
 
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
The livery is the car's different options like spoilers and double exhaust etc. There's a native for pulling the amount of options each vehicle has and also for setting those options. The setting of the options only requires one integer so i think it must be setting on bit order, for example a 8 bit byte goes upto 255 with all bits set on, so to set for example bits 1 and 4 (upgrades for the cars maybe), the number would be 9. I'm only assuming thats how the various upgrade options are sent to the SET_LIVERY native.

I don't think they would be setting it on the bits but rather each livery has its own index so if a car has 4 different liveries available then you would just call the native 4x and change the int from 1 to 4.
 
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
set_car_livery(car, 1);
set_car_livery(car, 3);

assuming the index starts at 1. I don't know for sure where it starts.
 
S

sudo

Enthusiast
Messages
92
Reaction score
12
Points
55
Sin$
7
I think easiest way is to have a look at Threesocks's mod shop script in scotoolbox, just before he calls the native.

If you look at the handling.dat, the extras are eight digits, each digit representing a certain upgrade, maybe this is the 8 digit integer it's expecting for a particular upgrade set?
 
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
I think easiest way is to have a look at Threesocks's mod shop script in scotoolbox, just before he calls the native.

If you look at the handling.dat, the extras are eight digits, each digit representing a certain upgrade, maybe this is the 8 digit integer it's expecting for a particular upgrade set?

I dunno, just play around with it and see what it does. I have not used this native.
 
daxxphenom

daxxphenom

Enthusiast
Messages
219
Reaction score
101
Points
85
Sin$
7
I wrote a very basic menu to select any colour you want and then do something with it like setting the current vehicle to your specified colour. I don't exactly know what the numbers for each colour is as its not RGB format, im just going by the fact that the range of colours is between 0 and 133.

Its mainly a system for other developers to tweak to their liking.

There is an example of usage in the comments

All you need to do is thread:


Code:
colourMenu();
selectColour();

Also you need to define the usual core includes of scocl, I have compiled it without any errors.

Key A turns the menu on or off
key M and B will cycle through the list of colours and print the current number
Key Enter will do something with the current colour selected.

Enjoy.


Code:
#define NO_OF_COLOURS 133
 
bool isKeyPressed(uint key)
{
        return IS_GAME_KEYBOARD_KEY_JUST_PRESSED(key);
}
 
void print(char *string)
{
        PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", string, 5000, 1);
}
 
uint colourIndex = 0;
bool inColourMenu = false;
uint finalColour = 0;
 
void colourMenu(void)
{
      if(isKeyPressed(KEY_A))
      {
              if(inColourMenu)
              {
                    inColourMenu = false;
                    print("Colour menu closed");
              }
              else
              {
                    inColourMenu = true;
                    print("Colour menu activated");
              }
 
      }
 
}
 
void selectColour(void)
{
      if(inColourMenu)
      {
            print(colourIndex);
 
            if(isKeyPressed(KEY_M))
            {
                  colourIndex += 1;
                  if(colourIndex > ( NO_OF_COLOURS ) )
                          colourIndex = 0;
                  print( colourIndex );
                  finalColour = colourIndex;
            }
 
            if(isKeyPressed(KEY_B))
            {
                  colourIndex -= 1;
                  if(colourIndex < 0 )
                          colourIndex = 0;
                  print( colourIndex );
                  finalColour = colourIndex;
            }
 
            if(isKeyPressed(KEY_ENTER))
            {
 
                          //Do stuff with the desired colour here
                          //using the var finalColour
                          /****************Example********************
 
                          Car car;
                          GET_CAR_CHAR_IS_USING(GetPlayerPed(), &car);
                          CHANGE_CAR_COLOUR(car, finalColour, finalColour);
 
                          **********************************************/
              }
 
      }
}

The formatting and indenting is a bit off due to the forum code tags so you might need to adjust the spacing in a editor of your choice.

This is an example of how to make a simple menu, so you could change it to make a menu for anything.

If you have no idea what to do with this then its not for you...
Cool :smile:
 
Top Bottom
Login
Register