SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 23/02/2018, 04:17 PM   #11
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,179
Reputation: 404
Default Re: DCC - Discord Command Controller.

Brilliant, who the fuck keeps rating every thread 1 star lmfao!
Good job tho.
__________________
Quote:
Originally Posted by Andy
My anti cheat is still relevant *puts shades on* https://github.com/RogueDrifter/Anti_cheat_pack

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link
RogueDrifter is offline   Reply With Quote
Old 24/02/2018, 05:17 AM   #12
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 575
Reputation: 69
Default Re: DCC - Discord Command Controller.

I'm a bit confused.. is this for players from discord typing /command, or just a command parser from ingame that outputs to discord?
__________________
Chaprnks is offline   Reply With Quote
Old 11/04/2018, 03:40 PM   #13
Exhibit
Big Clucker
 
Join Date: Dec 2015
Location: Pakistan
Posts: 180
Reputation: 22
Default Re: DCC - Discord Command Controller.

Quote:
Originally Posted by Chaprnks View Post
I'm a bit confused.. is this for players from discord typing /command, or just a command parser from ingame that outputs to discord?
I'm also a bit confused. Little help?
Exhibit is offline   Reply With Quote
Old 11/04/2018, 08:34 PM   #14
DeitY
Huge Clucker
 
DeitY's Avatar
 
Join Date: Aug 2012
Location: Serbia
Posts: 320
Reputation: 16
Default Re: DCC - Discord Command Controller.

Beauty. Gonna implement asap!
__________________
Proudly hosted by Evolution-Host. Get your server fast and cheap!
Instant deployment & DDoS Protected.

DeitY is offline   Reply With Quote
Old 11/04/2018, 11:57 PM   #15
Infin1ty
Banned
 
Join Date: Feb 2018
Posts: 118
Reputation: 52
Default Re: DCC - Discord Command Controller.

Quote:
Originally Posted by waysemir View Post
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"
Code:
#define CMD_PREFIX "!" 
#define BOT_CHANNEL "" 
#define BOT_NAME "" 
#define CHANNEL_ID ""
Infin1ty is offline   Reply With Quote
Old 12/04/2018, 12:18 AM   #16
Exhibit
Big Clucker
 
Join Date: Dec 2015
Location: Pakistan
Posts: 180
Reputation: 22
Default Re: DCC - Discord Command Controller.

Quote:
Originally Posted by Infin1ty View Post
Code:
#define CMD_PREFIX "!" 
#define BOT_CHANNEL "" 
#define BOT_NAME "" 
#define CHANNEL_ID ""

Put these before include <dcc>
Exhibit is offline   Reply With Quote
Old 17/08/2018, 08:36 AM   #17
ZigGamerx
Huge Clucker
 
ZigGamerx's Avatar
 
Join Date: Jul 2018
Posts: 204
Reputation: 25
Default Re: DCC - Discord Command Controller.

winrar is damaged please fix it
ZigGamerx is offline   Reply With Quote
Old 18/08/2018, 07:46 AM   #18
AzaMx
Huge Clucker
 
Join Date: Aug 2014
Location: Home.
Posts: 334
Reputation: 63
Default Re: DCC - Discord Command Controller.

Quote:
Originally Posted by Chaprnks View Post
I'm a bit confused.. is this for players from discord typing /command, or just a command parser from ingame that outputs to discord?
^ me too
AzaMx is offline   Reply With Quote
Old 18/08/2018, 08:00 AM   #19
CaptainBoi
Huge Clucker
 
CaptainBoi's Avatar
 
Join Date: May 2018
Location: Inside Game
Posts: 232
Reputation: 26
Default Re: DCC - Discord Command Controller.

when i type the commands in server or in discord channel it not gives me the syntax and also the cmds not works
__________________
Code:
Releases
[FilterScript] Dynamic MySQL GPS System
[Tutorial] How to make TDM Team Selection.
[Include] moneybar.inc || Coloured Moneybar || Released
[Tutorial] PAWN Compiler In Notepad++
[FilterScript] Perks System (v: [On Update]) [DINI, ZCMD]
[FilterScript] Realistic Transmission Speedometer
CaptainBoi is offline   Reply With Quote
Old 18/08/2018, 10:11 AM   #20
MafiaOink
Big Clucker
 
MafiaOink's Avatar
 
Join Date: Jun 2014
Location: Pakistan
Posts: 187
Reputation: 28
Default Re: DCC - Discord Command Controller.

Quote:
Originally Posted by CaptainBoi View Post
when i type the commands in server or in discord channel it not gives me the syntax and also the cmds not works
I modified it a bit, it works fine for me:

Added SendDCByName
and fixed a crash where if you type % in the discord chat and output it into server, it would crash while processing.
Also added multi channel support, you can sendcbyname and check the channel name on channel cmd performed, added a channel parameter in DCCMD: and blah

Code:
#include <sscanf2>
#include <YSI\y_va>
#include <discord-connector>

new DCC_Channel:BotChannel;

