[FilterScript] GTA Online styled textdraw menus (Not the screens, but the download)
#1

GTA: Online styled textdraw menu!
Here is the screenshot topic: https://sampforum.blast.hk/showthread.php?tid=468583

Introduction:

This was a menu made by me for a friend - unfortunately the server he's trying to make isn't even started yet and I'd rather release it than see it taking up valuable KBs. (Joking)

What's with the GTA Online thing?

This is kind of a copy of the menus you see in GTA: Online (GTA V MP) so. I'd say it looks atleast 60% of the original menu.

If you don't find it like the GTA: Online menu, call it a simple menu, to each, his own.

Download:

This download includes:
  • Include required for using this
  • Example filterscript for usage
  • READ-ME. Read it, really, okay?
  • Two pictures giving the layout of the menu.
Installing it is so simple, yet I've included a READ - ME.

Download link:
  • <removed>
REQUIRED STUFF:

y_hooks and sscanf2.
Download link for both these - https://sampforum.blast.hk/showthread.php?tid=321092

Functions:

There's just three functions and ONE callback to use.

Functions:
pawn Code:
native gtaV_CreateMenu(const MENU_ID, first_col_rows, sec_col_rows, third_col_rows, const title[], const description[], const first_col_title[], const sec_col_title[], const third_col_title[], bool: use_image, bool: use_model_preview);
/*
Parameters:
MENU_ID = the ID of the menu you want to create (use defines or global variables)
first_col_rows  = the number of rows you want to show in the first column.
sec_col_rows  = the number of rows you want to show in the sec column.
third_col_rows  = the number of rows you want to show in the third column.
title = The title of the menu.
description = The description of the menu, appearing below the title.
first_col_title = the title of the first column, and so on.
use_image = are you using sprite for the box, or a model preview? use true if yes.
use_model_preview = if you are using a model preview, set true.

Returns:
Nothing, just 1
*/
pawn Code:
native gtaV_ShowMenuToPlayer( playerid, MENU_ID, bool: cursor_on, string[], sprite_name[30] = INVALID_SPRITE, preview_model = -1, Float: preview_model_rotX = 0.0, Float: preview_model_rotY = 0.0, Float: preview_model_rotZ = 0.0, Float: preview_model_zoom = 0.0);

