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(messagemsgChannel);



    new 
channelName[128];

    
DCC_GetChannelName(msgChannelchannelNamesizeof(channelName));



    
printf("channelName: %s"channelName);

    if(
strcmp(channelName"sa-mp"true5) == 0)

    {

        new 
DCC_User:author;

        
DCC_GetMessageAuthor(messageauthor); // This always fails



        
if(author == DCC_INVALID_USER)

        {

            print(
"Invalid User");

            return;

        }

        

        new 
bool:IsBotbool:IsVerified;

        
DCC_IsUserBot(authorIsBot);

        
DCC_IsUserVerified(authorIsVerified);

        

        new 
authorName[DCC_USERNAME_SIZE];

        
DCC_GetUserName(authorauthorNamesizeof(authorName));



        
printf("Author: %s | IsBot: %d | IsVerified: %d"authorNameIsBotIsVerified );



        if(!
IsBot && IsVerified)

        {

            new 
string[128];

            new 
authorMessage[128];

            
DCC_GetMessageContent(messageauthorMessagesizeof(authorMessage));

            

            
format(stringsizeof(string), "[Discord/%s]: %s"authorNameauthorMessage);

            
SendClientMessageToAll(0x00C7FFAAstring);

        }

    }





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.