Notification with /calladminSolved
Hello how i can make a notification when someone type in chat /calladmin?
You'd need to have a plugin written that listens for that. This plugin is just the API for others to use.

yes i know that but i dont know how to make it, i made the PushTest.cs and i took a notification when it loaded

 

https://pastebin.com/2pcyjp5z


This won't listen for a command, but it will listen for chat. If you want to listen for a command, you can use the OnUserCommand hook I believe.

// Requires: PushAPI

using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    [Info("Call Push", "Wulf/lukespragg", 0.1)]
    [Description("Send a push notification when players call for admin")]
    class CallPush: CovalencePlugin
    {
        [PluginReference]
        private Plugin PushAPI;

        private void OnUserChat(IPlayer player, string message)
        {
            if (message.Contains("calladmin"))
            {
                PushAPI?.Call("PushMessage", $"{player.Name} is calling for admin", message);
            }
        }
    }
}
not working
when i type /calladmin it says unknown command, when i type it with out "/" it dont do nothing, i test "calladmin test" still nothing.. and no errors in console
In response to DarkNosS96 ():
not working
when i type /calladmin it says unknown command, when i type it with out "/" it dont...
Like I mentioned, it listens for chat, not command.

so i will replace

private void OnUserChat

private void OnUserCommand?

not work, and not work in chat

Both examples compile and are using it properly, so if you don't see a message in Push, then it likely isn't configured properly.

// Requires: PushAPI

using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    [Info("Call Push", "Wulf/lukespragg", 0.1)]
    [Description("Send a push notification when players call for admin")]
    class CallPush: CovalencePlugin
    {
        [PluginReference]
        private Plugin PushAPI;

        private void OnUserCommand(IPlayer player, string command, string[] args)
        {
            if (command.Contains("calladmin"))
            {
                player.Reply("Calling for admin!");
                PushAPI?.Call("PushMessage", $"{player.Name} is calling for admin");
            }
        }
    }
}
still nothing :( still unknows command
In response to DarkNosS96 ():
still nothing :( still unknows command
It isn't registering a command... the examples were just for listening for chat or command input, not providing it. Here's one if you want it to actually register the command.

Also, if it wasn't obvious, you need to name these CallPush.cs.

// Requires: PushAPI

using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    [Info("Call Push", "Wulf/lukespragg", 0.1)]
    [Description("Send a push notification when players call for admin")]
    class CallPush: CovalencePlugin
    {
        [PluginReference]
        private Plugin PushAPI;

        [Command("calladmin")]
        private void CallAdmin(IPlayer player, string command, string[] args)
        {
            player.Reply("Calling for admin!");
            PushAPI?.Call("PushMessage", $"{player.Name} is calling for admin");
        }
    }
}
​

(06:56:56) | [PushAPI] Message not given! Please enter one and try again

(06:57:05) | [PushAPI] Message not given! Please enter one and try again

i got those errors in console

In response to DarkNosS96 ():
(06:56:56) | [PushAPI] Message not given! Please enter one and try again(06:57:05) | [PushAPI] Mess...
// Requires: PushAPI

using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    [Info("Call Push", "Wulf/lukespragg", 0.1)]
    [Description("Send a push notification when players call for admin")]
    class CallPush: CovalencePlugin
    {
        [PluginReference]
        private Plugin PushAPI;

        [Command("calladmin")]
        private void CallAdmin(IPlayer player, string command, string[] args)
        {
            player.Reply("Calling for admin!");
            PushAPI?.Call("PushMessage", $"{player.Name} is calling for admin", string.Join(" ", args));
        }
    }
}
nice, this one works, i tried to change it 
// Requires: PushAPI

using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    [Info("Call Push", "Wulf/lukespragg", 0.1)]
    [Description("Send a push notification when players call for admin")]
    class CallPush: CovalencePlugin
    {
        [PluginReference]
        private Plugin PushAPI;

        [Command("calladmin")]
        private void CallAdmin(IPlayer player, string command, string[] args)
        {
			if (args=" ")
			{
				player.Reply("Please enter your message and try again");
			}
			else
			{
				player.Reply("Calling for admin!");
				PushAPI?.Call("PushMessage", $"{player.Name} is calling for admin", string.Join(" ", args));
			}
        }
    }
}

what i did wrong?

In response to DarkNosS96 ():
nice, this one works, i tried to change it 
// Requires: PushAPIusing Oxide.Core.Libraries....
// Requires: PushAPI

using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    [Info("Call Push", "Wulf/lukespragg", 0.1)]
    [Description("Send a push notification when players call for admin")]
    class CallPush: CovalencePlugin
    {
        [PluginReference]
        private Plugin PushAPI;

        [Command("calladmin")]
        private void CallAdmin(IPlayer player, string command, string[] args)
        {
            if (args.Length < 0)
            {
                player.Reply("Please enter a message when calling for admin");
                return;
            }

            player.Reply("Calling for admin!");
            PushAPI?.Call("PushMessage", $"{player.Name} is calling for admin");
        }
    }
}
Locked automatically