Привет! Я пытаюсь создать команду /description для игроков RP. Команда должна создать 3DText с описанием персонажа, у меня что-то не работает. Я нович
C#:
JS:
C#:
C++:
[Command("opis")]
public static void CMD_opis(ExtPlayer player, string description)
{
try
{
// Check if the player provided a character description.
if (string.IsNullOrWhiteSpace(description))
{
player.SendChatMessage("Użycie: /opis [Your Description]");
return;
}
player.SetData("CharacterDescription", description);
player.TriggerEvent("updateCharacterDescription");
player.SendChatMessage("Your descrition has been updated to: " + description);
}
catch (Exception e)
{
Log.Write($"CMD_opis Exception: {e.ToString()}");
}
}
JS:
JavaScript:
mp.events.add('updateCharacterDescription', () => {
mp.players.forEachInRange(mp.players.local.position, 10, (otherPlayer) => {
if (otherPlayer.characterDescription) {
let description = otherPlayer.characterDescription;
let position = otherPlayer.position;
position.z += POSITION_OFFSET - 0.5;
mp.game.graphics.drawText(description, [position.x, position.y, position.z], {
font: DESCRIPTION_FONT,
color: [255, 255, 255, 255], // Biały kolor tekstu (możesz dostosować)
scale: [DESCRIPTION_SCALE, DESCRIPTION_SCALE],
centre: true,
outline: false,
});
}
});
});