Return Ped Entity from spawnPed Function for Improved Management and Deletion#209
Open
MrBolux wants to merge 2 commits intoqbcore-framework:mainfrom
Open
Return Ped Entity from spawnPed Function for Improved Management and Deletion#209MrBolux wants to merge 2 commits intoqbcore-framework:mainfrom
MrBolux wants to merge 2 commits intoqbcore-framework:mainfrom
Conversation
Qwerty1Verified
requested changes
Nov 12, 2024
| if nextnumber <= 0 then nextnumber = 1 end | ||
|
|
||
| Config.Peds[nextnumber] = data | ||
| createdPeds[#createdPeds + 1] = data.currentpednumber |
Member
There was a problem hiding this comment.
Could instead return early with the singular ped ID since data wouldn't be a table of peds in this instance.
|
|
||
| local function RemovePed(peds) | ||
|
|
||
| local function removePedByNumber(pedNumber) |
Member
There was a problem hiding this comment.
It looks like this could be a typo of placing a function declaration inside of a function declaration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe Pull Request
This pull request addresses the issue where the
spawnPedfunction does not return the ped entity, which prevents proper management and deletion of the peds after they are spawned. By updating the function to return the ped, it will allow developers to manage spawned peds more effectively, including actions like tracking, modifying, or deleting them later in the script.What this PR adds or fixes:
spawnPedfunction now returns the ped entity after creation.This change ensures better ped lifecycle management, especially in scenarios where multiple peds are created and need to be tracked or handled individually.
Issue
This PR fixes the issue where peds created by the
spawnPedfunction were not returned, making it difficult to control or delete them later.Questions: