AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with the & sign (https://forums.alliedmods.net/showthread.php?t=341729)

Krystek. 02-09-2023 00:47

Problem with the & sign
 
HTML Code:

public SendHelp(id) {
        new message[128];
        formatex(message, charsmax(message), "content=<@&1029504517319954443>")
        GoRequest(id, WEBHOOK_HELP, "Handler_SendReason", GripRequestTypePost, message);       
}

public Handler_SendReason(const id){
        if(!is_user_connected(id))
                return;
}

public GoRequest(const id, const site[], const handler[], const GripRequestType:type, data[]){               
        new GripRequestOptions:options = grip_create_default_options();
        grip_options_add_header(options, "Content-Type", "application/x-www-form-urlencoded");
       
        new GripBody: body = grip_body_from_string(data);
        grip_request(site, body, type, handler, options, id);       
       
        grip_destroy_body(body);       
        grip_destroy_options(options);
}

I have such a code and everything would be great but when it is sent on discord it does not read the & sign..

The message looks like this <@ instead <@&1029504517319954443>

zXCaptainXz 02-09-2023 13:46

Re: Problem with the & sign
 
I'm not sure but maybe you need to escape the & with ^,
Try this instead <@^&1029504517319954443>

Krystek. 02-09-2023 13:54

Re: Problem with the & sign
 
Quote:

Originally Posted by zXCaptainXz (Post 2799144)
I'm not sure but maybe you need to escape the & with ^,
Try this instead <@^&1029504517319954443>

Then it returns me an error
HTML Code:

error 027: invalid character constant

AnimalMonster 02-09-2023 14:02

Re: Problem with the & sign
 
Quote:

Originally Posted by zXCaptainXz (Post 2799144)
I'm not sure but maybe you need to escape the & with ^,
Try this instead <@^&1029504517319954443>

That's what i thought at first but when i saw it's about some web sh*t i decided not to say it since i know it couldn't be

Krystek. 02-09-2023 14:06

Re: Problem with the & sign
 
According to client_print it returns fine https://i.imgur.com/5jai0qP.png
but not after sending https://i.imgur.com/1nEemmJ.png

AnimalMonster 02-09-2023 14:51

Re: Problem with the & sign
 
Quote:

Originally Posted by Krystek. (Post 2799149)
According to client_print it returns fine https://i.imgur.com/5jai0qP.png
but not after sending https://i.imgur.com/1nEemmJ.png

It's possible that it might think that's an adress...

fysiks 02-09-2023 23:08

Re: Problem with the & sign
 
Does it get encoded before sending? If not, maybe try manually encoding it? Not really sure what these grip functions are so I can't really check.

Napoleon_be 02-10-2023 04:21

Re: Problem with the & sign
 
Have u tried escaping the symbol? No idea if this would work here but that's how it's done in HTML.

HTML Code:

"&amp;"

Krystek. 02-10-2023 09:31

Re: Problem with the & sign
 
Quote:

Originally Posted by Napoleon_be (Post 2799210)
Have u tried escaping the symbol? No idea if this would work here but that's how it's done in HTML.

HTML Code:

"&amp;"

Unfortunately, that doesn't work either.

Napoleon_be 02-10-2023 09:44

Re: Problem with the & sign
 
And have u tried wrapping the string in seperate quotation marks?

I'm not at home right now so i can't check how it's done correctly, but it should look something like this:

"content=^"<@&1029504517319954443>^""


All times are GMT -4. The time now is 02:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.