Open AmyrAhmady opened 8 months ago
I can't believe fixes.inc
missed those cases for a decade! Thanks for your amazing contribution to the SA-MP community.
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 OnPlayerConnect
isn't called in gamemode when it starts! It's called when "server" is restarted, not your gamemode, not your filterscript, the entire server therefore it has to emulate player disconnecting and reconnecting for all scripts on server restarts, because you want your players to join again when you stop and start again. I'm so sorry if samp client fakes server rejoin!
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 calledFIX_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!