This include allows you to forget once and for all about the problem of players falling through the floor in interiors, as well as prolonged loading during which the player arrives frozen.
The script contains 2 main functions:
- Creating a static platform - before teleportation, an invisible platform is created under the player that prevents falling through the floor.
- "Rescue" system - if the player still starts falling after teleportation, the script automatically teleports them back to the location of their last teleportation.
To apply the fix, simply include the InteriorFallFix.inc file in your code. Do this after your main includes and anti-cheat hooks.
#include <InteriorFallFix>- If your mode has freezes when teleporting players between interiors - disable them.
For the rescue platform generation to work, you need to insert a call to IFX_GeneratePlatform in the function that also receives the virtual world along with the interior when teleporting the player. Usually it's called SetPlayerPosEx.
The function accepts the following parameters:
playerid- player IDoldworld- player's virtual world before teleportation (or -1)newworld- player's virtual world after teleportation (or -1)oldint- player's interior before teleportation (or -1)newint- player's interior after teleportation (or -1)x, y, z- teleportation coordinates
Use before teleportation if you need to disable the fall rescue attempt:
IFX_DisableAttempt();
// Your teleportation
SetPlayerPos(playerid, x, y, z);The script automatically intercepts the SetPlayerPos function, so no additional setup is required. With each call to SetPlayerPos, the script automatically tracks teleportations and saves coordinates for subsequent fall checks.
The include has several definitions that allow you to configure it. To change a value, define it before including the file, or modify it directly inside the include.
The time (in milliseconds) after the last teleport during which the script will check if the player is falling:
#define IFX_FixTime 7000The time for which a static platform will be created under the player in the interior (in milliseconds):
#define IFX_InteriorPlatformTime 4000The time for which a static platform will be created under the player in the exterior (in milliseconds):
#define IFX_ExteriorPlatformTime 2000Where to get information about which interior the player is in:
#define IFX_GetPlayerInterior(%0) GetPlayerInterior(%0)It is recommended to set up your own function or variable to properly work with anti-cheat, preventing unauthorized movement between interiors (if your anti-cheat doesn't intercept GetPlayerInterior).
The delay between script checks in OnPlayerUpdate (in milliseconds):
#define IFX_PlayerUpdateCD 250Lower values mean more frequent checks and reduced performance.
The Z coordinate offset downward, upon reaching which the script will consider the player falling into the abyss:
#define IFX_FallZShift 0.2timmylich. | VKontakte | Telegram | Discord
Originally for Brentwood Project
