mute id/nick 1d
how to 1d 1h 1m 1s ??
BasePlayer plz!
Making a mute command?
Discussion in 'Rust Development' started by ZeusGOD, Sep 9, 2017.
-
[ConsoleCommand("mute")]
private void InfoClose(ConsoleSystem.Arg args)
{
var player = args.Connection.player as BasePlayer;
if (!permission.UserHasPermission(player.UserIDString, "fchat.mute"))
{
PrintToChat(player, "<color=red>당신은 권한이 없습니다!</color>");
return;
}
if (args.Length >= 2)
{
var target = rust.FindPlayer(args[0]);
Length , args[0] error how to fix? -
Wulf Community Admin
What exactly is erroring about it?
-
I assume your player would be NRE'ing if you're using it from RCON / Server console. Check if arg.Connection is null, same with the player.
-
-
Adding a DateTime.UtcNow to a mute command?
While creating mute plug-ins
I made it in seconds, but I have to make it every second, which is inconvenient.
So I do not know how to add 1d1h1m1s functionality. Help me.
I'm sorry I'm wrong in English (translate to Google)
Of course, the other plugins are too complicated to understand. -
Ok, @ZeusGOD, take a look at this plugin: BetterChat Mute | Oxide, especcially it's function TryParseTimeSpan, line 441.
Also - there is a bunch of mute plugins already(the one above, for example. it works both with BetterChat and without) so.... why even making one on your own? Or it's just for practise purpose?) -
I tried with battle chat mute, but I can not understand which part of OnBetterChat is. Batter chat is too difficult. -
-
Could it be steamed? This system is frustrating because I can not confirm it.
if you can | Steam Community :: ZEUS_GOD | add me plz -
-
Google translator status is strange.
Anyway I have a problem now.
Can you take a look at the source ??
mutes [target.Id] = new MuteInfo (DateTime.UtcNow + timeSpan);
I do not know how to change this to BasePlayer.
And I do not know how to add it because it is different from the way I do data.
I made a mute in seconds at the moment
I am trying the 1d1h1m1s method.
I just do not know what to do with the sourceLast edited by a moderator: Sep 16, 2017 -
Dude. What are you talking about? Function TryParseTimeSpan would convert string "1d1h2m3s" to timespan. And that's all.
About mutes [target.Id] = new MuteInfo (DateTime.UtcNow + timeSpan);, well. it depends on your MuteInfo(or simular) class, where you store mute information.
mutes is a dictionary<string,muteinfo>. You can change it to Dictionary<ulong, MuteInfo> and store it like this:
BasePlayer player = ...
mutes[player.UserID] = new MuteInfo(...)
Or don't change anything and to
mutes[player.userIdString] = new MuteInfo(...)
It really depends on your code.
Post your plugin if you want overs to do it for you... -
I do not know how to apply it because of different data method.Last edited by a moderator: Sep 16, 2017 -