SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/05/2012, 03:37 PM   #1
SDraw
Gangsta
 
SDraw's Avatar
 
Join Date: Apr 2011
Location: Russia
Posts: 663
Reputation: 148
Default 3DMenu

3DMenu

This include allows you to create new type of menu instead of standart menus or dialogs.
  • Creating of menu for each player.
  • Custom rotaion for menu.
  • Setting params for every box like for object.
  • Auto-calculatting of new lines and box position.
  • Limits: MAX_PLAYERS menus and manual limited boxes (default is 16).

What you can do with this include

This include was made for selecting skins/vehicles. You can use it in anything else.


Changelog

- Added "playerid" and "rotation" params in Create3DMenu().
- Box limit is increased to 16.
- IDs of created boxes was changed. Now ID increases from up to down. Added OnPlayerChange3DMenuBox(playerid,MenuID,boxid) callback. Added FS to demonstrate functional.
- Removed param MenuID from CancelSelect3DMenu. Increased limit of menu - 1024.
- Updated fake natives. Forgot to remove MenuID from CancelSelect3DMenu.
- Now boxes move slowly! ^_^
- 2 different background colors for boxes (when selected and unselected)
- Some change in algorithm.
- Manual changed value of maximum boxes.
- Removed y_hook (due recursion in stack size and run-time error), fixed bug when player disconnected but he was selecting menu.

Requirements

- 0.3e or upper server
- Incognito's Streamer (0.3e and upper)

Functions
  • Create3DMenu(Float: x,Float:y,Float:z,Float:rotation,boxes,playerid);
    • Creating 3DMenu in position with number of boxes for player.
      Note #1: Rotation should be equal from 0 to 360. Bigger or lower values will make menu works wrong.
      Note #2: This function returns ID of created menu.
      Note #3: Only for connected players.
  • SetBoxText(MenuID,box,text[],materialsize,fontface[],fontsize,bold,fontcolor,selectcolor,unselectcolor ,textalignment);
    • Set box text, like object material text.
      Note #1: This function looks like SetObjectMaterialText.
      Note #2: If you set wrong box ID or menu ID, function will return -1.
      Note #3: selectcolour - background of box when it is choosen. unselectcolor - if not.[/I][/B].
  • Select3DMenu(playerid,MenuID);
    • Start player select menu. Keys - box change: Y,N ; select - Space.
      Note #1: This function will return -1 if you set invalid menu ID.
  • CancelSelect3DMenu(playerid);
    • Cancel player's selecting of menu.
      Note #1: This function will return -1 if player isn't choosing any menu.
  • Destroy3DMenu(MenuID);
    • Destroying of menu.
      Note #1: If any player chooses menu with current ID, function CancelSelect3DMenu will be called automatically.
      Note #2: This function will return -1 if menu doesn't exist.

Callbacks
  • OnPlayerChange3DMenuBox(playerid,MenuID,boxid);
    • This callback is called when player presses Y or N on selecting.
      Note #1: Param boxid is equal ID of new choosen box.
  • OnPlayerSelect3DMenuBox(playerid,MenuID,boxid);
    • This callback is called when player presses Space on selecting.
      Note #1: Param boxid is equal ID of selected box.

Author
SDraw

Download
GitHub: 3DMenu.

Thanks to

- TheArcher for fake natives and check for defined FILTERSCRIPT.
- iPleomax for video with idea.
- Incognito for Streamer (and thread style ).
__________________
I leave SAMP. It's not perspective anymore.

Last edited by SDraw; 14/07/2013 at 03:52 PM.
SDraw is offline   Reply With Quote
Old 09/05/2012, 03:40 PM   #2
HeLiOn_PrImE
Gangsta
 
HeLiOn_PrImE's Avatar
 
Join Date: Jul 2010
Location: Inside your head
Posts: 769
Reputation: 52
Default Re: 3DMenu

That is really nice....
__________________

