[Feature Request] Players / Deregister
benzon opened this issue · 5 comments
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.
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)
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
}
}
}
}
Ah okay, is there a way to deregister as well?
So when done using it, i can disable it straight away?
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.
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)