Question from a laymanSolved

I can make a covalence plugin perform a command inside the console of rust game? When I use the command covalence.Server.Command, it performs in the server outside console cmd, but it doesn't make any effect inside game. When i use a native rust plugin, i used player.SendConsoleCommand, and so it works. Have any solution, to make that whit covalence plugin ?

Could you show us how you are using both?

Yes, the main plugin is Notify - it has the notify.show command, that show some box UI in game.
First i try to junction this plugin whit GroupMessages, and it works - the game shows the Notify box UI, whit the messages of GroupMessages in game.

private void StartAutoMessages()
{
timer.Every(interval, () => {
var activeList = BasePlayer.activePlayerList;
foreach (var player in activeList)
{
var playerMessages = PlayerMessages(player);
if (playerMessages.Count < 1)
continue;

var randomMessage = playerMessages.GetRandom();
if (string.IsNullOrEmpty(randomMessage))
continue;

player.SendConsoleCommand($"notify.show 0 <color={color}>{tag}</color>{randomMessage}");
}
});
}

But when i tried to junction the main plugin Notify whit AdvertMessages (that says covalence plugin) it wont show the messages in the box UI, inside the game. 

private void BroadcastNextAdvert()
{
if (_config.Messages.Count == 0)
return;

int advert = GetNextAdvertIndex();

covalence.Server.Command("notify.show 0", _config.Messages[advert]);

if (_config.BroadcastToConsole)
Puts(Formatter.ToPlaintext(_config.Messages[advert]));

_previousAdvert = advert;
}

I don't know very well about it (the title says it), and my English is terrible, but I thought I'd ask for help, to see if there's a way to solve this!

Merged post

Probably the code would not covalence.Server.Command, have another code that can solve this ?

You are trying to run it as a server command, not a player command. A player command can be sent with IPlayer.Command. You'd have the loop the players like the other, which can be done via players.Connected.

Locked automatically