Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: EK.IceFlake on Nov 11, 2016, 10:46 AM

Title: Flakes Menu System [rel004]
Post by: EK.IceFlake on Nov 11, 2016, 10:46 AM
Hi :D
As part of a scripting job, I had to make a menu system for a server.
It looks|behaves similar to seby's CMS.
Here is a screenshot
(https://i37.servimg.com/u/f37/18/45/45/23/menusy10.jpg)
To use it, you have to learn a few functions
CSMenu
This is a class that you will need to use in order to initialize an instance of a menu.
Format:
CSMenu(string sTitle)
TestMenu1 <- CSMenu("Test Menu 1");All further references to CSMenu are an instance of a created menu.
CSMenuItem CSMenu.CreateItem(string sItemName)
This will return a CSMenuItem which you can use to bind select and hover functions.
CSMenuItem CSMenuItem.Bind(function hFunction (player))
CSMenuItem CSMenuItem.BindHover(function hFunction (player))
Example:
    TestMenu1.CreateItem("TM1 Option 1").Bind(function(player)
    {
        ::MessagePlayer("You have selected TestMenu1 option 1", player);
    }).BindHover(function(player)
    {
        ::MessagePlayer("You have hovered over TestMenu1 option 1", player);
    });
The example looks familiar, doesn't it? @KAKAN :D

CSMenu.Show(player hPlayer)
This will show a menu to a player
function onPlayerCommand(player, command, parameters)
{
    TestMenu1.Show(player);
}

You can download the source including the example file here: https://mirror.cloudwards.es/FMS.7z https://elitekillerz.net/mirror/FMS.7z

Please note that you may need to adjust the client side script to integrate with yours.
This is released under the copyleft CLNS, a copy of which can be found in /store/script/License.txt
Title: Re: Flakes Menu System [rel004]
Post by: Sebastian on Nov 11, 2016, 12:18 PM
Using GUI for a menu. Great !
But, I would do some changes to the background: should be more round than squarish, and more transparent
( I find the square background kinda ugly now, but that's only my opinion )
Title: Re: Flakes Menu System [rel004]
Post by: EK.IceFlake on Nov 11, 2016, 12:23 PM
Quote from: sseebbyy on Nov 11, 2016, 12:18 PMUsing GUI for a menu. Great !
But, I would do some changes to the background: should be more round than squarish, and more transparent
( I find the square background kinda ugly now, but that's only my opinion )
It was more transparent, however it didn't look very nice that way. Anyways you only need to change a single line to change the transparency.

This is a GUIWindow which means that we can't round the edges + square edges seem more modern IMO
Title: Re: Flakes Menu System [rel004]
Post by: KAKAN on Nov 11, 2016, 01:06 PM
Quote from: EK.CrystalBlue on Nov 11, 2016, 12:23 PMThis is a GUIWindow which means that we can't round the edges + square edges seem more modern IMO
I still like round ones though ;p
Title: Re: Flakes Menu System [rel004]
Post by: Xmair on Nov 11, 2016, 01:15 PM
Use GUISprite.
Title: Re: Flakes Menu System [rel004]
Post by: EK.IceFlake on Nov 11, 2016, 01:22 PM
Quote from: Xmair on Nov 11, 2016, 01:15 PMUse GUISprite.
I don't think GUISprite.AddChild would work and anyways you can convert it if you want if it would work. I'd prefer it square edged.
Title: Re: Flakes Menu System [rel004]
Post by: Sebastian on Nov 11, 2016, 02:49 PM
Quote from: KAKAN on Nov 11, 2016, 01:06 PM
Quote from: EK.CrystalBlue on Nov 11, 2016, 12:23 PMThis is a GUIWindow which means that we can't round the edges + square edges seem more modern IMO
I still like round ones though ;p

It kinda fits more to the game
Title: Re: Flakes Menu System [rel004]
Post by: EK.IceFlake on Nov 19, 2016, 09:48 AM
Squirrels object oriented engine isn't working properly, link updated with a workaround.
Title: Re: Flakes Menu System [rel004]
Post by: EK.IceFlake on Jun 03, 2017, 02:30 PM
A problem with .Parent has been solved. I had solved it on my PC but didn't upload it and it got combined with an unrelated system (intentionally). Thanks to @sseebbyy for cleaning that up.
Title: Re: Flakes Menu System [rel004]
Post by: D.VICTOR on Oct 06, 2018, 12:28 AM
esta quebrada el link!!!
Title: Re: Flakes Menu System [rel004]
Post by: EK.IceFlake on Oct 06, 2018, 07:08 AM
Quote from: D.VICTOR on Oct 06, 2018, 12:28 AMesta quebrada el link!!!
Fixed.

I don't recommend using this menu.