Raised This Month: $ Target: $400
 0% 

Need a simple plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 12-19-2018 , 12:56   Re: Need a simple plugin
Reply With Quote #2

Code:
#pragma semicolon 1
#pragma newdecls required

#define TAG "[SM]"

#include <sourcemod>

ConVar convar_DiscordLink;

public Plugin myinfo =
{
	name = "Discord Link",
	author = "Keith Warren (Drixevel)",
	description = "Posts a discord link in chat on command.",
	version = "1.0.0",
	url = "https://github.com/drixevel"
};

public void OnPluginStart()
{
	convar_DiscordLink = CreateConVar("sm_discord_link", "", "Link to post into chat.");
	RegConsoleCmd("sm_discord", Command_DiscordLink, "Show the Discord link in chat.");
}

public Action Command_DiscordLink(int client, int args)
{
	RequestFrame(Frame_ShowLink, GetClientUserId(client));
	return Plugin_Handled;
}

public void Frame_ShowLink(any userid)
{
	int client;
	if ((client = GetClientOfUserId(userid)) > 0)
	{
		char sLink[512];
		convar_DiscordLink.GetString(sLink, sizeof(sLink));
		PrintToConsole(client, "%s Join our Discord: %s", TAG, sLink);
		PrintToChat(client, "%s Join our Discord: %s", TAG, sLink);
	}
}
Attached Files
File Type: sp Get Plugin or Get Source (discordlink.sp - 94 views - 1,016 Bytes)

Last edited by Drixevel; 12-19-2018 at 12:56.
Drixevel is offline
 



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 04:38.


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