Quote:
Originally Posted by Martinro12
Hi. I need a plugin of CSGO that with a command like "!people" or "!play" send a messege to my discord server with a rol tag and saying than need people to play.
Its for a AutoMix server (5vs5), im using pugsetup.
Cand somebody help me? Thanks
Sorry for my english
|
PHP Code:
#include <sourcemod>
#include <discord>
char g_sHostname[264];
ConVar cvarHostname;
#pragma newdecls required
public Plugin myinfo =
{
name = "Player Request in Discord",
author = "Nathy",
version = "1.0",
description = "Send a message on Discord advising it need players",
url = "https://steamcommunity.com/id/nathyzinhaa"
};
public void OnPluginStart()
{
RegConsoleCmd("sm_need", Command_need, "Sends Message");
RegConsoleCmd("sm_players", Command_need, "Sends Message");
cvarHostname = FindConVar("hostname");
cvarHostname.GetString(g_sHostname, sizeof(g_sHostname));
cvarHostname.AddChangeHook(OnHostnameChange);
}
void OnHostnameChange(ConVar convar, char[] oldValue, char[] newValue)
{
strcopy(g_sHostname, sizeof(g_sHostname), newValue);
}
public Action Command_need(int client, int args)
{
DiscordWebHook hook = new DiscordWebHook("PUT THE WEBHOOK HERE");
hook.SlackMode = true;
hook.SetContent("@here");
hook.SetUsername(""); // you can set this as you want or leave blank, so the plugin get the Discord Webhook name
MessageEmbed Embed = new MessageEmbed();
Embed.SetColor("#ff0000");
Embed.SetTitle("Looking for players!");
char sRequest[64];
Format(sRequest, sizeof(sRequest), "%N is calling you to play!", client);
Embed.AddField("Need Player!", sRequest, false);
char sMap[54];
GetCurrentMap(sMap, sizeof(sMap));
Embed.AddField("Map:", sMap, false);
char buffer[264];
Format(buffer, sizeof(buffer), "%s", g_sHostname);
Embed.SetFooter(buffer);
hook.Embed(Embed);
hook.Send();
delete hook;
}
Dont forget to put the webhook url there.
__________________