Raised This Month: $32 Target: $400
 8% 

Need a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Martinro12
Junior Member
Join Date: Apr 2021
Old 03-23-2023 , 17:19   Need a plugin
Reply With Quote #1

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
Martinro12 is offline
Naathy
Member
Join Date: Mar 2022
Location: Brazil
Old 03-24-2023 , 04:48   Re: Need a plugin
Reply With Quote #2

Quote:
Originally Posted by Martinro12 View Post
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.
__________________
Owner of NGServers

Contact
Discord | Steam | Github

Last edited by Naathy; 03-24-2023 at 04:49.
Naathy is offline
Martinro12
Junior Member
Join Date: Apr 2021
Old 03-27-2023 , 13:39   Re: Need a plugin
Reply With Quote #3

Quote:
Originally Posted by Naathy View Post
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
Martinro12 is offline
Naathy
Member
Join Date: Mar 2022
Location: Brazil
Old 03-28-2023 , 03:19   Re: Need a plugin
Reply With Quote #4

Quote:
Originally Posted by Martinro12 View Post
I try to compile It but send me error

https://ibb.co/3YpHHgz
Download includes here: https://github.com/Deathknife/sourcemod-discord
__________________
Owner of NGServers

Contact
Discord | Steam | Github
Naathy is offline
Martinro12
Junior Member
Join Date: Apr 2021
Old 03-28-2023 , 09:43   Re: Need a plugin
Reply With Quote #5

Quote:
Originally Posted by Naathy View Post
Now this error

https://ibb.co/XZCxZ0R
Martinro12 is offline
Martinro12
Junior Member
Join Date: Apr 2021
Old 03-30-2023 , 13:29   Re: Need a plugin
Reply With Quote #6

Its working but can do a CoolDown of 2-3 minutes?
Martinro12 is offline
Naathy
Member
Join Date: Mar 2022
Location: Brazil
Old 03-31-2023 , 18:59   Re: Need a plugin
Reply With Quote #7

Quote:
Originally Posted by Martinro12 View Post
Its working but can do a CoolDown of 2-3 minutes?
Answered in Discord, it seems working with his requests. ^
Can mark with 'Solved'.
__________________
Owner of NGServers

Contact
Discord | Steam | Github
Naathy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:50.


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