pawn-lang / YSI-Includes

Just the YSI include files, none of the extra stuff.
211 stars 106 forks source link

va_args stopped working after update #659

Open MateusArthur opened 1 year ago

MateusArthur commented 1 year ago

stock fmat(const fmat[], va_args<>) { new str[400]; va_format(str, sizeof(str), fmat, va_start<1>); return str; }

As an example, this function is no longer formatting a string correctly, it just returns empty formatting:

Code SendClientMessage(playerid, -1, fmat("My name is %s!", PlayerName(playerid)));

Output: My Name is !

And in the terminal we have the following warning:

*** YSI Warning: Bare ___ usage found - make sure it is a function parameter.

Sesomsoma commented 11 months ago

Use va_SendClientMessage(playerid, -1, "My name is %s!", PlayerName(playerid));

MateusArthur commented 11 months ago

Use va_SendClientMessage(playerid, -1, "My name is %s!", PlayerName(playerid));

Yes, I tried that, it has the same problem, I think it might be my compiler version: Pawn compiler 3.10.10

Sesomsoma commented 11 months ago

Uhm. Try this:

#include <YSI\y_va>

stock SendClientMessageEx(playerid, colour, const fmat[], va_args<>) { new str[145]; va_format(str, sizeof (str), fmat, va_start<3>); return SendClientMessage(playerid, colour, str); }

Y-Less commented 7 months ago

That compiler should be fine. Which YSI version are you on?

Y-Less commented 7 months ago

And does this still happen? I can't reproduce it.

MateusArthur commented 7 months ago

And does this still happen? I can't reproduce it.

Yes, this still happens, I use the latest version that was available at the end of last year. I didn't change anything about the project until then.

info: `*** Streamer Plugin: The plugin version (0x295) is older than the include file version (0x296) for this script. The plugin might need to be updated to the latest version.

     ==============================================================
     |                                                            |
     |                                                            |
     |    YYYYYYY       YYYYYYY    SSSSSSSSSSSSSSS  IIIIIIIIII    |
     |    Y:::::Y       Y:::::Y  SS:::::::::::::::S I::::::::I    |
     |    Y:::::Y       Y:::::Y S:::::SSSSSS::::::S I::::::::I    |
     |    Y::::::Y     Y::::::Y S:::::S     SSSSSSS II::::::II    |
     |    YYY:::::Y   Y:::::YYY S:::::S               I::::I      |
     |       Y:::::Y Y:::::Y    S:::::S               I::::I      |
     |        Y:::::Y:::::Y      S::::SSSS            I::::I      |
     |         Y:::::::::Y        SS::::::SSSSS       I::::I      |
     |          Y:::::::Y           SSS::::::::SS     I::::I      |
     |           Y:::::Y               SSSSSS::::S    I::::I      |
     |           Y:::::Y                    S:::::S   I::::I      |
     |           Y:::::Y                    S:::::S   I::::I      |
     |           Y:::::Y        SSSSSSS     S:::::S II::::::II    |
     |        YYYY:::::YYYY     S::::::SSSSSS:::::S I::::::::I    |
     |        Y:::::::::::Y     S:::::::::::::::SS  I::::::::I    |
     |        YYYYYYYYYYYYY      SSSSSSSSSSSSSSS    IIIIIIIIII    |
     |                                                            |
     |                                                            |
     |                      (c) 2021 MPL v1.1                     |
     |            Alex "Y_Less" Cole and contributors.            |
     |                                                            |
     |                                                            |
     ==============================================================
========================================== Generating code, this may take a little bit of time. Note that this code generation works best with the JIT plugin, which you are not currently using. Get it here:
https://git.io/jit-plugin
Please wait...
Done in 118ms!
========================================== Filterscript '../scriptfiles/callbackfix.amx' loaded. *** YSI Info: Script ID: 1 Server: 0.3.7-R2 (W) Started: 24 Apr 2024 - 21:07:20
Compiler: 3.10.10 (Windows)
Includes: 0.3.7
Codepage:
Built: 24 Apr 2024 - 21:07:12
YSI: v05.09.0982
Master: 1
JIT:
Crashdetect:
========================================== Unable to check the latest YSI version - please watch the forums and github:
https://git.io/5.x

==========================================

*** YSI Warning: Bare ___ usage found - make sure it is a function parameter. VALOR 0 VALOR 25`

code:

new valor = 25;
    print(fmat("VALOR %d", valor));
    printf("VALOR %d", valor);