• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Plugin] Discord Connector invalid message author.
#1
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);

        }

    }

} 
  Reply
#2
Does this always print "Invalid User"?
Check out Desolation Roleplay, where zombie AI and scavenging is bothered by player bandits!


  Reply
#3
Yes, it always prints invalid user.
  Reply
#4
Upgrade to 0.3.4, it will tell you what is wrong.
  Reply
#5
Thanks missed the intend setting.
  Reply