[FREE] [STANDALONE] World Interaction

3Core Interaction System

Cool script I found lying around in my old server files.
It’s using the mouse position to interact with the 3D world.

The script is running on 0.00 ms all the time so if you are searching for a cool and optimized interaction script for your server, you found it.

The script supports 5 different interaction types:

  • Entity Bone - interact with the bones of any entity. eg - open / close the vehicle left / right door.
  • Ped Bone - interact with the bones of any player. eg - move the left / right hand.
  • Prop - interact with every game prop. eg - store cash register.
  • Entity - interact with every game entity. eg - created ped.
  • Player - interact with every player in the server. eg - cuff / uncuff for police officers.

To get mouse focus for the interaction, press Left ALT (this keybind can be changed ingame: SETTINGS > Key Bindings > FiveM > Open Interaction Mouse).

Examples for every option can be found in the example.lua file.

Game Preview

Available Exports

AddEntityBone

exports['3core-interaction']:AddEntityBone({
    # Bone names can be found here: https://docs.fivem.net/natives/?_0xFB71170B7E76ACBA
    Bone = 'door_dside_f',
    Options = {
        {
            # Menu item icon (optional)
            Image = '',
            # Menu item title (optional)
            Title = 'Police',
            # Menu item subtitle (optional)
            SubTitle = 'Search, cuff, escort, etc..',
            # Condition check. If true was returned, the item will be shown. eg - job check.
            CanShow = function()
                return true
            end,
            # Will be triggered when the player clicked on the item.
            OnClick = {
                # client-event, server-event, command.
                Type = '',
                # Event / command name.
                Value = '',
                # Event arguments (optional)
                Args = {  },
                # Close the menu when clicked.
                Close = true 
            }
            # If you want the item to open another interaction menu, leave this and remove OnClick.
            # Submenus behave like a normal interact menu so all the above values are the same for the submenus. 
            SubMenu = {
                {
                    # Menu item icon (optional)
                    Image = '',
                    # Menu item title (optional)
                    Title = 'Police',
                    # Menu item subtitle (optional)
                    SubTitle = 'Search, cuff, escort, etc..',
                    # Condition check. If true was returned, the item will be shown. eg - job check.
                    CanShow = function()
                        return true
                    end,
                    # Will be triggered when the player clicked on the item.
                    OnClick = {
                        # client-event, server-event, command.
                        Type = '',
                        # Event / command name.
                        Value = '',
                        # Event arguments (optional)
                        Args = {  },
                        # Close the menu when clicked.
                        Close = true 
                    }
                }
            }
        }
    }
})

AddPedBone

exports['3core-interaction']:AddPedBone({
    # Bone ids can be found here: https://docs.fivem.net/natives/?_0xFB71170B7E76ACBA
    Bone = 0xDEAD,
    Options = {
        {
            # Menu item icon (optional)
            Image = '',
            # Menu item title (optional)
            Title = 'Police',
            # Menu item subtitle (optional)
            SubTitle = 'Search, cuff, escort, etc..',
            # Condition check. If true was returned, the item will be shown. eg - job check.
            CanShow = function()
                return true
            end,
            # Will be triggered when the player clicked on the item.
            OnClick = {
                # client-event, server-event, command.
                Type = '',
                # Event / command name.
                Value = '',
                # Event arguments (optional)
                Args = {  },
                # Close the menu when clicked.
                Close = true 
            }
            # If you want the item to open another interaction menu, leave this and remove OnClick.
            # Submenus behave like a normal interact menu so all the above values are the same for the submenus. 
            SubMenu = {
                {
                    # Menu item icon (optional)
                    Image = '',
                    # Menu item title (optional)
                    Title = 'Police',
                    # Menu item subtitle (optional)
                    SubTitle = 'Search, cuff, escort, etc..',
                    # Condition check. If true was returned, the item will be shown. eg - job check.
                    CanShow = function()
                        return true
                    end,
                    # Will be triggered when the player clicked on the item.
                    OnClick = {
                        # client-event, server-event, command.
                        Type = '',
                        # Event / command name.
                        Value = '',
                        # Event arguments (optional)
                        Args = {  },
                        # Close the menu when clicked.
                        Close = true 
                    }
                }
            }
        }
    }
})

AddProp

