SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 27/11/2016, 09:54 AM   #1
ZiGGi
Banned
 
Join Date: Sep 2008
Location: Russia
Posts: 1,659
Reputation: 356
Default TextList - Text Draw list system.

TextList

About
Text Draw list system.

Screens
Working vehicle tuning system from Open-GTO gamemode. You can see sources here.


Functions
Show created TextList
PHP Code:
TextList_Show(playerid, function[]) 
Open TextList
PHP Code:
TextList_Open(playerid, function[], list_items[][], list_size sizeof(list_items), header[] = "",
              
button1[] = ""button2[] = ""Float:pos_x 89.0Float:pos_y 140.0,
              
select_color 0xFFA500FF,
              
lists_bg_color[TEXTLIST_MAX_ITEMS] = {0x212121A0, ...},
              
lists_fg_color[TEXTLIST_MAX_ITEMS] = {0xFFFFFFFF, ...},
              
header_bg_color 0xB71C1CAAheader_fg_color 0xFFFFFFFF,
              
paginator_bg_color 0x21212160paginator_fg_color 0xFFFFFFFF,
              
button1_bg_color 0x6D4C41AAbutton1_fg_color 0xFFFFFFFF,
              
button2_bg_color 0x6D4C41AAbutton2_fg_color 0xFFFFFFFF
Close TextList
PHP Code:
TextList_Close(playerid); 
Is TextList opened
PHP Code:
TextList_IsOpen(playerid); 
Callbacks
Each TextList has its own handler function, it looks as follows:
PHP Code:
TextListResponse:example_tl(playeridTextListType:responseitemiditemvalue[])
{
    return 
1;

This function is called when a user interacts with TextList.

TextListType can have these values:
- TextList_None
- TextList_Button1
- TextList_Button2
- TextList_ListItem
- TextList_ListUp
- TextList_ListDown
- TextList_Cancel

Defines
Directive
Default value
Can be redefined
TEXTLIST_MAX_ITEMS 30 yes
TEXTLIST_MAX_ITEMS_ON_LIST 10 yes
TEXTLIST_MAX_ITEM_NAME 32 no
TEXTLIST_MAX_FUNCTION_NAME 31 no
TEXTLIST_MAX_BUTTON_NAME 12 no

Usage
The system provides the ability to create a function to open TextList, this is useful when multiple calls one list (mostly used when creating nested menus):
PHP Code:
TextListCreate:example_tl(playerid)
{
    new 
items[][TEXTLIST_MAX_ITEM_NAME] = {
        
"Test 1",
        
"Big Test 2"
    
};

    new 
bg_colors[TEXTLIST_MAX_ITEMS] = {
        
0xFF0000FF,
        
0x00FF00FF
    
};

    
TextList_Open(playeridTextList:example_tlitemssizeof(items),
                  
"Example header",
                  
"Button 1""Button 2",
                  .
lists_bg_color bg_colors);
}

TextListResponse:example_tl(playeridTextListType:responseitemiditemvalue[])
{
    new 
string[128];
    
format(stringsizeof(string), " %d | %d | %d | %s"playerid_:responseitemiditemvalue);
    
SendClientMessage(playerid, -1string);
    return 
1;

And you should use TextList_Show for opening created TextList:
PHP Code:
TextList_Show(playeridTextList:example_tl); 
Of course you can not use the system, you can do everything without TextListCreate.

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

Last edited by ZiGGi; 24/12/2016 at 07:12 PM.
ZiGGi is offline   Reply With Quote
Old 27/11/2016, 02:45 PM   #2
JustMe.77
Huge Clucker
 
JustMe.77's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 215
Reputation: 65
Default Re: TextList - Text Draw list system.

Beautiful and excellent work!
JustMe.77 is offline   Reply With Quote
Old 27/11/2016, 03:32 PM   #3
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,885
Reputation: 1337
Default Re: TextList - Text Draw list system.

I like it but I don't like it let me explain it looks good the code is good but where it falls short is the whole project sidesteps the big picture of a rich GUI system.
Pottus is offline   Reply With Quote
Old 10/02/2019, 07:05 PM   #4
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 598
Reputation: 69
Default Re: TextList - Text Draw list system.

Is there any way to create a list dynamically? Like populate the list items based on a mysql query. AFAIK, it looks like it can only be populated statically, in its own function. Basically using this as a more appealing replacement for a dialog textlist.
__________________
Chaprnks is offline   Reply With Quote
Old 10/02/2019, 07:23 PM   #5
Logic_
Banned
 
Join Date: Jun 2015
Posts: 1,506
Reputation: 305
Default Re: TextList - Text Draw list system.

Modify it to work with pawn memory plugin.
Logic_ is offline   Reply With Quote
Old 10/02/2019, 08:36 PM   #6
Variable™
Gangsta
 
Variable™'s Avatar
 
Join Date: Jul 2015
Posts: 829
Reputation: 200
Default Re: TextList - Text Draw list system.

Quote:
Originally Posted by Chaprnks View Post
Is there any way to create a list dynamically? Like populate the list items based on a mysql query. AFAIK, it looks like it can only be populated statically, in its own function. Basically using this as a more appealing replacement for a dialog textlist.
You can create an array and story the query result in it then show the list.
__________________
Need a game server? Contact me for information.
Variable™ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text-Draw Help CarRamper Scripting Help 1 20/06/2016 11:52 AM
Text-draw help CarRamper Scripting Help 2 20/06/2016 02:51 AM
[Ajuda] text Draw DevilAgain Portuguęs/Portuguese 6 10/04/2013 02:38 PM
Putting Text Draw in Rank SYstem (rep++) iOmar Scripting Help 3 09/04/2012 04:42 AM


All times are GMT. The time now is 05:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.