SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Includes (https://forum.sa-mp.com/forumdisplay.php?f=83)
-   -   [Include] DCC - Discord Command Controller. (https://forum.sa-mp.com/showthread.php?t=646843)

Inn0cent 24/12/2017 08:54 PM

DCC - Discord Command Controller.
 
1 Attachment(s)
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.

Barnwell 24/12/2017 09:10 PM

Re: DCC - Discord Command Controller.
 
Awesome!

StrikerZ 25/12/2017 04:30 AM

Re: DCC - Discord Command Controller.
 
Cool

SeanDenZYR 18/01/2018 11:52 AM

Re: DCC - Discord Command Controller.
 
a substitute to IRC. Nice. Plus Discord is easier to use. +rep.

SeanDenZYR 18/01/2018 01:11 PM

Re: DCC - Discord Command Controller.
 
[mention]Inn0cent[/mention], is there a way to check if a player uses this role? like for example:
if(PlayerInfo[playerid][DISCORD ROLE])

Inn0cent 18/01/2018 01:46 PM

Re: DCC - Discord Command Controller.
 
Quote:

Originally Posted by SeanDenZYR (Post 3981639)
[mention]Inn0cent[/mention], is there a way to check if a player uses this role? like for example:
if(PlayerInfo[playerid][DISCORD ROLE])

No, I haven't added the role thing in this include yet, but i will do so. Btw you can read about roles on Main Plugin Thread.

DeitY 19/01/2018 10:20 AM

Re: DCC - Discord Command Controller.
 
Awesome script, too sad not so many communities use discord, neither me myself ;/

Unkovic 29/01/2018 10:08 AM

Re: DCC - Discord Command Controller.
 
Good job :)

Quote:

Originally Posted by DeitY (Post 3981872)
Awesome script, too sad not so many communities use discord, neither me myself ;/

Jeste jeste xD

waysemir 22/02/2018 05:28 PM

Re: DCC - Discord Command Controller.
 
C:\test\pawno\include\dcc.inc(37) : error 017: undefined symbol "BOT_NAME"
C:\test\pawno\include\dcc.inc(39) : error 017: undefined symbol "BOT_CHANNEL"
C:\test\pawno\include\dcc.inc(46) : error 017: undefined symbol "CMD_PREFIX"

N0FeaR 22/02/2018 05:31 PM

Re: DCC - Discord Command Controller.
 
Awesome work i will test this.


All times are GMT. The time now is 02:30 PM.

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