Skip to content
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

[Feature Request] Players / Deregister #1

Closed
benzon opened this issue Feb 6, 2024 · 5 comments
Closed

[Feature Request] Players / Deregister #1

benzon opened this issue Feb 6, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@benzon
Copy link

benzon commented Feb 6, 2024

Hey,
Love the idea you got going here.

Noticed you can target ped's wich is a very general term, what about specific players insted, so it could be used together with something like ox_inventory for give actions.

And a deregister, cant find any info so fare on how to deregister something you registred.

@swkeep swkeep added the enhancement New feature or request label Feb 6, 2024
@swkeep
Copy link
Owner

swkeep commented Feb 6, 2024

Hey,
I think it should be possible to do, I'll add it to my list.

About the deregister, there's an export called remove(id) that will delete the interaction BUT I intentionally left it out because there's a chance for it to crash the game. It needs some more work done to gracefully delete the interactions from memory (I also left the dynamic property because of the same issue)

swkeep added a commit that referenced this issue Feb 7, 2024
swkeep added a commit that referenced this issue Feb 7, 2024
@swkeep
Copy link
Owner

swkeep commented Feb 7, 2024

If you want to add an interaction on a player with server id of 2

exports['interactionMenu']:create {
    player = 2,
    offset = vec3(0, 0, 0),
    maxDistance = 1.0,
    options = {
        {
            label = 'Just On Player Id: 2',
            icon = 'fa fa-person',
            action = {
                type = 'sync',
                func = function(data)
                    Util.print_table(data)
                end
            }
        }
    }
}

If you want to have a global interaction with all player peds

exports['interactionMenu']:createGlobal {
    type = 'players',
    offset = vec3(0, 0, 0),
    maxDistance = 1.0,
    options = {
        {
            label = '[Debug] On All Players',
            icon = 'fa fa-person',
            action = {
                type = 'sync',
                func = function(data)
                    if not data.player then return end
                    local player = data.player

                    Util.print_table(player)
                end
            }
        }
    }
}

@benzon
Copy link
Author

benzon commented Feb 8, 2024

Ah okay, is there a way to deregister as well?

So when done using it, i can disable it straight away?

@benzon
Copy link
Author

benzon commented Feb 8, 2024

Hey, I think it should be possible to do, I'll add it to my list.

About the deregister, there's an export called remove(id) that will delete the interaction BUT I intentionally left it out because there's a chance for it to crash the game. It needs some more work done to gracefully delete the interactions from memory (I also left the dynamic property because of the same issue)

Ah okay hopefully it's something that will be sorted soon, since it's with out doubt going to be usefull.

@swkeep
Copy link
Owner

swkeep commented Feb 8, 2024

It's already there and you can use it. However, garbage collection is missing which means it doesn't clean up the memory it just disables the menu.

exports['interactionMenu']:remove(id)

@swkeep swkeep closed this as completed Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants