Drawing 3D lines?
I want to draw a line between 2 3 diamentional points.
I know unityengine got a way to do that (aka: The LineRendere componant)
but I assume it ain't going to be easy to use a unityengine componant like that? I do kindof know how Unityengine works, but would I be able to simply attach that componant to a player gameobject or is it not going to be that easy?

I know this might be a pritty stupid question.. my aplologies if so :)
There's no way to do that unless the player is set as admin; which you'd utilize the ddraw commands to handle basic drawing.
Any documentation of the ddraw command anywhere?

Merged post

Or is it just simply

player.Command("ddraw 0,0,0 10,10,10");

or something like that?

Also would orther players be able to see the line, or is it local?



Merged post

public void Line(BasePlayer player, Vector3 from, Vector3 to, Color color, float duration) {
   player.SendConsoleCommand("ddraw.line", duration, color, from, to);
}

Found that from an old github post. opcause SendConsoleCommand should just be Command, but else would it work?

In response to TactiTac0z ():
Any documentation of the ddraw command anywhere?

Merged post

Or is it just sim...
At the moment of receiving command, client must have admin flag (can be scripted as well). I suggest you to look into client assemblies (RustClient_Data/Managed) when you are working with client features, otherwise there is no documentation on that.
Can orther players see drawen lines?
In response to TactiTac0z ():
Can orther players see drawen lines?
No, only the clients that it is sent to.
In response to Wulf ():
No, only the clients that it is sent to.
alright cool

Merged post

I've noticed its possible to attach costom made componats (aka class' that devrive from MonoDevelop)

But how exactly? how would I attach a componant to a player gameobject?
I mean really I just need a refrence to a players gameobject so BasePlayer.gameobject.AddComponant?

In response to 2CHEVSKII ():
At the moment of receiving command, client must have admin flag (can be scripted as well). I suggest...
"(can be scripted as well)"
So you say its possible to bypass that a player has to be admin?
In response to TactiTac0z ():
"(can be scripted as well)"
So you say its possible to bypass that a player has to be admin?

No, there is no way to bypass it. And there is no need to bypass it. You can make player an admin, send him a debug draw command, and then disable admin flag.

            player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, true);
            player.SendConsoleCommand("whatever you want");
            player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false);
In response to TactiTac0z ():
alright cool

Merged post

I've noticed its possible to attach costom made compo...
*Derived from MonoBehaviour
Instead of far-long session of waiting for an answer you could test such an easy thing, or find some plugins, utilizing the same thing.
All the sweetness in "Components" is "Messages", such as Update, Awake, OnCollisionEnter and so on. They are called on various events, (consider them as new hooks). Just remember, that some of the calls are called pretty often (for example: FixedUpdate() is independant of the frame rate and called every 0.02s by default, Update() is called every frame, so as LateUpdate())
You are going to find that useful.
In response to 2CHEVSKII ():
No, there is no way to bypass it. And there is no need to bypass it. You can make player an admin, s...
Awsome thanks
In response to 2CHEVSKII ():
*Derived from MonoBehaviour
Instead of far-long session of waiting for an answer you could test...
Well I were at work at the time of writeing that question, and thouth I might as well use the 5min I had while waiting for a new client on something productive by asking somebody who might have worked on it before. But sorry if it annoyed you...
In response to 2CHEVSKII ():
No, there is no way to bypass it. And there is no need to bypass it. You can make player an admin, s...

Also how save is this method? I mean if the hook crashes mid way thorgh the player would be stuck as admin...

I guess resetting the flag right after the sendconsolecommand and then reseting it a seccound or two after on a timer might make me a bit less paranoid.

But thanks for showing me that SetPlayerFlag thing I didn't know about that one. Would be easyer if there was documentation for the BasePlayer class, and all the orther classes like that one (as BaseEntity, ect) but as I understand it there aren't. But I guess nobody got time to write documentation about evreything...

In response to TactiTac0z ():
Also how save is this method? I mean if the hook crashes mid way thorgh the player would be stuck as...
If the plugin itself crashes - all of it timers will be destroyed as well. The way you offer is the most vulnerable I've ever seen. In that second player can do whatever he wants, for example - noclip through house. Method I wrote cannot crash "in mid way", cuz if the player is null, it will crash at the moment it's trying to set admin flag.
In response to 2CHEVSKII ():
If the plugin itself crashes - all of it timers will be destroyed as well. The way you offer is the...
hmm yeah alright... fair enouth...

Merged post

public void Line(BasePlayer player, Vector3 from, Vector3 to, Color color, float duration)
        {
            player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, true);
            player.SendConsoleCommand("ddraw.line", new object[] { duration, color, from, to });
            
            if (player.IPlayer.Id == "my steam id") //to not remove my charectors admin when I'm ingame
            {
                
            }
            else
            {
                player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false);
            }

        }

public void Line(BasePlayer player, GenericPosition from, GenericPosition to, Color color, float duration)
        {
            Line(player, new Vector3(from.X, from.Y, from.Z), new Vector3(to.X, to.Y, to.Z), color, duration);
        }


Color color = Color.Red;
Iplayer target = sometarget;
BasePlayer = somebaseplayer;
Line(player, player.IPlayer.Position(), target.Position(), color, 9.99f);


Is what I got. But sadly it still doesn't work for non-admins, I assume its because the admin flag is set to false before the client resive and execute the command