Networked Entity Interactions

This is an export function to add and remove Networked Entity Interactions.

Add Interactions

exports.rhd_interact:addEntity(netId, options)
  • params:

    • netId: number | number[]

    • options: InteractOptions[]

Remove Interactions

exports.rhd_interact:removeEntity(netId, optionName)
  • params:

    • netId: number | number[]

    • optionName?: string | string[]

Example:

  • Server Side

    RegisterCommand('createEntity', function (source, args)
        local model = joaat(args[1] or 'prop_dumpster_01a')
        local playerPed = GetPlayerPed(source)
        local coords = GetEntityCoords(playerPed)
    
        local entity = CreateObjectNoOffset(model, coords.x + 2, coords.y, coords.z, true, false, false)
        Wait(100)
    
        if not DoesEntityExist(entity) then
            print('Failed to create entity with model:', model)
            return
        end
    
        local netId = NetworkGetNetworkIdFromEntity(entity)
    
        local players = exports.rhd_fivem:getPlayersInScope(source)
        if not players then return end
    
        lib.triggerClientEvent('createInteract', players, netId)
    end, false)

  • Client Side

Last updated