Solved Location command

Discussion in 'Plugin Requests' started by Togoshige, Apr 14, 2017.

  1. Since CUI is broken, I cant use InfoPanel to let players know their coordinates,
    is there a plugin that has a chat command to get coordinates?
    I looked but couldnt find any
    [DOUBLEPOST=1492126008][/DOUBLEPOST]
    Code:
    string getCoordinatesToString(BasePlayer player)
    {
        if (player.transform == null || player.transform.position == null) { return ""; };
        return ("X: " + player.transform.position.x.ToString("0") + " | " +
            "Z: " + player.transform.position.z.ToString("0"));
    }[ChatCommand("coord")]
    void getPlayerCoordinates(BasePlayer player, string cmd, string[] args)
    {
        SendReply(player, getCoordinatesToString(player));
    }
     
  2. Wulf

    Wulf Community Admin

    Code:
    [ChatCommand("coord")]
    void Location(BasePlayer player) => PrintToChat(player, player.transform.location.ToString());
    or

    Code:
    [Command("coord")]
    void Location(IPlayer player, string command, string[] args) => player.Reply(player.Location.ToString());
     
  3. Tested on server, works

    I probably have way too many imports, and you could call it location or coordinates or position or whatever,
    If someone wants to submit this as a legit oxide plugin, please do

    Wulfs code version seems way more simple/awesome, haha
     
  4. Position | Oxide works too :)