SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 05/01/2019, 04:11 PM   #1
RJTabish
Little Clucker
 
Join Date: Jul 2018
Location: UknownDarkIsland
Posts: 47
Reputation: 0
Unhappy Discord Bot Chat Problem Help Please

Hello guys sorry for disturbance i was trying to solve this issue with my own mind but i'm totally fail there is alot experience people so please help me to fix this issue actually i create some codes for my discord chat system using discord-connector all is working fine but there is small problem when Ingame player sending message to discord channel its showing double message like bots message to i wanted to turn off or block bot message its only happening with Ingame player bot message also visible ingame so how to disable bot messages thanks in advance
Here is Code

PHP Code:
#include <a_samp>
#include <discord-connector>
// HE IS NOOB IS IN SCRIPTER HE JUST HELP ME LAST NIGHT ITS WAS NOT HELP....
// ACTUALLY HE DOWNLOAD OLD VERSION OF PLUGINS THATS WHY PROBLEM SOLVED...
//HE DOWNLOAD THIS FS FROM SOMEWHERE SO ITS TOTALLY FUCKED UP........

new DCC_Channel:g_WelcomeChannelId;

public 
OnPlayerText(playeridtext[])
{
    new 
name[MAX_PLAYER_NAME 1];
    
GetPlayerName(playeridnamesizeof name);
    new 
msg[128]; // The string. We do not need to have it larger than 128, because a message can't be larger than that.
    
format(msgsizeof(msg), "[%s] %s"nametext); // The formatted message. Remember, %s means string - the strings are associated with GetPlayerTeamName(playerid), respectively text.
    
DCC_SendChannelMessage(g_WelcomeChannelIdmsg);
    return 
true;
}

public 
DCC_OnChannelMessage(DCC_Channel:channelDCC_User:author, const message[])
{
    new 
channel_name[1441];
    if(!
DCC_GetChannelName(channelchannel_name))
    return 
0// invalid channel

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

       //if(!strcmp(author, "server-bot", true) || channel != Server[DiscordChannel]) return 0;
    
new str[145];
    
format(strsizeof str"[Discord/%s] %s: %s"channel_nameuser_namemessage);
    
SendClientMessageToAll(-1str);
    return 
1;
}

public 
OnFilterScriptInit()
{
g_WelcomeChannelId DCC_FindChannelById("466244174631665675"); // Discord channel ID
return true;
}

public 
OnPlayerSpawn(playerid)
{
new 
name[MAX_PLAYER_NAME 1];
GetPlayerName(playeridnamesizeof name);

if (
_:g_WelcomeChannelId == 0)
g_WelcomeChannelId DCC_FindChannelById("466244174631665675"); // Discord channel ID

new str[128];
format(strsizeof str"Player %s joined the server."name);
DCC_SendChannelMessage(g_WelcomeChannelIdstr);
return 
true;

RJTabish is offline   Reply With Quote
Old 05/01/2019, 10:50 PM   #2
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default Re: Discord Bot Chat Problem Help Please

Your best bet is to add the following code to your DCC_OnChannelMessage callback:

Code:
if(strcmp(user_name, "Your_Bot_Name", true) == 0) return 0;
(make sure you add this code after the user_name variable is declared)

obviously replacing Your_Bot_Name with the username of your bot.

This will block the bot from sending the message in-game.
Chyakka 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
[FilterScript] Discord Admin Control Panel - Manage players through discord! Exhibit Filterscripts 34 12/08/2020 04:28 PM
[FilterScript] Discord Chat - Real time chatting ( Discord + In Game) Exhibit Filterscripts 36 16/10/2019 08:32 PM
[Ajuda] Discord ??? Syxh0wN Português/Portuguese 3 21/11/2018 05:08 PM
Discord for SA-MP? Lorenc_ Plugin Development 83 05/02/2017 07:01 PM


All times are GMT. The time now is 01:15 AM.


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