Vice City: Multiplayer

Server Development => Scripting and Server Management => Script Showroom => Topic started by: Yuriitwo on Aug 04, 2023, 12:38 AM

Title: Multi-Language System
Post by: Yuriitwo on Aug 04, 2023, 12:38 AM
Multi-Language System


Welcome to the Multi-Language System! This is a project that allows you to add 3 languages, but you can implement more languages by adding base functions. In this example, the available languages are Portuguese, English, and Spanish. This system was developed with the assistance of (LBR)Diego^.



Installation

Follow the steps below to set up the Multi-Language System on your server:

About the system

This is a multi-language system designed to handle different messages for players in their preferred language. The system uses an array called Language to keep track of the language chosen by each player.


Overall, this system allows you to manage and deliver messages in different languages based on each player's preferences. By calling the appropriate functions, you can send messages to individual players, all players, or all players except a specific one, in their chosen language.
Title: Re: Multi-Language System
Post by: Ridwan Rz on Aug 04, 2023, 03:08 AM
Thanks for the language system yuriitwo,  I was about to ask you about this on DC. :DD
Title: Re: Multi-Language System
Post by: Yuriitwo on Aug 04, 2023, 03:40 AM
Quote from: Ridwan Rz on Aug 04, 2023, 03:08 AMThanks for the language system yuriitwo,  I was about to ask you about this on DC. :DD

You're welcome, my friend. I just want to contribute in some way.
Title: Re: Multi-Language System
Post by: habi on Aug 04, 2023, 06:55 AM
Good system.
You could replace the original msg function also this way:
MessagePlayer("Bem-vindo", "Welcome", "Bienvenido", player );

local msgplayer = MessagePlayer
rawset("MessagePlayer", function (...){
switch(vargv.len())
{
case 2: return msgplayer(vargv[0], vargv[1] );break;

case 4: return msgplayer(getMsgByLanguage(vargv[0], vargv[1], vargv[2], vargv[3]), vargv[3] );

default: throw("Invalid no:of parameters");
}
});
Title: Re: Multi-Language System
Post by: Yuriitwo on Aug 04, 2023, 08:59 AM
Quote from: habi on Aug 04, 2023, 06:55 AMGood system.
You could replace the original msg function also this way:
MessagePlayer("Bem-vindo", "Welcome", "Bienvenido", player );

local msgplayer = MessagePlayer
rawset("MessagePlayer", function (...){
switch(vargv.len())
{
case 2: return msgplayer(vargv[0], vargv[1] );break;

case 4: return msgplayer(getMsgByLanguage(vargv[0], vargv[1], vargv[2], vargv[3]), vargv[3] );

default: throw("Invalid no:of parameters");
}
});

Thanks for the tip, I didn't think of that at the time lol
Title: Re: Multi-Language System
Post by: H.a.S.a.N on Aug 09, 2023, 04:34 PM
Amazing work brother  :)
Title: Re: Multi-Language System
Post by: 2b2ttianxiu on Aug 11, 2023, 01:24 AM
but, why use the nut code made it? u can try custom file. belike:

en-us.lang:

hello-world=hello world

zh-cn.lang:

hello-world=你好,世界
Title: Re: Multi-Language System
Post by: Yuriitwo on Aug 20, 2023, 02:15 AM
Quote from: 2b2ttianxiu on Aug 11, 2023, 01:24 AMbut, why use the nut code made it? u can try custom file. belike:

en-us.lang:

hello-world=hello world

zh-cn.lang:

hello-world=你好,世界

I found this way more interesting, because it is easier to implement other languages, and it is also easier to understand.
Title: Re: Multi-Language System
Post by: Yuriitwo on Aug 20, 2023, 02:15 AM
Quote from: H.a.S.a.N on Aug 09, 2023, 04:34 PMAmazing work brother  :)

Thanks