/*
Parameters:
playerid - the to be showing playerid
MENU_ID - the menu_ID of the menu
cursor_on = do you want to enable the cursor?
string = Most important.
----------------------------------------------
You must use | to separate row content. If you used 2, 1, 2 rows for columns 1, 2 and 3, then you must enter stuff like (the string must be like):

"First col row 1 | Sec row col 1 | First row col 2 | First col row 3 | Sec col row 3"

It automatically detects WHERE the first column scope ends, etc. That's is, instead of 'n' number of fields of indivisual rows.
The advantage is - you can use format, you can use strcat, everything!
----------------------------------------------
sprite_name = Enter the name, like "loadsc7:loadsc7" if you set the 'use_image' to true in gtaV_CreateMenu
preview_model = Enter the modelid, like, 460, else if you set 'use_preview_model' to false, enter -1.
Rest of parameters, are meaning less if the above parameter is -1.

Returns:
Shows the menu to the player
*/
pawn Code:
native gtaV_HideMenuForPlayer( playerid );
/*
Hides the menu for the player. Has no checking, a simple hide, etc.
*/
Callback:
pawn Code:
public OnPlayerClickGVMenu( playerid, menu_id, column, row, mouse_event );
/*Parameters:
playerid - the playerid calling this callback
menu_ID - the menuID of the menu.
column - the column the player clicked. Note that columns are in human standard. So if player clicked row 1 of column 1, it would return 1, and not 0 as most scripters would expect.
row - same as above, just returns row.
mouse_event -
1) EVENT_SINGLE_CLICK (Called if player clicks the menu)
2) EVENT_DOUBLE_CLICK (Called if player clicks the same option within 600 ms)
Images:

A menu using the sprite option:



A menu using the model preview option:



Why use a dialog ID style:

Many people criticise the dialog ID style because they feel it's easy to mess up given you can mistakenly define two things as the same, or use other IDs, etc. I feel that the dialog IDs are the best implementation for this kind of system, so I'm not trying to ease your way and stuff around here. You can actually, do this, if you're really worried about reusing menu IDs.
pawn Code:
new menu_counter = 0;

stock return_nextAVAILABLE_ID()
{
     # if ( menu_counter > 50 )
        # error "Menu_counter has exceeded 50. Redefine MAX_TMENUS.
     #endif

     return (++menu_counter);
}
And then just use the stock instead of worrying. I am doubtful as to if the pre directives will work due to the constant expression error, but I'm giving an example. Thanks


IMPORTANT NOTES:
  • If you input false for BOTH the sprite AND model_preview, it automatically starts from the top, not leaving an ugly GAP!
  • Remember - | is the character for separation. Don't end the 'string' parameter with |, just leave it.
  • You can modify it as long as you like but I'm sure you won't understand a fucking thing, it's a bit complicated (the textdraw creation)
  • There are no BUGS AFAIK.
  • There may be bugs regarding the clicks. Unfortunately, my mouse doesn't work and I don't have the resources to test it, sadly. I'd gladly like it if someone does!
  • Double click and single click may be a bit buggy (contradicting my above statement?)
  • Make sure your MENU_ID doesn't exceed 50. Else you shall receive an invalid array access error or something. If you want more, redefine MAX_TMENUS. I directly use MENU_ID to access the enum, that's why.
Credits:

Rajat_Pawar (Scripting, designing, etc)
Zamaroth (His awesome text editor!)
Y_Less (SSCANF and y_hooks)
You (For downloading this shit)

Current version:

version 0.2

Example code:
How do I create the menu with sprites and stuff?
Here is an example (taken out of the FS)
pawn Code:
#define MENU_TEST 0

// EXAMPLE COMMAND
COMMAND:show_sprite_menu(playerid)
{
    gtaV_CreateMenu( MENU_TEST, 5, 3, 2, "This is my ~y~first~w~ menu.", "Welcome, player. You can use this, or not! Just leave it blank.", "Settings", "Players", "Radio", true, false);
    // 5 - no of rows in column 1
    // 3 - no of rows in column 2
    // 2 - no of rows in column 3 AFTER sprite
    // settings, player, others, are titles for columns
    // true - use image/sprite
    // false - don't use model preview
    // Create the menu here, or in OnFilterScriptInit();

    new string[500];
    format(string, sizeof(string), "Use timer? ~g~(Yes)|Use name? ~r~(No)|Use clothes? ~r~(No)|\
    ~r~You can cancel using ~r~LMB.|~l~~r~Also, cancel using /stop.|\
    ~y~Rajat_Pawar.|~p~Player_Player|~y~Player_Player_two|~b~YOUR RADIO: ~r~WCTR|You have no ~g~songs."
);
    // I know, string size 500?

    gtaV_ShowMenuToPlayer( playerid, MENU_TEST, true, string, "loadsc7:loadsc7", -1, 0.0, 0.0, 0.0, 0.0 );
    // MENU_TEST is the menu id we defined
    // true - Show cursor
    // loadsc7:loadsc7 is the sprite name.
    // -1 states that no model preview, we are using the sprite thingy
    // Then 0.0, etc, doesn't matter once model preview is -1 !
    // Show it to the player.
    return 1;
}
I use Lorenc's sprite browser for sprites. Thanks to him!

Thanks:

Thank you for reading this topic. If you haven't, please don't ask questions that have already been answered!

Thanks. Expecting suggestions, replies.

Edit - download mirror on PAGE 2/3.
Reply


Messages In This Thread
GTA Online styled textdraw menus (Not the screens, but the download) - by RajatPawar - 26.10.2013, 09:18
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by BodyBoardVEVO - 26.10.2013, 09:26
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by coool - 26.10.2013, 09:27
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by [D]ry[D]esert - 26.10.2013, 09:28
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Scrillex - 26.10.2013, 09:29
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by RajatPawar - 26.10.2013, 09:32
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by RajatPawar - 27.10.2013, 13:47
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Mckarlis - 27.10.2013, 14:05
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Twizted - 27.10.2013, 14:06
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by DuongNghia - 27.10.2013, 14:11
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Tropicali - 27.10.2013, 15:16
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Kar - 27.10.2013, 15:17
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by RajatPawar - 27.10.2013, 15:42
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by AfikAtashga - 02.11.2013, 15:12
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by skydux123 - 07.11.2013, 18:24
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by radiobizza - 13.01.2014, 17:30
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by LeGGGeNNdA - 13.01.2014, 17:35
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by amirab - 14.01.2014, 05:47
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by nhunor58 - 14.01.2014, 05:52
Re : GTA Online styled textdraw menus (Not the screens, but the download) - by DexX39 - 14.01.2014, 11:24
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by KingServerIRAN - 15.01.2014, 10:33
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by RajatPawar - 15.01.2014, 10:43
Re : GTA Online styled textdraw menus (Not the screens, but the download) - by DexX39 - 15.01.2014, 10:54
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Roy70 - 15.01.2014, 11:21
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by KingServerIRAN - 15.01.2014, 18:35
Re : GTA Online styled textdraw menus (Not the screens, but the download) - by DexX39 - 15.01.2014, 19:30
Respuesta: GTA Online styled textdraw menus (Not the screens, but the download) - by GamerJota - 19.01.2014, 23:56
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by FallweN - 20.01.2014, 00:17
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by iJumbo - 20.01.2014, 00:21
Respuesta: GTA Online styled textdraw menus (Not the screens, but the download) - by GamerJota - 20.01.2014, 00:27
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by wanted428 - 10.06.2014, 22:41
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by iRaiDeN - 11.06.2014, 10:36
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by RajatPawar - 11.06.2014, 10:39
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Naresh - 11.06.2014, 10:43
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by Jimmy0wns - 11.10.2014, 18:42
Re: GTA Online styled textdraw menus (Not the screens, but the download) - by DDR3 - 13.10.2014, 15:01

Forum Jump:


Users browsing this thread: 4 Guest(s)