05.01.2019, 16:11
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
Here is Code
PHP код:
#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(playerid, text[])
{
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof 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(msg, sizeof(msg), "[%s] %s", name, text); // The formatted message. Remember, %s means string - the strings are associated with GetPlayerTeamName(playerid), respectively text.
DCC_SendChannelMessage(g_WelcomeChannelId, msg);
return true;
}
public DCC_OnChannelMessage(DCC_Channel:channel, DCC_User:author, const message[])
{
new channel_name[1441];
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
//if(!strcmp(author, "server-bot", true) || channel != Server[DiscordChannel]) return 0;
new str[145];
format(str, sizeof str, "[Discord/%s] %s: %s", channel_name, user_name, message);
SendClientMessageToAll(-1, str);
return 1;
}
public OnFilterScriptInit()
{
g_WelcomeChannelId = DCC_FindChannelById("466244174631665675"); // Discord channel ID
return true;
}
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof name);
if (_:g_WelcomeChannelId == 0)
g_WelcomeChannelId = DCC_FindChannelById("466244174631665675"); // Discord channel ID
new str[128];
format(str, sizeof str, "Player %s joined the server.", name);
DCC_SendChannelMessage(g_WelcomeChannelId, str);
return true;
}