Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

va_args stopped working after update #659

Open
MateusArthur opened this issue Nov 23, 2023 · 6 comments
Open

va_args stopped working after update #659

MateusArthur opened this issue Nov 23, 2023 · 6 comments

Comments

@MateusArthur
Copy link

MateusArthur commented Nov 23, 2023

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
Copy link

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

@MateusArthur
Copy link
Author

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
Copy link

Sesomsoma commented Dec 27, 2023

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
Copy link
Member

Y-Less commented Apr 24, 2024

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

@Y-Less
Copy link
Member

Y-Less commented Apr 24, 2024

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

@MateusArthur
Copy link
Author

MateusArthur commented Apr 25, 2024

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants