Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: ShaKur on Apr 18, 2020, 08:12 PM

Title: Menu Selector
Post by: ShaKur on Apr 18, 2020, 08:12 PM
Can I create a menu selector after the player registers or logs in?

How can I create and what should I use to do it?

Thanks
Title: Re: Menu Selector
Post by: habi on Apr 18, 2020, 08:22 PM
Dominio,, GUI s are scripted separately ( it's called client side scripting).
https://forum.vc-mp.org/?topic=4585
Title: Re: Menu Selector
Post by: ShaKur on Apr 20, 2020, 01:57 AM
@habi You are not understanding me very well, I do not need a GUi editor to create almost non-functional scripts, what I need to know is how to get a background image that covers the entire screen, this image is a type of "mode selector menu "I mean that it contains the menus and I have to choose a game mode, now if ... How can I do that?

Thank you
Title: Re: Menu Selector
Post by: habi on Apr 20, 2020, 05:04 AM
Domino, i am not good at client side menus, labels, buttons. But still i am confused.   Are you trying to create something like this.
(https://i.imgur.com/5LK57VE.png)
Title: Re: Menu Selector
Post by: Sebastian on Apr 20, 2020, 07:04 AM
Quote from: Dominio on Apr 20, 2020, 01:57 AM@habi You are not understanding me very well

Maybe if you were trying to elaborate it more from the beggining,  like you did in the last reply,  he would've understand it.  :-X

As for your question,  your best shot are buttons.
So this is what I would do: create a sprite,  with pos VectorScreen( 0, 0),  setting the size of the resolution of player.  (You can get that by some function I don't remember now)
Then create 2-3 buttons (asccording to your needs)  which you name:
1. Deathmatch
2. Racing
3. Drifting

Then you use the event that is called when player clicks on a button,  to send data from client to server,  and actually do something: teleporting player,  give him weps/cars etc.

There are examples of gui s around the forum,  so you have no excuse to not try it by yourself.
Then,  when you face errors you can ask for help.
Title: Re: Menu Selector
Post by: ShaKur on Apr 20, 2020, 09:02 PM
Quote from: habi on Apr 20, 2020, 05:04 AMDomino, i am not good at client side menus, labels, buttons. But still i am confused.   Are you trying to create something like this.
(https://i.imgur.com/5LK57VE.png)

exactly i mean something like this
Title: Re: Menu Selector
Post by: ShaKur on Apr 20, 2020, 09:05 PM
Quote from: Sebastian on Apr 20, 2020, 07:04 AM
Quote from: Dominio on Apr 20, 2020, 01:57 AM@habi You are not understanding me very well

Maybe if you were trying to elaborate it more from the beggining,  like you did in the last reply,  he would've understand it.  :-X

As for your question,  your best shot are buttons.
So this is what I would do: create a sprite,  with pos VectorScreen( 0, 0),  setting the size of the resolution of player.  (You can get that by some function I don't remember now)
Then create 2-3 buttons (asccording to your needs)  which you name:
1. Deathmatch
2. Racing
3. Drifting

Then you use the event that is called when player clicks on a button,  to send data from client to server,  and actually do something: teleporting player,  give him weps/cars etc.

There are examples of gui s around the forum,  so you have no excuse to not try it by yourself.
Then,  when you face errors you can ask for help.

thanks, one last question regarding this, should i have any other .nut that is the game mode? for example rpg.nut, dm.nut, drifting.nut [/ code]
Title: Re: Menu Selector
Post by: Sebastian on Apr 20, 2020, 11:10 PM
Quote from: Dominio on Apr 20, 2020, 09:05 PMthanks, one last question regarding this, should i have any other .nut that is the game mode? for example rpg.nut, dm.nut, drifting.nut [/ code]

It is not a requirment to have your script splitted in more .nut files.
Server loads only one .nut file, then, if you want, execute more files from that one, using commands like dofile( location and file name.nut ).
(example: dofile( "scripts/drifting.nut") )
Title: Re: Menu Selector
Post by: DizzasTeR on Apr 21, 2020, 06:58 AM
Do note that you can't have vcmp events defined in multiple files, that won't work, if dm.nut has onPlayerJoin, then it won't work if you have it in rpg.nut as well or any other file
Title: Re: Menu Selector
Post by: ShaKur on Apr 30, 2020, 06:34 PM
So what should I do to make the game modes work correctly? (Without repeating the functions or events in each .nut)

Title: Re: Menu Selector
Post by: habi on May 01, 2020, 11:08 AM
deathmatch.nut
roleplay.nut
drifting.nut
........
if gamemode==deathmatch
   dofile deathmatch.nut

if gamemode==roleplay
   dofile roleplay.nut

......
Title: Re: Menu Selector
Post by: ShaKur on May 08, 2020, 11:30 PM
Thanks.

PD: You've Discord?
Title: Re: Menu Selector
Post by: habi on May 09, 2020, 07:50 AM
Quote from: Dominio on May 08, 2020, 11:30 PMThanks.

PD: You've Discord?
I'll PM you