Discord Help - 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: Discord Help (
/showthread.php?tid=638978)
Discord Help -
baki - 09.08.2017
Anyone can help me i can see the player\'s messages from discord IG but i dont see the In Game messages in Discord if you understand me is there any way to make the in game messages appear in Discord? I would be thankful if you helped me
OnPlayerSpawn
PHP Code:
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof name);
if (_:g_WelcomeChannelId == 0)
g_WelcomeChannelId = DCC_FindChannelById("344516361097052161"); // Discord channel ID
new str[128];
format(str, sizeof str, "Player %s joined the server.", name);
DCC_SendChannelMessage(g_WelcomeChannelId, str);
PHP Code:
public DCC_OnChannelMessage(DCC_Channel:channel, const author[], const message[])
{
new tmp[ 144 ];
format(tmp, sizeof (tmp), "[discord: %s]: {FFFFFF}%s", author, message);
SendClientMessageToAll(-1, tmp);
return true;
}
Re: Discord Help -
Xeon™ - 09.08.2017
Hello.
this code is fine. what\'s your problem?
also i\'d recommand to use name instand of Channel id.
DCC_FindChannelByName(name[])
Re: Discord Help -
baki - 09.08.2017
Quote:
Originally Posted by XeonMaster
Hello.
this code is fine. what\'s your problem?
also i\'d recommand to use name instand of Channel id.
DCC_FindChannelByName(name[])
|
I can only receive bot message when somebody join from IG server in Discord also the server receives Discord messages to IG
I want IG player messages to be sent in Discord if you understand
can you help me with this?
Re: Discord Help -
baki - 09.08.2017
bump
Re: Discord Help -
baki - 09.08.2017
So solved this with this
OnPlayerText
PHP Code:
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof name);
g_PlayerTypes = DCC_FindChannelByName("echo_channel"); // Discord channel ID
new str3[128];
format(str3, sizeof(str3), "[Server] %s: %s", name, text[1]);
DCC_SendChannelMessage(g_PlayerTypes, str3);
return 1;
It sends messages pretty great now...