exports['3core-interaction']:AddProp({
    # All game props can be found here: https://forge.plebmasters.de/objects
    Prop = 'prop_till_01',
    Options = {
        {
            # Menu item icon (optional)
            Image = '',
            # Menu item title (optional)
            Title = 'Police',
            # Menu item subtitle (optional)
            SubTitle = 'Search, cuff, escort, etc..',
            # Condition check. If true was returned, the item will be shown. eg - job check.
            CanShow = function()
                return true
            end,
            # Will be triggered when the player clicked on the item.
            OnClick = {
                # client-event, server-event, command.
                Type = '',
                # Event / command name.
                Value = '',
                # Event arguments (optional)
                Args = {  },
                # Close the menu when clicked.
                Close = true 
            }
            # If you want the item to open another interaction menu, leave this and remove OnClick.
            # Submenus behave like a normal interact menu so all the above values are the same for the submenus. 
            SubMenu = {
                {
                    # Menu item icon (optional)
                    Image = '',
                    # Menu item title (optional)
                    Title = 'Police',
                    # Menu item subtitle (optional)
                    SubTitle = 'Search, cuff, escort, etc..',
                    # Condition check. If true was returned, the item will be shown. eg - job check.
                    CanShow = function()
                        return true
                    end,
                    # Will be triggered when the player clicked on the item.
                    OnClick = {
                        # client-event, server-event, command.
                        Type = '',
                        # Event / command name.
                        Value = '',
                        # Event arguments (optional)
                        Args = {  },
                        # Close the menu when clicked.
                        Close = true 
                    }
                }
            }
        }
    }
})

AddEntity

exports['3core-interaction']:AddEntity({
    # Valid entity handle
    Entity = 123,
    Options = {
        {
            # Menu item icon (optional)
            Image = '',
            # Menu item title (optional)
            Title = 'Police',
            # Menu item subtitle (optional)
            SubTitle = 'Search, cuff, escort, etc..',
            # Condition check. If true was returned, the item will be shown. eg - job check.
            CanShow = function()
                return true
            end,
            # Will be triggered when the player clicked on the item.
            OnClick = {
                # client-event, server-event, command.
                Type = '',
                # Event / command name.
                Value = '',
                # Event arguments (optional)
                Args = {  },
                # Close the menu when clicked.
                Close = true 
            }
            # If you want the item to open another interaction menu, leave this and remove OnClick.
            # Submenus behave like a normal interact menu so all the above values are the same for the submenus. 
            SubMenu = {
                {
                    # Menu item icon (optional)
                    Image = '',
                    # Menu item title (optional)
                    Title = 'Police',
                    # Menu item subtitle (optional)
                    SubTitle = 'Search, cuff, escort, etc..',
                    # Condition check. If true was returned, the item will be shown. eg - job check.
                    CanShow = function()
                        return true
                    end,
                    # Will be triggered when the player clicked on the item.
                    OnClick = {
                        # client-event, server-event, command.
                        Type = '',
                        # Event / command name.
                        Value = '',
                        # Event arguments (optional)
                        Args = {  },
                        # Close the menu when clicked.
                        Close = true 
                    }
                }
            }
        }
    }
})

GetLastEntity

# returns the last entity the player interacted with.
local entity = exports['3core-interaction']:GetLastEntity()

Other Releases

Code is accessible Yes
Subscription-based No
Lines (approximately) 500
Requirements None
Support Yes
12 Likes

Is there a video showcase?

Very very cool! How i can pass args to a client-event?

Added one, check game preview.

Neat interaction, what’s the difference between this and bt-target or any other target scripts?

Pushed an update to the github repo.
Now you can pass arguments in the OnClick data.

RegisterNetEvent('testevent', function(ar1, arg2, arg3)

end)

OnClick = {
    # client-event, server-event, command.
    Type = 'client-event',
    # Event / command name.
    Value = 'testevent',
    # Event arguments (optional)
    Args = { 'arg1', 'arg2', 123 },
    # Close the menu when clicked.
    Close = true 
}
1 Like

Basically the whole interaction system.
bg-target and most of the interaction systems out there using the “eye” to interact with the world.
Means you have to put the “eye” on the entity you want to interact with, this one uses your mouse.
With this interaction system you can pretty much interact with any object that is in the player’s fov at the same time. To interact with the world entities you will need to click on the entity with your mouse.
At the end of the day, both of them can do the same thing but with a different approach.

1 Like

Amazing thank you so much

Yours is better approach ofcourse, what about other peds like players and npcs, how u detect em?

I like the menu design, I was looking to use them without target system in some case, it’s possible? If it’s not fast/easy to do I will try to do it myself and share it.

I mean in some case I like for example just press E and open some function with submenu

image

All the player interactions goes here (shared/config.lua).
Peds interaction can be added by using the AddEntity export, when the passed entity is the ped handle.

Great Script, would love to see Polyzone Interactions and a option to see the name of the interaction through a label, so people will know if the prop/entity is interactable

function OpenMenu()
    local interactionData = { } -- Same values as in the "Options" parameter in the exports
    SendNUIMessage({ type = 'ShowInteraction', data = interactionData })
end
1 Like

When i try to call this i get this error:
SCRIPT ERROR: type ‘function’ is not supported by JSON

Pushed an update to the github repo that should hopefully fix this errors.
If you are still encountering problems with the new version, please open a ticket in our discord server and I’ll help you there.

1 Like

can you make a little tuto pls ?

Looks great, maybe a better UI and not a UI that looks like jim-shops.

2 Likes