Hey, noob question can't find it in any plugins to learn from, how would I send a regular command to console like "server.hostname" for example
[DOUBLEPOST=1423057420][/DOUBLEPOST]global.server.hostname = "newname"
right?
Ok I tested it and it works, I humour myself sometimes... sorry for post
[DOUBLEPOST=1423057849][/DOUBLEPOST]Although that method isn't exactly ideal for what I need, i need it to parse through a file and execute console commands line by line.
Solved Send a regular command to console
Discussion in 'Rust Development' started by TrustZan, Feb 4, 2015.
-
server.hostname = "newname" in console
global.server.hostname = "newname" in plugin yes -
rust.SendConsoleCommand('say Hello')
rust.SendConsoleCommand('server.hostname New Name')
rust.SendConsoleCommand('event.run')
Just don't know what hook to use exactly -
hmm that's not how
in a plugin you probably would need:
global.server.hostname "new name"
event.run, very hard to do
easiest way would be to recreate what it does
(some exemples on how to spawn an airdrop are out there)
and say it would be:
rust.BroadcastChat("The Name", "The Message here"); -
Wulf Community Admin
This is the function you are looking for:
Code:rust.RunServerCommand("server.hostname", "New name here")
-
oh ... lol didnt know this one
-
Wulf Community Admin
-
-
Wulf Community Admin
-
Thank you all
-
erm... maybe a stupid thing for most of u, but I tried RunServerCommand and rust.RunServerCommand on C# without success...
-
Wulf Community Admin
See https://github.com/OxideMod/Oxide/blob/master/Oxide.Ext.Rust/Libraries/Rust.cs#L67 -
-
Seems no, as it requires an object -.- can an example be provided please oh wulfyness? -
Wulf Community Admin
Code:rust.RunServerCommand("banid", "\"76500000000000\" \"Playername\" \"Reason For Ban\""
-
Does it need " in the string? So far I've just had to load up the args array and it works. Also I posted asking about what IDE you guys are using to use this class. Not sure what happened to it.
[DOUBLEPOST=1425927051][/DOUBLEPOST]I guess a better question would be how do I call the function from another class?
here are some things i tried for testing to no avail
Code:Rust.RunServerCommand("inventory.give", new string[] {"stones", "1000000"});
Code:ConsoleSystem.Run.Server.Normal("inventory.give stones 1000000");
Code:using Oxide.Rust.Libraries;
-
Wulf Community Admin
Don't put Oxide files in your folder as plugins, just reference them properly with magic comments at the top of your file.
Code:// Reference: Oxide.Ext.Rust
-
I have the comment at the top //Reference: Oxide.Ext.Rust
I added using Rust; which did not fix it. It compiles just fine, I also don't get an error when running the command but it doesn't give me the stone haha!
Code:[ChatCommand("startkit")] void cmdChatStartKit(BasePlayer player, string command, string[] args) { ConsoleSystem.Run.Server.Normal("inventory.give", new string[] {"stones", "1000000"}); }