When devs implemented GUI., textdraws have been moved to client-side scripting.
This system will no longer work, since version 04rel004, and there is really no need for it's adaptation.
Custom Menu System v2.0
Since we are able to use textdraws, sprites, custom objects, weapons etc, it's time to create great and useful things, that will make us, and our players, enjoy the game very very much !!
It's our purpose to make our servers better and better !!
I am happy to present you the first Menu System ever made for Vice City Multiplayer !
Picture 1 (https://imagizer.imageshack.us/v2/706x397q90/673/J8XuDB.png) - Picture 2 (https://imagizer.imageshack.us/v2/706x397q90/905/pKxwSM.png)
Every (sub)menu can now support up to 10 options !
Here you can find all files you need to make it work:
http://www.solidfiles.com/d/ce955da5a9/CMSS_v2_(13.03.2015).rar
Click here (http://pastebin.com/4rzegiJp) to see the source code of S_CMS_v2.nut, without downloading !
Also, here is the source of what you need to add in your main.nut ! (http://pastebin.com/eR214FPw)
I strongly suggest you to create menus and submenus onServerStart/onScriptLoad !!Why ? Because you need to keep the evidence of the id of the menu you want to use, so you will not damage any other menu.
Description: Custom Menu System by Seby ( aka CMSS ) is a system that gives scripters the ability to create their own INTERACTIVE MENU,
up to 10 options, but every option can also have a submenu (with another 10 options) !!
Version 2.0 works a lot different than v1.0: -Now there are 9 sprites, created when the script is loaded. We only show them when needed.
-The textdraws are all created right in the moment of accessing the menu, but don't worry, it will not reach the VC:MP limit (256) that fast, because it works in this way: when a player X wants to see a menu that is also shown for player Y, the textdraws will be just shown to X, not re-created ! So the textdraws will be removed only when there will be no viewer.
-No more double textdraws. ( 2 textdraws were used for one option, in v1.0 - one grey, one white )
-To avoid the bugs, a player that is watching a menu and leave the server or just get killed without closing it, everything related to menus will be instantly canceled for him. ( menuRageQuit( player ) )
-You are now able to set the title of a submenu. (not like before, where the titles were auto-set)
-No need to manually hide the main menu, when you want to show the submenu ! Just use "menuInstance.ShowSubmenu( player, 5 )" and it will do everything for you. Same goes for HideSubmenu function.
And maybe more, but I don't remember right now... but take a look at the script, and you will understand. :)
I made it as understable as I could. The single thing that stays the same as in v1.0, is the way we save menus' instance: " menu[ ID ] "
So, when you want to add a submenu for that menu, you will do like this:
menu[3].AddSubmenu( 3, "/Option 3 - blabla", "option 1", "option 2", ... )
Keys used to interact with the menu, used in my example, are: UP_ARROW, DOWN_ARROW, SPACEBAR (select), BACKSPACE (back)
I hope I didn't miss anything important.
Here is the list with the new functions'n'events: Menu functions: - CreateMenu( title, option1, option2, ... )
- menuRageQuit( player )
- menuRageQuitAll( )
- menuInstance.ShowMenu( player )
- menuInstance.HideMenu( player )
- menuInstance.AddSubmenu( optionID of mainmenu, title, option1, option2, ... )
- menuInstance.ShowSubmenu( player, option )
- menuInstance.HideSubmenu( player, option )
Menu events: - onPlayerEnterMenu( player, menuID )
- onPlayerExitMenu( player, menuID )
- onPlayerSwitchOptionsInMenu( player, menuID, oldOption, newOption )
- onPlayerSelectInMenu( player, menuID, option )
Submenu events: - onPlayerEnterSubmenu( player, menuID, submenuID )
- onPlayerExitSubmenu( player, menuID, submenuID )
- onPlayerSwitchOptionsInSubmenu( player, menuID, submenuID, oldOption, newOption )
- onPlayerSelectInSubmenu( player, menuID, submenuID, option )
CreditsScripter: SebySpecial thanks goes to those guys because I learnt important squirrel stuff from them:heekz - he teached me how to create class
Knucis - told me about vargv, and how to use them
Gudio - for supporting me in this whole time (he knows what I mean :D), finding the problem when I thought there is no fix for it and teaching me squirrel important stuff.
I suggest you put this code on git. Such as bitbucket and github etc.
Quote from: ysc3839 on Feb 25, 2015, 04:04 AMI suggest you put this code on git. Such as bitbucket and github etc.
I'm not that used to these gits, and I don't believe I really want to start using them now.
If you want to see the code, just take a look here (http://pastebin.com/z0yvxfvj).
Quote from: Beztone on Feb 25, 2015, 05:29 AMWow awesome Dude i was waiting for this :D
Now I am the one waiting to see what will you do with it. :P
Thanks its very nice. :)