Hi guys,
So I saw the the recent post about the StartSleeping function in LUA so I decided to test it out in C#.
I've basically done what was in the LUA:
The only thing I'd like to do is 'detect' when the player is asleep or awake.Code:[ChatCommand("afkc")] void cmdAfk(BasePlayer player, string command, string[] args) { player.StartSleeping(); }
I've made a little bit in there already but I know that it's not right, I'm just wondering if there is a function or something for it. And is there a website URL like http://docs.oxidemod.org/?lua#getting-started for all the things like player.StartSleeping() and player.(whatever) that shows all of them?
Thanks in advance!
This is what I've done, where the player.StartSleeping == true or false is where I'm wondering if there is something like player.IsSleeping().
Code:[ChatCommand("afkc")] void cmdAfk(BasePlayer player, string command, string[] args) { player.StartSleeping(); if(player.StartSleeping() == true) { void sleepingMessageT(BasePlayer player) { var messageT = string.Format(player.displayName + " is now sleeping/afk"); rust.BroadcastChat({ messageT }); } sleepingMessageT(); } else if(player.StartSleeping() == false) { void sleepingMessageF(BasePlayer player) { var messageF = string.Format(player.displayName + " is now back from being afk/asleep"); rust.BroadcastChat({ messageF }); } sleepingMessageF(); } }
Solved Player.IsSleeping? [C#]
Discussion in 'Rust Development' started by ItsAnderson, Mar 30, 2015.
-
Yes, IsSleeping() exists.
-
Sorry..Someone can delete this post like Wulf,
but is there a website like that link I gave up there ^ that has ALL the 'commands' for the Oxide API in Csharp?
[DOUBLEPOST=1427680276][/DOUBLEPOST]By the way, when I use rust.BroadcastChat({ message }); it has problems compiling, anything else that can do what BroadcastChat does?
I know that PrintToChat works instead of SendChatMessage. -
You can find everything about the Oxide API in the docs -> http://docs.oxidemod.org/
or search on github directly -> https://github.com/OxideMod/Oxide
To search for Rust methods you need to decompile the Assembly-CSharp.dll found in the server files. -
Thanks!
I found this topic and it helped a lot! : http://oxidemod.org/threads/finding-rust-functions.7107/
Thanks for the feedback.