SA-MP Forums Archive
[Include] Modshop car color selection menu (SA original) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Modshop car color selection menu (SA original) (/showthread.php?tid=436058)



Modshop car color selection menu (SA original) - Drebin - 09.05.2013

Tuningshop car color menu




Thanks to AIped for updating the code to support the colors that were added in 0.3x
I've spent some time and remade the car color selection menu used in the modshops all around San Andreas. It is at the exact same position and the colors/cursor also have the exact same size. All colours are exactly the ones used in the original modshops menu.

You are free to use this include however you want. You can modify it, extend it and take snippets out of it. But if you release something which uses this menu, remember to include/keep the credits

The menu uses player textdraws.

Functions

pawn Код:
CreateColorSelectionDialog(playerid);
Used to create the textdraws for the player. Function to be used under OnPlayerConnect()


pawn Код:
DestroyColorSelectionDialog(playerid);
Used to destroy the textdraws for the player (if needed).


pawn Код:
ShowPlayerColorSelectDialog(playerid);
HidePlayerColorSelectDialog(playerid);
Self explanatory. Used to show or hide the menu for the player.

pawn Код:
MoveColorDialogCursor(playerid, direction);
Used to move the cursor (white frame behind the colors).
Possible directions:
pawn Код:
CURSOR_MOVE_UP
CURSOR_MOVE_DOWN
CURSOR_MOVE_LEFT   
CURSOR_MOVE_RIGHT
If the cursor is at the very right of the menu and it is moved right again, it goes down one row and starts over at the very left. Same when moving left but vice versa.


pawn Код:
SelectCurrentColor(playerid);
Used to select the color the cursor (frame) is currently highlighting. Using this function calls OnPlayerSelectColor() (look down for more info on this).


pawn Код:
GetColorFromPosition(column, row);
Gets the vehicle color ID a color is representing by entering the column and row number of the desired color (each number ranging 0-7: 8 rows/columns).



Callbacks

pawn Код:
OnPlayerChangeSelectedColor(playerid, column, row)
Called when the cursor is moved to a new color. Row/column represent the new position the cursor has been moved to.


pawn Код:
OnPlayerSelectColor(playerid, column, row)
Called when SelectCurrentColor(); is used. Use GetColorFromPosition(); to find out which vehicle color ID the user selected.


Information

I have included an example gamemode down below to give you an easy example of how to use the menu. It uses commands to move the cursor, but if you want you can also use your arrow keys, you simply have to re-code it that way. You could also leave the cursor out and make the colors clickable, but that will take some rewriting.
Remember, you don't have to use it the way I coded it, you can re-write it however you want, I simply provide you the color menu itself.


Download
Include:(Place the carcoldialog.inc into pawno/includes)


Re: Modshop car color selection menu (SA original) - Frede - 10.05.2013

Nice


Re: Modshop car color selection menu (SA original) - [DOG]irinel1996 - 11.05.2013

Nice script, well done.


Re: Modshop car color selection menu (SA original) - RajatPawar - 11.05.2013

Nice. Could be used for many things, except cars!


Re: Modshop car color selection menu (SA original) - Drebin - 11.05.2013

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
except cars!
Why so?


Re: Modshop car color selection menu (SA original) - Excel™ - 11.05.2013

Wow, Nice work Drebin.

REP+


Re: Modshop car color selection menu (SA original) - Drebin - 03.11.2014

Updated to the new 0.3x colors, thanks to AIped!


Re: Modshop car color selection menu (SA original) - LiamM - 21.11.2015

This is an old post, I know, however I seem to be getting the most strangest bug from this include.

pawn Код:
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerSelectColor" is not implemented
Any solutions? I have noticed you have forwarded it but don't have a public callback for it? Should there be one?


Re: Modshop car color selection menu (SA original) - Gammix - 21.11.2015

Quote:
Originally Posted by LiamM
Посмотреть сообщение
This is an old post, I know, however I seem to be getting the most strangest bug from this include.

pawn Код:
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerChangeSelectedColor" is not implemented
error 004: function "OnPlayerSelectColor" is not implemented
Any solutions? I have noticed you have forwarded it but don't have a public callback for it? Should there be one?
Its because the script don't check if the callback is declared before calling it.

To fix this, you need to declare them!
pawn Код:
public OnPlayerChangeSelectedColor(playerid, column, row)
{
}

public OnPlayerSelectColor(playerid, column, row)
{
}



Re: Modshop car color selection menu (SA original) - Juvanii - 29.07.2018

Quote:
Originally Posted by Drebin
Посмотреть сообщение
I have included an example gamemode down below to give you an easy example of how to use the menu.
I do not see the example, anyone got an example ?