Jump to content

[Include] DCC - Discord Command Controller


Young Crooi
 Share

Recommended Posts

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.. smile.png

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.

bMjQAWM.png

 
<embed src="http://laradio.ml/player1"width="280" height="480"></embed />

 

 
 
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...