FridgePirate
FridgePirate
CC#
Created by FridgePirate on 8/3/2023 in #help
❔ How can I read data from file called lang.json
C#
using System;
using System.Collections.Generic;
using CitizenFX.Core;
using Newtonsoft.Json;
using static CitizenFX.Core.Native.API;

namespace QBCore_family
{
public class FamilyServer : BaseScript
{
public FamilyServer()
{
RegisterCommand("setmother", new Action<int, List<object>, string>(SetMotherCommand), false);
}

private void SetMotherCommand(int source, List<object> args, string raw)
{
TriggerClientEvent("chat:addMessage", new
{
color = new[] { 255, 0, 0 },
args = new[] { "[CarSpawner]", "Heller!" }
});

}
}
}
C#
using System;
using System.Collections.Generic;
using CitizenFX.Core;
using Newtonsoft.Json;
using static CitizenFX.Core.Native.API;

namespace QBCore_family
{
public class FamilyServer : BaseScript
{
public FamilyServer()
{
RegisterCommand("setmother", new Action<int, List<object>, string>(SetMotherCommand), false);
}

private void SetMotherCommand(int source, List<object> args, string raw)
{
TriggerClientEvent("chat:addMessage", new
{
color = new[] { 255, 0, 0 },
args = new[] { "[CarSpawner]", "Heller!" }
});

}
}
}
I want to replace "Heller!" with "welcome" from:
Config = {}

Config.defaultlocale = "en" // default locale

Config.Locale = {
"en": {
"welcome": "Welcome to the server!",
"farewell": "Goodbye, see you later!",
"player_join": "{player} has joined the server."
},
"es": {
"welcome": "¡Bienvenido al servidor!",
"farewell": "¡Adiós, hasta luego!",
"player_join": "{player} se ha unido al servidor."
}
}
Config = {}

Config.defaultlocale = "en" // default locale

Config.Locale = {
"en": {
"welcome": "Welcome to the server!",
"farewell": "Goodbye, see you later!",
"player_join": "{player} has joined the server."
},
"es": {
"welcome": "¡Bienvenido al servidor!",
"farewell": "¡Adiós, hasta luego!",
"player_join": "{player} se ha unido al servidor."
}
}
7 replies