Custom Menu System v1.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 !
It supports one submenu for every option shown in the main menu !
Here is the whole code you need:
I have made an example of menu, with submenus:Add this to onScriptLoad
CreateMenu("Menu System","Option1","Option2","Option3","Option4","Option5","Option6","Option7","Option8");Then you create a command like this, to show you the menu:
menu.AddSubMenu(8,"You","cannot","add","just","one","option !","The reason","is very logic.");
if(cmd == "showfirstmenu")
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.You can walk between options using UP and DOWN ARROWS, and when you choosed one, press SPACEBAR ! (just like in San Andreas)
When you think you don't need the custom menu anymore, press BACKSPACE, and it will be hidden again.
Every textdraw and sprite that is created by functions like CreateMenu and menu[menuid].AddSubMenu, is actually permanently on server, and them are shown just when needs to be.
That's why I suggest you to use it only in onServerStart/onScriptLoad.other note:
There are two events that are called when you select an option or a suboption.
(the events were added in the pastebin, but just forgot to give details about it)
This is called when a player choose an option from the main menu, that has no submenu:
onPlayerMenu(player, menuid, option)
menuid - the ID of the main menu. (the first menu created has ID 0)
option - option ID choosed by the player. (the first option from the menu has ID 1)
This is called when a player choose an option from a submenu of an option choosed in the main menu:
onPlayerSubMenu(player, submenuid, option)
submenuid - submenu ID - the option choosed in the main menu
option - ID of the option choosed in the submenuHere is an example for every event:http://pastebin.com/QSBJLhrFAnd from here, you can download a .nut file with all you need to run the menu system, + the sprite you need:http://www.solidfiles.com/d/c349cb0c34/Menu_System_by_Seby.rarhttp://www.solidfiles.com/d/6cc4f83f60/menubackground.png
CreditsScripter: SebySpecial thanks goes to those guys because I learnt important squirrel stuff from them:heekz - he teached me how to create classKnucis - told me about vargv, and how to use themGudio - for supporting me in this whole time (he knows what I mean ), finding the problem when I thought there is no fix for it and teaching me squirrel important stuff.