Solved Getting player position?

Discussion in 'Rust Development' started by #Welaurs, Nov 26, 2016.

  1. Hello all. How I can get player position? Where I can find docs? Here only hooks.
     
  2. Docs: Oxide API for Rust

    Things like player position is however now stored in those docs. You can use a program like dotPeek and dig into the assembly and find those lines of code. Or look in pre-existing plugins such as Teleportation, etc.

    Examples of finding player position:
    Code:
    object GetPosition(BasePlayer player) => return player.transform.position;object GetPositionType(int type, BasePlayer player){
    if (type==0) return player.transform.position.x;
    else if (type==1) return player.transform.position.y;
    else if (type==2) return player.transform.position.z;
    else return null;
    }
    However, you can do this standalone(player.transform.position) in a variable or statement. Just keep in mind you need the BasePlayer player(player variable can be anything) to cast it.
    [DOUBLEPOST=1480147459][/DOUBLEPOST]Flippable Turrets for Rust | Oxide this has a example of setting position. However it does it on turrets(same method on players).
    Example(its hard to find normally):
    Code:
    (turret.transform.position.x, turret.transform.position.y, turret.transform.position.z)
     
  3. I have tried to search it on docs, but... (see file)
     

    Attached Files:

    • api.jpg
      api.jpg
      File size:
      27.4 KB
      Views:
      50
  4. Things like player position is however *not* stored in those docs. You can use a program like dotPeek and dig into the assembly and find those lines of code. Or look in pre-existing plugins such as Teleportation, etc. It said now before, sorry :)