GTA Online styled textdraw menus (Not the screens, but the download) -
RajatPawar - 26.10.2013
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:
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.
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
BodyBoardVEVO - 26.10.2013
Very well done, amazing!
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
coool - 26.10.2013
Awesome system. Good luck
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
[D]ry[D]esert - 26.10.2013
This is very Useful, Thanks for sharing mate.
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
Scrillex - 26.10.2013
Awesome mate.. I really like it...
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
RajatPawar - 26.10.2013
Quote:
Originally Posted by BodyBoardVEVO
Very well done, amazing!
|
Quote:
Originally Posted by coool
Awesome system. Good luck
|
Quote:
Originally Posted by [D]ry[D]esert
This is very Useful, Thanks for sharing mate.
|
Quote:
Originally Posted by Scrillex
Awesome mate.. I really like it...
|
Thanks a lot, I'd really like if it some one actually uses it
Let me know if the clicking works, because I have no way of knowing that. Cheers!
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
RajatPawar - 27.10.2013
In a way, sly - ly bumping this, has anyone actually used this and checked if the clicking works? Thanks!
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
Mckarlis - 27.10.2013
awesome job
+REP
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
Twizted - 27.10.2013
Jesus fucking Christ, you're a life saver. I wanted to do this for my concept on SA:MP, and you came right ontime. I love you.
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
DuongNghia - 27.10.2013
Good job ! + REP
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
Tropicali - 27.10.2013
It looks pretty decent. Thanks for sharing this with us!
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
Kar - 27.10.2013
how much textdraws... lol
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
RajatPawar - 27.10.2013
Quote:
Originally Posted by Kar
how much textdraws... lol
|
69 or something. I did a stupid mistake in a creating the boxes and the texts differently because of another idea, which didn't work out, couldn't redo it, too much PITA.. Why not use the resources given!
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
AfikAtashga - 02.11.2013
Can u fix the download?
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
skydux123 - 07.11.2013
Link doesen't work
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
radiobizza - 13.01.2014
Put the download link again.. please
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
LeGGGeNNdA - 13.01.2014
Its cool, good job
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
amirab - 14.01.2014
Please Give Use New Download Link
Re: GTA Online styled textdraw menus (Not the screens, but the download) -
nhunor58 - 14.01.2014
Awesome
Re : GTA Online styled textdraw menus (Not the screens, but the download) -
DexX39 - 14.01.2014
Link please