-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add fixes for OnPlayerSpawn, OnPlayerKeyStateChange, OnPlayerStateChange #181
base: master
Are you sure you want to change the base?
Conversation
Player obviously has a state!
Maybe player is holding a key so your script never knows it's happening unless they press or unpress another key
I can't believe |
What about OnVehicleSirenStateChange? Should be very similar to KeyStateChange yet missed. |
What about this callbacks? I think they are should be in the list too.
|
Are these callbacks called in a gamemode when it starts? |
Of course not! I didn't know that's an important factor for this, because And if it's an important thing to consider, then my apologies, I forgot to add another fix to call OnGameModeInit when a filterscript starts at runtime, because that's the one and only callbacks that gets called when a gamemode is generally started. So please, let me know if I should add this one too! because then we are missing it on filterscript reload! |
This PR has been approved by me. |
This amazing PR adds three new fixes to one of the most used libraries of SA-MP community.
1. OnPlayerSpawn
I noticed while
OnPlayerConnect
is called when a filterscript loads, fixes.inc doesn't callOnPlayerSpawn
for all spawned players. So imagine this situation: What if players are already spawned and user is doing some sort of initialization like some sort of cheat detection or something, and when script is loaded mid-game, that type of code never runs for players who are already spawned! This is such an important and required fix!Also this fix internally is called
FIX_OnPlayerSpawnCall
sinceFIX_OnPlayerSpawn
is taken. But I guess it shouldn't be a problem, if it is, let me know, I offer to quickly modify it based on your preferences.2. OnPlayerKeyStateChange
Just like
OnPlayerSpawn
but this time for keys. What if a player is already holding a key and you load your filterscript? Then script'sOnPlayerKeyStateChange
would never get called, because there's no change yet! You may ask well why even call it then since there's no change? That's because players are already connected so why are you calling OnPlayerConnect? To fix it!3. OnPlayerStateChange
This works just like both above, I need my filterscript to be aware when it's loaded and there are players in different states
Note:
This is my first time contributing to fixes.inc project, if there's any problem in my code and it goes against fixes.inc guidelines, let me know because I'm offering to fix my own mistakes for free. Thanks!