The runningAnim function is designed to play a specific animation for a player's ped (character) in FiveM. Here's a detailed breakdown of what the function does:
The function takes four parameters: animDict (the name of the animation dictionary), animName (the name of the animation within the dictionary), duration (the duration of the animation in milliseconds), and upperbodyOnly (a boolean indicating whether the animation should only affect the upper body of the ped).
It starts by creating a new promise, animPromise, which will be used to handle the asynchronous nature of loading and playing the animation.
The function then checks if animDict and animName are strings. If not, it rejects the promise with an error message and returns.
It checks if the animation dictionary exists. If not, it rejects the promise with an error message and returns.
It sets the animation flags based on the upperbodyOnly parameter. If upperbodyOnly is true, the flags are set to 16, otherwise, they are set to 0. If the duration is -1 (indicating the animation should loop indefinitely), the flags are set to 49.
It gets the player's ped and the current game time.
It enters a loop where it requests the animation dictionary and waits until it's loaded. If the dictionary isn't loaded within 5 seconds, it rejects the promise with an error message and returns.
Once the animation dictionary is loaded, it plays the animation on the player's ped using TaskPlayAnim.
It waits for a short time to allow the animation to start, then gets the duration of the animation using GetAnimDuration.
If the animation duration is 0 (indicating the animation doesn't exist), it rejects the promise with an error message and returns.
It calculates the full duration of the animation in milliseconds and sets the wait time to the minimum of the provided duration and the full duration.
It waits for the duration of the animation, then removes the animation dictionary.
Finally, it resolves the promise with the current time, indicating when the animation concluded.
* [Update] Stuff and Things - Fix Exploit
- Update doors on teleport so they don't get stuck (requires my doorlock PR that creates a updateDoors() export
- Support for heading with TeleportToCoords event
- Support for teleporting to location name with /tp and a default file with locations to use
- Remove 'QBCore:Server:AddItem' event (requires PR to other resources that use it)
- Support for an array of items that do the same thing with QBCore.Functions.CreateUsableItem
- Player exists check before removing or adding permission
- Trigger OnPlayerUnload as a server side event too
- Player.Functions.GetMetaData function
- Added reason to money remove logs
- Set dirt level to 0 on /car vehicles
* Export to Event
* Deprecate instead of remove?
* Player+License verification fix
* Update events.lua
* Export change for qb-management
* [Hotfix] Errors after Merge
* [Change] src to source
* Prevent people using /me to troll
This prevents people using that /me troll with the huge font size and different colors.
* Remove DoorUpdate event
* Update client/events.lua
Co-authored-by: BerkieBb <82737367+BerkieBb@users.noreply.github.com>
* Update server/functions.lua
Co-authored-by: BerkieBb <82737367+BerkieBb@users.noreply.github.com>
* Adjustments for BB
* Linting
* fix(server/functions): use indexed variables
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/events): remove unnecessary _
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/events): remove unnecessary _'s
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/events): language
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/events): language
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/events): language
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/events): language
Co-authored-by: David Malchin <malchin459@gmail.com>
* chore(server/player): indentation
Co-authored-by: David Malchin <malchin459@gmail.com>
* [Chore] Remove Money
Removed repetitive code that made zero sense
* Update en.lua
* Update player.lua
* Update player.lua
* Update functions.lua
Co-authored-by: ItsANoBrainer <itsanobrainergg@protonmail.com>
Co-authored-by: Scullyy <51968381+Scullyy@users.noreply.github.com>
Co-authored-by: Idris Dev <IdrisDose@users.noreply.github.com>
Co-authored-by: Idris <idrisdev@gmail.com>
Co-authored-by: BerkieBb <82737367+BerkieBb@users.noreply.github.com>
Co-authored-by: David Malchin <malchin459@gmail.com>
Co-authored-by: Chris Usiak <christopher.usiak@oakland.k12.mi.us>
- This function has an issue with some references of blips and the usage is not very user friendly, no need for this because local functions are better