Chatbox replaces % with #
#1

Is there a reason why i write % and the chat-box shows # instead?
Reply
#2

Yes, because '%' is the placeholder for variables. You can use '%%' to insert a literal percentage sign in format(), but you can't use it directly in chat.
Reply
#3

% is used with formatting messages. To avoid server crashing, The server replaces % with #.
Reply
#4

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
Yes, because '%' is the placeholder for variables. You can use '%%' to insert a literal percentage sign in format(), but you can't use it directly in chat.
I saw that I can use %% to insert literal % on the wiki, and I tried to replace any % in text[] under OnPlayerText() with str_replace("%","%%", text[]) but for some reason it didn't work...
PS: I am formating the player messages to insert [ID] after their name.
str_replace aquired from the wiki @ uf.inc
Reply
#5

'%' isn't sent to the text variable, you could for example use str_replace to search for '[percentage]' and try replace it with a literal percentage sign.
Reply
#6

I don't get your point? Isn't that what I said I tried above?
Reply
#7

Read my post properly.

You cannot search for '%s' in text, as it will be '#', your code searches for '%' and NOT '[percentage]' (my suggestion).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)