SA-MP Forums Archive
[Include] mselect - model select system with previews - 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] mselect - model select system with previews (/showthread.php?tid=621156)



mselect - model select system with previews - ZiGGi - 07.11.2016

mselect
GitHub
About
Model Select with previews. Text Draw's style based on Text Draw's from vspawner script by Kye. Good replacement for mSelection.

Screens


Functions
Show created MSelect
PHP код:
MSelect_Show(playerid, function[]) 
Open MSelect
PHP код:
MSelect_Open(playerid, function[], items_array[], items_countbool:list_loop MSELECT_DEF_LIST_LOOP,
      
header[] = ""button[] = MSELECT_DEF_BUTTON_TEXT,
      
button_next[] = MSELECT_DEF_BUTTON_NEXTbutton_prev[] = MSELECT_DEF_BUTTON_PREV,
      
Float:pos_x MSELECT_DEF_POS_XFloat:pos_y MSELECT_DEF_POS_Y,
      
Float:button_width MSELECT_DEF_BUTTON_WIDTHFloat:button_height MSELECT_DEF_BUTTON_HEIGHT,
      
Float:page_button_width MSELECT_DEF_PBUTTON_WIDTHFloat:page_button_height MSELECT_DEF_PBUTTON_HEIGHT,
      
Float:item_width MSELECT_DEF_ITEM_WIDTHFloat:item_height MSELECT_DEF_ITEM_HEIGHT,
      
Float:rot_x MSELECT_DEF_ROT_XFloat:rot_y MSELECT_DEF_ROT_YFloat:rot_z MSELECT_DEF_ROT_Z,
      
Float:zoom MSELECT_DEF_ZOOMFloat:background_padding MSELECT_DEF_BG_PADDING,
      
Float:item_padding MSELECT_DEF_ITEM_PADDINGFloat:button_padding MSELECT_DEF_BUTTON_PADDING,
      
Float:header_padding MSELECT_DEF_HEADER_PADDINGFloat:page_padding MSELECT_DEF_PAGE_PADDING,
      
select_color MSELECT_DEF_SELECT_COLOR,
      
items_bg_colors[MSELECT_MAX_ITEMS] = {MSELECT_DEF_ITEMS_BG_COLOR, ...},
      
dialog_bg_color MSELECT_DEF_DIALOG_BG_COLOR,
      
header_fg_color MSELECT_DEF_HEADER_FG_COLOR,
      
page_fg_color MSELECT_DEF_PAGE_FG_COLOR,
      
button_fg_color MSELECT_DEF_BUTTON_FG_COLOR,
      
button_bg_color MSELECT_DEF_BUTTON_BG_COLOR
Close MSelect
PHP код:
MSelect_Close(playerid
Is MSelect opened
PHP код:
MSelect_IsOpen(playerid
Callbacks
Each MSelect has its own handler function, it looks as follows:
PHP код:
MSelectResponse:example_ms(playeridMSelectType:responseitemiditemvalue[])
{
    return 
1;

This function is called when a user interacts with MSelect.

MSelectType can have these values: Defines
Directive
Default value
Can be redefined
MSELECT_MAX_ITEMS 100 yes
MSELECT_MAX_ITEMS_PER_LINE 7 yes
MSELECT_MAX_ITEMS_LINES 3 yes
MSELECT_DEF_LIST_LOOP false yes
MSELECT_DEF_BUTTON_TEXT "Cancel" yes
MSELECT_DEF_BUTTON_NEXT ">>" yes
MSELECT_DEF_BUTTON_PREV "<<" yes
MSELECT_DEF_POS_X 85.0 yes
MSELECT_DEF_POS_Y 130.0 yes
MSELECT_DEF_BUTTON_WIDTH 60.0 yes
MSELECT_DEF_BUTTON_HEIGHT 13.0 yes
MSELECT_DEF_PBUTTON_WIDTH 30.0 yes
MSELECT_DEF_PBUTTON_HEIGHT 13.0 yes
MSELECT_DEF_ITEM_WIDTH 60.0 yes
MSELECT_DEF_ITEM_HEIGHT 70.0 yes
MSELECT_DEF_ROT_X 0.0 yes
MSELECT_DEF_ROT_Y 0.0 yes
MSELECT_DEF_ROT_Z 0.0 yes
MSELECT_DEF_ZOOM 1.0 yes
MSELECT_DEF_BG_PADDING 20.0 yes
MSELECT_DEF_ITEM_PADDING 2.0 yes
MSELECT_DEF_BUTTON_PADDING 5.0 yes
MSELECT_DEF_SELECT_COLOR 0xAAAAAAFF yes
MSELECT_DEF_ITEMS_BG_COLOR 0x55555599 yes
MSELECT_DEF_DIALOG_BG_COLOR 0x00000099 yes
MSELECT_DEF_HEADER_FG_COLOR 0xDDDDDDDD yes
MSELECT_DEF_PAGE_FG_COLOR 0xDDDDDDDD yes
MSELECT_DEF_BUTTON_FG_COLOR 0x888888FF yes
MSELECT_DEF_BUTTON_BG_COLOR 0x000000CC yes
MSELECT_DEF_HEADER_PADDING 3.0 yes
MSELECT_DEF_PAGE_PADDING 3.0 yes
MSELECT_MAX_ITEMS_ON_LIST (MSELECT_MAX_ITEMS_PER_LINE * MSELECT_MAX_ITEMS_LINES) no
MSELECT_MAX_FUNCTION_NAME 31 no
MSELECT_INVALID_MODEL_ID -1 no
Usage
The system provides the ability to create a function to open Model Selection window, this is useful when multiple calls window:
PHP код:
MSelectCreate:example_ms(playerid)
{
    static
        
items_array[311] = {MSELECT_INVALID_MODEL_ID, ...},
        
items_count 0;
    if (
items_count == 0) {
        for(new 
0<= sizeof(items_array); i++) {
            if (
== 74) {
                continue;
            }
            
items_array[items_count] = i;
            
items_count++;
        }
    }
    
MSelect_Open(playeridMSelect:example_msitems_arrayitems_count, .header "Header");
}
MSelectResponse:example_ms(playeridMSelectType:responseitemidmodelid)
{
    new 
string[144];
    
format(stringsizeof(string), "ID: %d | Type: %d | Item: %d | Model: %d",
           
playerid_:responseitemidmodelid);
    
SendClientMessage(playerid, -1string);
    if (
response == MSelect_Cancel) {
        
MSelect_Close(playerid);
    }
    return 
1;

And you should use MSelect_Show to open created MSelect:
PHP код:
MSelect_Show(playeridMSelect:example_ms); 
Of course you can not use the system, you can do everything without MSelectCreate.

Download
- GitHub download page: https://github.com/Open-GTO/mselect/releases


Re: mselect - model select system with previews - Michael@Belgium - 07.11.2016

Quote:
Код:
MSelect_Open(playerid, function[], items_array[], items_count, bool:list_loop = MSELECT_DEF_LIST_LOOP, 
      header[] = "", button[] = MSELECT_DEF_BUTTON_TEXT, 
      button_next[] = MSELECT_DEF_BUTTON_NEXT, button_prev[] = MSELECT_DEF_BUTTON_PREV, 
      Float:pos_x = MSELECT_DEF_POS_X, Float:pos_y = MSELECT_DEF_POS_Y, 
      Float:button_width = MSELECT_DEF_BUTTON_WIDTH, Float:button_height = MSELECT_DEF_BUTTON_HEIGHT, 
      Float:page_button_width = MSELECT_DEF_PBUTTON_WIDTH, Float:page_button_height = MSELECT_DEF_PBUTTON_HEIGHT, 
      Float:item_width = MSELECT_DEF_ITEM_WIDTH, Float:item_height = MSELECT_DEF_ITEM_HEIGHT, 
      Float:rot_x = MSELECT_DEF_ROT_X, Float:rot_y = MSELECT_DEF_ROT_Y, Float:rot_z = MSELECT_DEF_ROT_Z, 
      Float:zoom = MSELECT_DEF_ZOOM, Float:background_padding = MSELECT_DEF_BG_PADDING, 
      Float:item_padding = MSELECT_DEF_ITEM_PADDING, Float:button_padding = MSELECT_DEF_BUTTON_PADDING, 
      Float:header_padding = MSELECT_DEF_HEADER_PADDING, Float:page_padding = MSELECT_DEF_PAGE_PADDING, 
      select_color = MSELECT_DEF_SELECT_COLOR, 
      items_bg_colors[MSELECT_MAX_ITEMS] = {MSELECT_DEF_ITEMS_BG_COLOR, ...}, 
      dialog_bg_color = MSELECT_DEF_DIALOG_BG_COLOR, 
      header_fg_color = MSELECT_DEF_HEADER_FG_COLOR, 
      page_fg_color = MSELECT_DEF_PAGE_FG_COLOR, 
      button_fg_color = MSELECT_DEF_BUTTON_FG_COLOR, 
      button_bg_color = MSELECT_DEF_BUTTON_BG_COLOR)
ok, don't you think thats a bit too much of optional parameters


Re: mselect - model select system with previews - Zorono - 07.11.2016

it looks like mselection edit if thats true i suggest to add d0's credits
but anyway good job keep it up


Re: mselect - model select system with previews - ZiGGi - 07.11.2016

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
ok, don't you think thats a bit too much of optional parameters
No, it's good for creating menus with different styles.

Quote:
Originally Posted by Zorono
Посмотреть сообщение
it looks like mselection edit if thats true i suggest to add d0's credits
but anyway good job keep it up
Read "About" section. No any code from mSelection in this script.


Re: mselect - model select system with previews - Unrea1 - 07.11.2016

my recommendation is that quite a bit wide and does not exceed the radar, and it would be perfect contribution, greetings.


Re: mselect - model select system with previews - ZiGGi - 07.11.2016

Quote:
Originally Posted by LatinZ
Посмотреть сообщение
my recommendation is that quite a bit wide and does not exceed the radar, and it would be perfect contribution, greetings.
Just use MSELECT_DEF_POS_Y for it.
Example:
PHP код:
#define MSELECT_DEF_POS_Y 50.0
#include <mselect> 



Re: mselect - model select system with previews - Unrea1 - 07.11.2016

Yeah, but I mean default, usually for people see you bad aspect, a textdraw covering radar.., gj.


Re: mselect - model select system with previews - MikeB - 07.11.2016

Really nice.


Re: mselect - model select system with previews - Unrea1 - 23.11.2016

Is it possible for you to add an update which consists of adding descriptions to each box used? Either in the center or in any corner of the box (optional)


Re: mselect - model select system with previews - AroseKhanNiazi - 20.09.2017

Can i change the MAX LIMIT?


Re: mselect - model select system with previews - ZiGGi - 20.09.2017

Quote:
Originally Posted by AroseKhanNiazi
Посмотреть сообщение
Can i change the MAX LIMIT?
Sure, just define MSELECT_MAX_ITEMS with your value before including mselect.


Re: mselect - model select system with previews - AlphaPac - 28.09.2017

Is there a way to set labels/text for each item in the list?


Re: mselect - model select system with previews - ZiGGi - 29.09.2017

Quote:
Originally Posted by AlphaPac
Посмотреть сообщение
Is there a way to set labels/text for each item in the list?
Nope


Re: mselect - model select system with previews - AlphaPac - 29.09.2017

Quote:
Originally Posted by ZiGGi
Посмотреть сообщение
Nope
RIP. Are you planning on implementing this in the future?


Re: mselect - model select system with previews - ZiGGi - 29.09.2017

Quote:
Originally Posted by AlphaPac
Посмотреть сообщение
RIP. Are you planning on implementing this in the future?
Maybe.


Re: mselect - model select system with previews - Chaprnks - 14.10.2017

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
ok, don't you think thats a bit too much of optional parameters
Couldn't agree more xD