SA-MP Forums Archive
How To Run Discord Connector ?? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How To Run Discord Connector ?? (/showthread.php?tid=659221)



How To Run Discord Connector ?? - RJTabish - 27.09.2018

Hello hi i got an problem in running discord chatting system in the server i got all information of discord connector i did same thing i create bot i also invite it and i also include bot token in server cfg when i'm trying to open server then its is getting online status but chat is not working what should i do sir
variable
PHP Code:
new DCC_Channel:g_WelcomeChannelId; 
Onplayertext
PHP Code:
    new name[MAX_PLAYER_NAME + 1];
    
GetPlayerName(playerid, name, sizeof name);
    
g_WelcomeChannelId = DCC_FindChannelByName("discord widget server id"); // Discord channel ID
    
new str1[128];
    
format(str1, sizeof str1, "[Server] %s: %s", name, text[1]);
    
DCC_SendChannelMessage(g_WelcomeChannelId, str1); 
Other Code

PHP Code:
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 str[145];
    
format(str, sizeof str, "[Discord/%s] %s: %s", channel_name, user_name, message);
    
SendClientMessageToAll(-1, str);
    return 
1;
} 
Please Help i'm trying it since 2 weeks thanks in advance
I Have 3 server channels like announcement section chat section and rules section i want to add this system in chat section please


Re: How To Run Discord Connector ?? - AzaMx - 27.09.2018

Try make it like this

PHP Code:
    new name[MAX_PLAYER_NAME + 1]; 
    
GetPlayerName(playerid, name, sizeof name); 
    if (
_:g_WelcomeChannelId == 0) //this one missing.
    
g_WelcomeChannelId = DCC_FindChannelByName("discord widget server id"); // Discord channel ID 
    
new str1[128]; 
    
format(str1, sizeof str1, "[Server] %s: %s", name, text[1]); 
    
DCC_SendChannelMessage(g_WelcomeChannelId, str1); 



Re: How To Run Discord Connector ?? - v1k1nG - 27.09.2018

You need to read plugin's thread more carefully


Re: How To Run Discord Connector ?? - RJTabish - 28.09.2018

have a look i think this is channel id right ?


Re: How To Run Discord Connector ?? - v1k1nG - 28.09.2018

Nope to be able to see channel ids you need to enable developer mode in settings
https://discordia.me/developer-mode