-
Notifications
You must be signed in to change notification settings - Fork 33
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
SetPlayerName return problem #28
Comments
That's not a bug, it's a feature. |
Well, it would still be nice to know if the function failed instead. An alternative until this is fixed (if, it is) would be to just hook the function and test the name yourself. |
What do you mean by failing ? The -1 and 0 returns are exactly for that. At this moment I just unloaded the plugin, because I'm not using anything from it. I started using YSF again a few weeks ago just by loading the plugin, I wanted to see if there are no bugs and it seems like it was a good decision. |
No, I mean we should have the |
Will be fixed later today when I arrive from fucking school :D Thanks. E: Fixed. |
SetPlayerName return values:
It returns the good values without this plugin, but with it I get only the 0 and 1 returns:
As I can see in the Scripting.cpp code, you ALWAYS return 1 if SetPlayerName returns NON-ZERO. You should return SetPlayerName's return value (with plugin's name validity check). Also, you should reset player's name for other players only if SetPlayerName returned 1.
Maybe you should also make SetPlayerNameForPlayer support those return values ? (I don't actually use this function)
How I discovered this (creative players discovering things again): I have a name changing system based on those returns and it messed up some players accounts (who changed to invalid names). They complained that they were able to change names to things like "#invisible ||" and "J O H N C E N A" as SetPlayerName returns 1 and the script updates the player's database row's name because of it. When he connects with that new name (which wasn't set in-game the last time but got updated in database because of return 1) SA:MP tells him that his name is invalid, as it should. Result: the player lost his account and I have to manually change his account's name to a valid one directly from the database.
TL;DR: Bug: SetPlayerName never returns -1.
The text was updated successfully, but these errors were encountered: