View Full Version : Print "%" percent symbol in console
Is there a way to show the "%" symbol in console with PrintToConsole?
The "%" symbol is reserved to print variables (%d prints an integer, %f a float, etc)
I tried using "%%" but it doesn't show the symbol.
thecount
02-22-2016, 20:02
How are you using it? Because "%%" should definitely work.
I'm using VFormat, which seems to replace my %% by spaces.
void f(const char[] s, ...)
{
decl String:buf[512];
VFormat(buf, sizeof(buf), s, 2);
PrintToServer("%s", buf);
}
asherkin
02-23-2016, 04:31
As Miu indicates, you were probably double-formatting by passing the formatted buffer as the first arguments to PrintToServer (which is a massive security bug).
Yes it was a multiple formatting error :) Thanks guys!
In my case my error was to do
PrintToConsole(client, buf);
instead of
PrintToConsole(client, "%s", buf);
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.