open.mp forum
[Plugin] Discord Connector invalid message author. - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Plugin] Discord Connector invalid message author. (/showthread.php?tid=1308)



Discord Connector invalid message author. - XeroX - 2020-11-03

Hi,



it's been sometime since I last scritped for sa-mp. Anyway my problem is that DCC_GetMessageAuthor returns an invalid user and I'm not entirely sure why.

Plugin version is 0.3.3



PHP Code:
public DCC_OnMessageCreate(DCC_Message:message) { new DCC_Channel:msgChannel; DCC_GetMessageChannel(message, msgChannel); new channelName[128]; DCC_GetChannelName(msgChannel, channelName, sizeof(channelName)); printf("channelName: %s", channelName); if(strcmp(channelName, "sa-mp", true, 5) == 0) { new DCC_User:author; DCC_GetMessageAuthor(message, author); // This always fails if(author == DCC_INVALID_USER) { print("Invalid User"); return; } new bool:IsBot, bool:IsVerified; DCC_IsUserBot(author, IsBot); DCC_IsUserVerified(author, IsVerified); new authorName[DCC_USERNAME_SIZE]; DCC_GetUserName(author, authorName, sizeof(authorName)); printf("Author: %s | IsBot: %d | IsVerified: %d", authorName, IsBot, IsVerified ); if(!IsBot && IsVerified) { new string[128]; new authorMessage[128]; DCC_GetMessageContent(message, authorMessage, sizeof(authorMessage)); format(string, sizeof(string), "[Discord/%s]: %s", authorName, authorMessage); SendClientMessageToAll(0x00C7FFAA, string); } } }



RE: Discord Connector invalid message author. - Awide - 2020-11-03

Does this always print "Invalid User"?


RE: Discord Connector invalid message author. - XeroX - 2020-11-03

Yes, it always prints invalid user.


RE: Discord Connector invalid message author. - Josh - 2020-11-03

Upgrade to 0.3.4, it will tell you what is wrong.


RE: Discord Connector invalid message author. - XeroX - 2020-11-03

Thanks missed the intend setting.