View Single Post
Old 24/12/2017, 08:54 PM   #1
Inn0cent
Huge Clucker
 
Inn0cent's Avatar
 
Join Date: May 2013
Location: Pakistan
Posts: 353
Reputation: 45
Default DCC - Discord Command Controller.

DCC - Discord Command Controller

Intro
Hi, As stated above this include is basically discord command controller. Where you can make commands easily just by using DC_CMD:.. like CMD:.., It uses DCC_OnChannelMessage callback to fetch commands. If you do not know about the discord plugin please learn about it first. Click Here and then come back here..

How to?

CallBacks

PHP Code:
forward OnDCCommandPerformed(args[], success);        
forward SendDC(channel[], const fmat[], va_args<>); 
I have added a SendDC callback which sends the message to channel directly without doing the format stuff. It uses y_va so you need it.
PHP Code:
SendDC(CHANNEL_ID"%s has joined the server."name); 
CHANNEL_ID is your Bot channel id which you can change later in script.

The callback
Code:
OnDCCommandPerformed(args[], success)
is called after the command execution if success == 0 means the command is not executed or doesn't exists. For Example,
PHP Code:
public OnDCCommandPerformed(args[], success)
{
    if(!
success) return SendDC(CHANNEL_ID"```js\nInvalid command..!\n```");
    return 
1;

Setting Up
Add That on the top of your script,
PHP Code:
#define CMD_PREFIX "!"
#define BOT_CHANNEL ""
#define BOT_NAME ""
#define CHANNEL_ID "" 
and change it to the way you want. CMD_PREFIX tells which prefix to use like @test or !test and after that include the DCC include.
Code:
#include <dcc>
Adding Commands
Example:
PHP Code:
DC_CMD:m(userargs)
{
     new 
msg[50];
    if(
sscanf(args"s[50]"msg)) return SendDC(CHANNEL_ID""CMD_PREFIX"m [Msg]");
    
SendDC(CHANNEL_ID"%s: %s"usermsg);
    return 
1;

Please report any bug you found or tell me anything u want in this include. I will really Appreciate it.
I have also added the test.pwn to make it more easy for you guys in the rar.

Requirements!
Discord Connector Plugin - http://forum.sa-mp.com/showthread.php?t=631562
YSI/y_ya.
sscanf2 plugin.
Attached Files
File Type: rar dcc.rar (915.4 KB, 870 views)
__________________
Inn0cent is offline   Reply With Quote