SA-MP Forums Archive
[Bug?] Percent character - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Bug?] Percent character (/showthread.php?tid=197528)



[Bug?] Percent character - woot - 09.12.2010

Can't get my percent character working anymore, currently using RC3 Server & RC3-3 Client.

ex.
pawn Код:
SendClientMessage( playerid, -1, "Hi there, you are 97%% homo.");
Before (0.3b) it would show up: 97%
Now (0.3c) it shows up as: 97


Re: [Bug?] Percent character - JernejL - 09.12.2010

Before in 0.3b using % in sendclientmessage would crash the server.


Re: [Bug?] Percent character - The_Moddler - 09.12.2010

So no way of using %?




Re: [Bug?] Percent character - __ - 09.12.2010

Quote:
Originally Posted by The_Moddler
Посмотреть сообщение
So no way of using %?

You can still use it in format() as far as I know, but according to this report, not alone in SendClientMessage().


Re: [Bug?] Percent character - woot - 09.12.2010

Actually I used it in format() and that's where it doesn't work. That SendClientMessage() was a random make-up - didn't test in it, but I guess there is no difference!?


Re: [Bug?] Percent character - __ - 09.12.2010

Quote:
Originally Posted by exora
Посмотреть сообщение
Actually I used it in format() and that's where it doesn't work. That SendClientMessage() was a random make-up - didn't test in it, but I guess there is no difference!?
Not exactly... If my "theory" is valid;

format() was coded to be capable for handling percentages for variables, whereas I don't believe that SendClientMessage() was, it just handles the data its given, and format compiles a string with the strings (if any) and text to send as a client message when used together.

format accepts %% insert a literal percentage, so SendClientMessage() would not (at least I think...) as it's just expecting a string with normal data to parse.

I don't quite understand why % wouldn't work in a SendClientMessage() execution though, if ^ is correct.


Re: [Bug?] Percent character - leong124 - 09.12.2010

+1.
Before 0.3b(and even 0.3C RC3-3), "%%" or "%" in SendClientMessage/Player Chat= nothing.
Seems that "%%" in format is usable before 0.3C RC3-3 but now it can't.
It can only be used in dialogs.
I still hope that can be fixed for sure.


Re: [Bug?] Percent character - The_Gangstas - 09.12.2010

%% works for textdraws and dialogs, not sure about gametexts.

% just sends nothing in chat.


Re: [Bug?] Percent character - CodeRae - 09.12.2010

If you are using SendClientMessage etc. to send a formatted string you need to use %%%%

new str[10]; format(str,sizeof(str),"%d %%%%",25);
SendClientMessage(playerid,0xFFFFFFFF,str);

^ Will output 25 % in game

If you put %% in your string, SendClientMessage interprets this as %, therefore not showing a % in game.

If you put %%%% in your string, SendClientMessage interprets this as %% and will then display a % in game.


Re: [Bug?] Percent character - cessil - 09.12.2010

woah thanks CodeRae, I didn't think it was possible