AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Need a plugin (https://forums.alliedmods.net/showthread.php?t=342267)

Martinro12 03-23-2023 17:19

Need a plugin
 
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

Naathy 03-24-2023 04:48

Re: Need a plugin
 
Quote:

Originally Posted by Martinro12 (Post 2801693)
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_sHostnamesizeof(g_sHostname));
    
    
cvarHostname.AddChangeHook(OnHostnameChange);
}

void OnHostnameChange(ConVar convarchar[] oldValuechar[] newValue)
{
    
strcopy(g_sHostnamesizeof(g_sHostname), newValue);
}

public 
Action Command_need(int clientint 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(sRequestsizeof(sRequest), "%N is calling you to play!"client);
    
    
Embed.AddField("Need Player!"sRequestfalse);
    
    
char sMap[54];
    
    
GetCurrentMap(sMapsizeof(sMap));
    
    
Embed.AddField("Map:"sMapfalse);
    
    
char buffer[264];
    
Format(buffersizeof(buffer), "%s"g_sHostname);
    
    
Embed.SetFooter(buffer);
    
    
hook.Embed(Embed);
    
    
hook.Send();
    
delete hook;


Dont forget to put the webhook url there.

Martinro12 03-27-2023 13:39

Re: Need a plugin
 
Quote:

Originally Posted by Naathy (Post 2801712)
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_sHostnamesizeof(g_sHostname));
    
    
cvarHostname.AddChangeHook(OnHostnameChange);
}

void OnHostnameChange(ConVar convarchar[] oldValuechar[] newValue)
{
    
strcopy(g_sHostnamesizeof(g_sHostname), newValue);
}

public 
Action Command_need(int clientint 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(sRequestsizeof(sRequest), "%N is calling you to play!"client);
    
    
Embed.AddField("Need Player!"sRequestfalse);
    
    
char sMap[54];
    
    
GetCurrentMap(sMapsizeof(sMap));
    
    
Embed.AddField("Map:"sMapfalse);
    
    
char buffer[264];
    
Format(buffersizeof(buffer), "%s"g_sHostname);
    
    
Embed.SetFooter(buffer);
    
    
hook.Embed(Embed);
    
    
hook.Send();
    
delete hook;


Dont forget to put the webhook url there.

I try to compile It but send me error

https://ibb.co/3YpHHgz

Naathy 03-28-2023 03:19

Re: Need a plugin
 
Quote:

Originally Posted by Martinro12 (Post 2801863)
I try to compile It but send me error

https://ibb.co/3YpHHgz

Download includes here: https://github.com/Deathknife/sourcemod-discord

Martinro12 03-28-2023 09:43

Re: Need a plugin
 
Quote:

Originally Posted by Naathy (Post 2801875)

Now this error

https://ibb.co/XZCxZ0R

Martinro12 03-30-2023 13:29

Re: Need a plugin
 
Its working but can do a CoolDown of 2-3 minutes?

Naathy 03-31-2023 18:59

Re: Need a plugin
 
Quote:

Originally Posted by Martinro12 (Post 2801975)
Its working but can do a CoolDown of 2-3 minutes?

Answered in Discord, it seems working with his requests. ^
Can mark with 'Solved'.


All times are GMT -4. The time now is 05:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.