My releases:
[FilterScript]Car Tuning Menu v. 2.2
[Map] Blake Island
[Map] Paul Walker Memorial
HeLiOn_PrImE is offline   Reply With Quote
Old 09/05/2012, 03:41 PM   #3
TheDominator
Gangsta
 
Join Date: Feb 2012
Location: United Kingdom
Posts: 519
Reputation: 53
Default Re: 3DMenu

Woah looks very nice, but you could try to improve the image.
__________________


I don't care who or what you are, you show respect to me and I'll respect you back, simple.
TheDominator is offline   Reply With Quote
Old 09/05/2012, 03:45 PM   #4
TzAkS.
Gangsta
 
TzAkS.'s Avatar
 
Join Date: Mar 2012
Location: Greece
Posts: 571
Reputation: 66
Default Re: 3DMenu

Its look great
TzAkS. is offline   Reply With Quote
Old 09/05/2012, 04:28 PM   #5
(SC)=Sky=
Big Clucker
 
Join Date: Apr 2012
Posts: 92
Reputation: 29
Default Re: 3DMenu

Coool good job!
__________________


New Community is open! GFX-Zone
(SC)=Sky= is offline   Reply With Quote
Old 09/05/2012, 04:48 PM   #6
Mr.Fames
Huge Clucker
 
Join Date: Oct 2011
Posts: 350
Reputation: 24
Default Re: 3DMenu

It looks great man really wonderful job.
Mr.Fames is offline   Reply With Quote
Old 09/05/2012, 04:51 PM   #7
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: 3DMenu

Nice work. Will surely use it or will make similar to this. Thanks. Rep +5 Added
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.


Last edited by Ballu Miaa; 14/05/2012 at 12:49 PM.
Ballu Miaa is offline   Reply With Quote
Old 09/05/2012, 06:13 PM   #8
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,517
Reputation: 233
Default Re: 3DMenu

Pretty cool. But this was iPleomax's idea. , good job though and thanks for share

Edit:

You could do

pawn Code:
#if defined FILTERSCRIPT
hook OnFilterScriptInit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SelectedMenu[i] = -1;
        SelectedBox[i] = -1;
    }
    for(new i = 0; i < MAX_MENUS; i++)
    {
        for(new b = 0; b < 4; b++) MenuObjects[i][b] = INVALID_OBJECT_ID;
        MenuIsExist[i] = false;
        MenuBoxes[i] = 0;
    }
}
hook OnFilterScriptExit()
{
    for(new i = 0; i < MAX_MENUS; i++)
    {
        if(MenuIsExist[i]) Destroy3DMenu(i);
    }
}
#else
hook OnGameModeInit()
{
    for(new i = 0; i < MAX_MENUS; i++)
    {
        for(new b = 0; b < 4; b++) MenuObjects[i][b] = INVALID_OBJECT_ID;
        MenuBoxes[i] = 0;
        MenuIsExist[i] = false;
    }
}
hook OnGameModeExit()
{
    for(new i = 0; i < MAX_MENUS; i++)
    {
        if(MenuIsExist[i]) Destroy3DMenu(i);
    }
}
#endif

A better method to check before hooking.
__________________
TheArcher is offline   Reply With Quote
Old 09/05/2012, 06:20 PM   #9
SDraw
Gangsta
 
SDraw's Avatar
 
Join Date: Apr 2011
Location: Russia
Posts: 663
Reputation: 148
Default Re: 3DMenu

Yes, I saw the video of iPleomax...But it's not my fault that I released it early...
__________________
I leave SAMP. It's not perspective anymore.
SDraw is offline   Reply With Quote
Old 10/05/2012, 12:12 AM   #10
Cacoby
Huge Clucker
 
Cacoby's Avatar
 
Join Date: Jul 2010
Posts: 222
Reputation: 0
Smile Respuesta: 3DMenu

Please, make a example code, like this image, sorry for my bad english :S
Cacoby 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



All times are GMT. The time now is 02:31 AM.


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