[Include] mselect - model select system with previews
#1

mselect
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:
  • MSelect_None
  • MSelect_Item
  • MSelect_Button
  • MSelect_ButtonNext
  • MSelect_ButtonPrev
  • MSelect_Cancel
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
Reply
#2

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
Reply
#3

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

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.
Reply
#5

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

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> 
Reply
#7

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

Really nice.
Reply
#9

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)
Reply
#10

Can i change the MAX LIMIT?
Reply
#11

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)