C#:
using System;
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("MyPosi", "DeutscherRitterPlatz", "1.0.0")]
class MyPosi : RustPlugin
{
private void Init()
{
permission.RegisterPermission("myposi.use", this);
}
[ChatCommand("myposi")]
private void GetPosition(BasePlayer player, string command, string[] args)
{
if (!permission.UserHasPermission(player.UserIDString, "myposi.use"))
{
string PermMessage = $"{GetMsg("NoPermission", player.UserIDString)}";
SendReply(player, PermMessage);
return;
}
Vector3 position = player.transform.position;
float x = (float)Math.Round(position.x, 2);
float y = (float)Math.Round(position.y, 2);
float z = (float)Math.Round(position.z, 2);
string positionMessage = $"{GetMsg("Position", player.UserIDString)} X: <color=#AE3624>{x}</color>, Y: <color=#AE3624>{y}</color>, Z: <color=#AE3624>{z}</color>";
SendReply(player, positionMessage);
}
//private string GetMsg(string key, string userId) => lang.GetMessage(key, this, userId);
private string GetMsg(string key, string userId)
{
string pluginPrefix = lang.GetMessage("PluginPrefix", this, userId);
string message = lang.GetMessage(key, this, userId);
return $"{pluginPrefix}\n{message}";
}
protected override void LoadDefaultMessages()
{
lang.RegisterMessages(new Dictionary<string, string>
{
["NoPermission"] = "You do not have permission to use this command!",
["Position"] = "You posi is: ",
["PluginPrefix"] = "<size=16><color=#AE3624>MY</color> <color=#738D45>POSI</color></size>",
}, this);
lang.RegisterMessages(new Dictionary<string, string>
{
["NoPermission"] = "Du hast keine Berechtigung, diesen Befehl zu verwenden!",
["Position"] = "Deine Position ist: ",
["PluginPrefix"] = "<size=16><color=#AE3624>MY</color> <color=#738D45>POSI</color></size>",
}, this, "de");
}
}
}