Why doesn't the percent sign (%) show in the chat?
#1

While on the forum of a server I use, I saw that someone had created a thread saying that the percent sign doesn't show up in the chat. I joined a server I regularly use and logged in, and then typed % in the chat and pressed the enter key. I saw my name in the chat but only empty space next to it.

Does anyone know the answer? I do recall something about a certain character not being usable in the chat - I think it was because of a security-related issue - but I'm not sure.
Reply
#2

Security Issue with coding.
Reply
#3

Ah, okay thank you.
Reply
#4

Really annoying. This can't be fixed?
Reply
#5

Quote:

Really annoying. This can't be fixed?

Well not really afaik else they would've fixed it already? Anyways you can use % in your gamemode for example like this:

pawn Код:
new String[128];
       
format(String, sizeof(String), "100%s", "%%");
SendClientMessage(playerid, 0xFFFFFFAA, String);
This would show in the chat: 100%

'%' get's replaced by '#' right or was it '?'? Perhaps you can fetch '#' or '?' under OnPlayerText then replace it with % using the above method but I never tried that.
Reply
#6

I think in <0.2X it was replaced with '?', now it's replaced with a space.

I don't see why it's not fixable though, the server could replace it with '%%' if it's being formatted.
Reply
#7

You could try doing a lot of stuff with strfind though, and replace the string.

From the wiki:
Quote:

%% Inserts the literal '%

I'm unsure if it'd detect the % sign at OnPlayerText though. If so, try using strins to insert the '%%' into his msg?
Reply
#8

if a player enters things like %d, %f or %s then they could fuck up all the formated strings.

That is the reason why it got blocked. And replacing % with %% wouldn't help(still %%s).


Replacing it with a secret text serversided could work and then a clientsided script wich replaces this text again with a '%'.
Reply
#9

Quote:
Originally Posted by D0erfler
Посмотреть сообщение
and replacing % with %% wouldn't help(still %%s).
Did you try this? The reason '%%' is there is so '%' appears in a formatted string. '%' is merely an escape character like '\' is an escape character for Pawn strings which you escape with '\\'.

I would like to see '%' allowed back in chat again. It's easy to make counter measures against format attacks by filtering the string before parsing it into format, any half-decent scripter would know how to do this. I'm sure someone would post a generic function to do this for newbies anyhow.

http://en.wikipedia.org/wiki/Format_string_attack
Reply
#10

The answer is given on a silver platter, right here in this topic:

Quote:
Originally Posted by d0
Посмотреть сообщение
if a player enters things like %d, %f or %s then they could fuck up all the formated strings.

That is the reason why it got blocked. And replacing % with %% wouldn't help(still %%s).
What more explanation do you need?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)