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: {x}, Y: {y}, Z: {z}";
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
{
["NoPermission"] = "You do not have permission to use this command!",
["Position"] = "You posi is: ",
["PluginPrefix"] = "MY POSI",
}, this);
lang.RegisterMessages(new Dictionary
{
["NoPermission"] = "Du hast keine Berechtigung, diesen Befehl zu verwenden!",
["Position"] = "Deine Position ist: ",
["PluginPrefix"] = "MY POSI",
}, this, "de");
}
}
}