#define DC_CMD:%0(%1,%2,%3)          \
			forward dc_cmd_%0(%1[],%2[],%3[]); \
			public dc_cmd_%0(%1[],%2[],%3[])

			
//CallBacks
forward OnDCCommandPerformed(args[], success, channel[]);		
forward SendDC(channel[], const fmat[], va_args<>);
forward SendDCByName(channel[], const fmat[], va_args<>);

//Functions

public SendDC(channel[], const fmat[], va_args<>)
{
    new
        str[145];
    va_format(str, sizeof (str), fmat, va_start<2>);
	BotChannel = DCC_FindChannelById(channel);
    return DCC_SendChannelMessage(BotChannel, str);
}
public SendDCByName(channel[], const fmat[], va_args<>)
{
    new
        str[145];
    va_format(str, sizeof (str), fmat, va_start<2>);
	BotChannel = DCC_FindChannelByName(channel);
    return DCC_SendChannelMessage(BotChannel, str);
}
//CommandsSection
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 msgFx[1024];
	format(msgFx, 1024, message);
	for(new s; s < strlen(msgFx); s++)
	{
		if (msgFx[s] == '%')
		{
			msgFx[s] = ' ';
		}
	}
		
	if(!strcmp(user_name, BOT_NAME, true)) return 1;
	
	if(strlen(user_name) > 0) // If user is bot then quit the callback.
	{
		new dmsg[10][128];
		explode(dmsg, msgFx, " ", 2); // Used so we can see if the arguments next to command are empty or have value.
		new command[10], args[50];
		sscanf(msgFx, "s[10]s[50]", command, args); // Sperate message in COMMAND and arguments.
		if(strfind(command, CMD_PREFIX, true) != -1) // Check if command have prefix defined above.
		{
			new funcdc[128];
			strdel(command, 0, 1);
			format(funcdc, sizeof(funcdc), "dc_cmd_%s", command); // Format function.
			
			if(isnull(dmsg[1])) {
				CallLocalFunction("OnDCCommandPerformed", "sis", msgFx, CallLocalFunction(funcdc, "sss", user_name, "\1", channel_name), channel_name);
			} else CallLocalFunction("OnDCCommandPerformed", "sis", msgFx, CallLocalFunction(funcdc, "sss", user_name, args, channel_name), channel_name);
				
			
		}
	}
	return 1;
}
//Explode
stock explode(aExplode[][], const sSource[], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[])
{
	new
		iNode,
		iPointer,
		iPrevious = -1,
		iDelimiter = strlen(sDelimiter);

	while(iNode < iVertices)
	{
		iPointer = strfind(sSource, sDelimiter, false, iPointer);

		if(iPointer == -1)
		{
			strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
			break;
		}
		else
		{
			strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
		}

		iPrevious = (iPointer += iDelimiter);
		++iNode;
	}

	return iPrevious;
}
Can be used with multiple channels and blah blah.
Example:
Code:
DC_CMD:ban(author, params, channel)
{
	if(strcmp(channel, "staff-bot")) return SendDCByName(CHANNEL_ALL_NAME, "```css\nERROR: You are not allowed to use this command!```");
	new target, reason[128], hours;
	if(sscanf(params, "uds[127]", target, hours, reason)) return SendDCByName(CHANNEL_STAFF_NAME, "```css\nUSAGE: ban [playerid] [hours] [reason]```");
	if(hours < 1 || hours > 8760) return SendDCByName(CHANNEL_STAFF_NAME, "```css\nBan time cannot be less than 1 or more than 8760 hours!```");
	if(!IsPlayerConnected(target)) return SendDCByName(CHANNEL_STAFF_NAME, "```css\nERROR: Target is not connected```");
   
	BanPlayer(sprintf("[DISCORD ADMIN] %s", author), target, reason, false, hours, false);
	if(PlayerInfo[target][LoggedIn] == true) AddToAdminRecord(target, sprintf("Banned by %s [DISCORD] for %s.", author, reason));
    SendDCByName(CHANNEL_STAFF_NAME, "```css\nTarget banned```");
	return 1;
}
Code:
#if defined DISCORD_PLUGIN
#include <discord-connector>
#define BOT_NAME "botnamehere" // Btw this is used so the bot skips its own messages so if the bot would send !kick it would detect the command but skips it because its the bot itself.
#define CHANNEL_STAFF_NAME "staff-bot"
#define CHANNEL_ALL_NAME "ingame-bot"
#define CMD_PREFIX "!"
#include <dcc>
#endif
Added SendDCByName (ids are quite a pain to work with if you recreate channels to clear all logs like me)

Code:
public OnDCCommandPerformed(args[], success, channel[])
{
    SendDCByName(channel, "```css\nYou sent the command '%s'```", args);
    return 1;
}
__________________
MafiaOink is offline   Reply With Quote
Reply

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
Help with Discord Connector baki Scripting Help 3 25/06/2018 01:03 PM
Discord Help baki Scripting Help 4 09/08/2017 11:28 PM
Discord for SA-MP? Lorenc_ Plugin Development 83 05/02/2017 08:01 PM


All times are GMT. The time now is 08:29 PM.


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