SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Thread Tools Display Modes
Old 31/03/2017, 08:16 PM   #1
maddinat0r's Avatar
Join Date: Jun 2010
Location: Germany
Posts: 890
Reputation: 462
Default Discord Connector

Discord Connector v0.2

This plugin allows you to control a Discord bot from within your gamemode.

You'll need to create a bot first in order to pass your bot token to the plugin.
  1. Go to
  2. click "new application"
  3. enter a name for your bot
  4. click "create application"
  5. press "create bot user"
  6. you now have a bot token!
To add that bot to your server, copy the client id from your newly created application, insert it in the link below and open that link:
Now you only have to add this line into your server.cfg file and you're ready to go!
discord_bot_token YOUR_BOT_TOKEN_HERE
  • never share your bot token with anyone
  • make sure your server clock is synced regularly, or else the rate-limiter won't work correctly and your bot might get banned
  • this plugin won't run on CentOS 6, you'll need CentOS 7 at least

Example code
new DCC_Channel:g_WelcomeChannelId;

public OnPlayerSpawn(playerid)
	new name[MAX_PLAYER_NAME + 1];
	GetPlayerName(playerid, name, sizeof name);
	if (_:g_WelcomeChannelId == 0)
		g_WelcomeChannelId = DCC_FindChannelById("388423556721672192"); // Discord channel ID
	new str[128];
	format(str, sizeof str, "Player %s joined the server.", name);
	DCC_SendChannelMessage(g_WelcomeChannelId, msg);
	return 1;

public DCC_OnChannelMessage(DCC_Channel:channel, DCC_User:author, const message[])
	new channel_name[100 + 1];
	if(!DCC_GetChannelName(channel, channel_name))
		return 0; // invalid channel

	new user_name[32 + 1];
	if (!DCC_GetUserName(author, user_name))
		return 0; // invalid user

	new str[145];
	format(str, sizeof str, "[Discord/%s] %s: %s", channel_name, user_name, message);
	SendClientMessageToAll(-1, str);
	return 1;
This plugin is still in beta. If you notice the plugin spawns a lot of errors/warnings in its log, stop using it, or your bot might get banned.
The plugin will also generate a lot of debug log messages for now. This should help me on improving it, in case of bugs/crashes.

Where da links at
Source on GitHub
Download on GitHub

Please provide feedback and log files if you can.

Last edited by maddinat0r; 24/09/2017 at 09:19 AM. Reason: v0.2
maddinat0r is offline   Reply With Quote
Old 31/03/2017, 08:17 PM   #2
Kar's Avatar
Join Date: May 2010
Location: Black Asylum
Posts: 3,182
Reputation: 489
Default Re: Discord Connector

Finally guys! We got it!
Kar is offline   Reply With Quote
Old 31/03/2017, 08:28 PM   #3
Tamer's Avatar
Join Date: Nov 2011
Location: Turkey
Posts: 1,192
Reputation: 169
Default Re: Discord Connector

Thanks for the effort, awaiting further updates.
The three stages of truth:

- Ridicule.
- Violent opposition.
- Acceptance.

The greatest hypnotist on the planet Earth is an oblong box in the corner of the room. It is constantly telling us what to believe is real. If you can persuade people that what they see with their eyes is what there is to see you've got them. you know because they'll laugh in your face of an explanation that portrays the biggest picture of what's happening... and they have.
Tamer is offline   Reply With Quote
Old 31/03/2017, 08:33 PM   #4
Dayvison_'s Avatar
Join Date: Nov 2013
Posts: 1,290
Reputation: 192
Default Re: Discord Connector

Finally, thanks a lot
Dayvison_ is offline   Reply With Quote
Old 31/03/2017, 09:17 PM   #5
Huge Clucker
Join Date: Nov 2013
Posts: 479
Reputation: 153
Default Re: Discord Connector

Yep, interesting. Thanks maddinat0r!
Evocator is offline   Reply With Quote
Old 31/03/2017, 11:10 PM   #6
Admigo's Avatar
Join Date: Oct 2010
Location: The Netherlands
Posts: 2,046
Reputation: 297
Default Re: Discord Connector

Thanks for this great release maddinat0r!
Follow me on Instagram @brandonvanommen
Admigo is offline   Reply With Quote
Old 31/03/2017, 11:16 PM   #7
Huge Clucker
JustMe.77's Avatar
Join Date: Jun 2013
Location: Germany
Posts: 270
Reputation: 63
Default Re: Discord Connector

This is damn cool, can't wait for more functions !
JustMe.77 is offline   Reply With Quote
Old 31/03/2017, 11:23 PM   #8
Big Clucker
TopShooter2's Avatar
Join Date: Feb 2017
Posts: 126
Reputation: 57
Default Re: Discord Connector

Good job, thank you for releasing it.
TopShooter2 is offline   Reply With Quote
Old 01/04/2017, 12:44 AM   #9
Join Date: Aug 2016
Posts: 552
Reputation: 73
Default Re: Discord Connector

Been waiting for this quite a while now, Ditching IRC for sure!
ISmokezU is offline   Reply With Quote
Old 01/04/2017, 12:51 AM   #10
Unrea1's Avatar
Join Date: Oct 2013
Location: Venezuela
Posts: 857
Reputation: 107
Default Re: Discord Connector

Excelent job, 5 stars and +rep.
Unrea1 is offline   Reply With Quote

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] Teamspeak Connector maddinat0r Plugin Development 322 09/02/2018 11:53 AM
Route Connector James_Braga Русский/Russian 9 15/05/2015 08:24 AM
[Map] Connector Gas Tellken Maps 4 01/06/2012 03:04 AM
PSU connector help! patchkinson Everything and Nothing 3 20/03/2010 09:24 PM

All times are GMT. The time now is 08:48 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.