|
| 1 | +--- |
| 2 | +title: it_bridge | Client Exports - Interactions |
| 3 | +description: Learn how to use the client Interactions exports for the it_bridge resource. |
| 4 | +--- |
| 5 | + |
1 | 6 | import { Callout } from '@components/Callout'
|
2 | 7 |
|
3 |
| -<Callout type="waring"> |
4 |
| - Currently not available. |
5 |
| -</Callout> |
| 8 | +# Client |
| 9 | +<Callout type="warning"> |
| 10 | + These exports can only be used on the client-side. Make sure to use them in your client-side script files. |
| 11 | +</Callout> |
| 12 | + |
| 13 | + |
| 14 | +### Interactions Options |
| 15 | +```lua |
| 16 | +{ |
| 17 | + label = 'string', -- The label of the interaction. |
| 18 | + name = 'string', -- The name of the interaction. |
| 19 | + icon = 'string', -- The icon of the interaction. |
| 20 | + item = {}, -- List of item you need to have to use the interaction. |
| 21 | + groups = {}, -- List of groups you need to have to use the interaction. |
| 22 | + canInteract = function(entity, distance), -- Function to check if the player can interact with the entity. |
| 23 | + onSelect = function(entity), -- Function to execute when the player selects the interaction. |
| 24 | + distance = number, -- The distance the player needs to be to interact with the entity. |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +If you want your script to work with all Disptach systems that are integrated in it-brige please make sure that you enter all these data |
| 29 | + |
| 30 | +## CreateBoxZone |
| 31 | +```lua |
| 32 | +exports.it_bridge:CreateBoxZone(options, boxData) |
| 33 | +``` |
| 34 | + |
| 35 | +- options: `table`: The options of the box zone. |
| 36 | +- boxData: `table`: The data of the box zone. |
| 37 | + |
| 38 | +Creates a box zone with the specified data. |
| 39 | + |
| 40 | +### BoxData |
| 41 | +```lua |
| 42 | +{ |
| 43 | + coords = vector3, -- The coordinates of the box zone. |
| 44 | + size = vector3, -- The size of the box zone. |
| 45 | + rotation = number, -- The rotation of the box zone. |
| 46 | + debug = boolean, -- If the box zone should be debugged. |
| 47 | + drawSprite = boolean, -- If the box zone should draw a sprite. |
| 48 | + minZ = number, -- The minimum Z value of the box zone. |
| 49 | + maxZ = number, -- The maximum Z value of the box zone. |
| 50 | + interactDistance = number, -- The distance the player needs to be to interact with the box zone. |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +**Example** |
| 55 | +```lua |
| 56 | +exports.it_bridge:CreateBoxZone({ |
| 57 | + label = 'Example Box Zone', |
| 58 | + name = 'example_box_zone', |
| 59 | + icon = 'fas fa-box', |
| 60 | + canInteract = function(entity, distance) |
| 61 | + return distance < 2.5 |
| 62 | + end, |
| 63 | + onSelect = function(entity) |
| 64 | + print('You have interacted with the box zone.') |
| 65 | + end, |
| 66 | + distance = 2.5, |
| 67 | +}, { |
| 68 | + coords = vector3(0.0, 0.0, 0.0), |
| 69 | + size = vector3(2.5, 2.5, 2.5), |
| 70 | + rotation = 0.0, |
| 71 | + debug = true, |
| 72 | + drawSprite = true, |
| 73 | + minZ = 0.0, |
| 74 | + maxZ = 3.0, |
| 75 | + interactDistance = 2.5, |
| 76 | + }) |
| 77 | +``` |
| 78 | + |
| 79 | +## AddTargetEntity |
| 80 | +```lua |
| 81 | +exports.it_bridge:AddTargetEntity(entities, options) |
| 82 | +``` |
| 83 | + |
| 84 | +- entities: `table | number`: The entities to add as target entities. |
| 85 | +- options: `table`: The options of the target entities. |
| 86 | + |
| 87 | +Return all options that where added to the entities. |
| 88 | + |
| 89 | +Adds the specified entities as target entities. |
| 90 | + |
| 91 | +**Example** |
| 92 | +```lua |
| 93 | +local targetData = exports.it_bridge:AddTargetEntity(netId, { |
| 94 | + label = 'Example Entity', |
| 95 | + icon = 'fas fa-user', |
| 96 | + canInteract = function(entity, distance) |
| 97 | + return distance < 2.5 |
| 98 | + end, |
| 99 | + onSelect = function(entity) |
| 100 | + print('You have interacted with the entity.') |
| 101 | + end, |
| 102 | + distance = 2.5, |
| 103 | +}) |
| 104 | +``` |
| 105 | + |
| 106 | +## RemoveTargetEntity |
| 107 | +```lua |
| 108 | +exports.it_bridge:RemoveTargetEntity(entities, options) |
| 109 | +``` |
| 110 | + |
| 111 | +- entities: `table | number`: The entities to remove as target entities. |
| 112 | +- options: `table`: The options of the target entities. |
| 113 | + |
| 114 | +Return all options that where removed from the entities. |
| 115 | +Removes the specified entities as target entities. |
| 116 | + |
| 117 | +**Example** |
| 118 | +```lua |
| 119 | +local removed = exports.it_bridge:RemoveTargetEntity(netId, targetData) |
| 120 | +``` |
| 121 | + |
| 122 | +## AddGlobalPed |
| 123 | +```lua |
| 124 | +exports.it_bridge:AddGlobalPed(options) |
| 125 | +``` |
| 126 | + |
| 127 | +- options: `table`: The options of the global ped. |
| 128 | + |
| 129 | +Return all options that where added to the peds. |
| 130 | +Adds a interaction for all peds in the world. |
| 131 | + |
| 132 | +**Example** |
| 133 | +```lua |
| 134 | +local pedData = exports.it_bridge:AddGlobalPed({ |
| 135 | + label = 'Example Ped', |
| 136 | + icon = 'fas fa-user', |
| 137 | + canInteract = function(entity, distance) |
| 138 | + return distance < 2.5 |
| 139 | + end, |
| 140 | + onSelect = function(entity) |
| 141 | + print('You have interacted with the ped.') |
| 142 | + end, |
| 143 | + distance = 2.5, |
| 144 | +}) |
| 145 | +``` |
| 146 | + |
| 147 | +## RemoveGlobalPed |
| 148 | +```lua |
| 149 | +exports.it_bridge:RemoveGlobalPed(options) |
| 150 | +``` |
| 151 | + |
| 152 | +- options: `table`: The options of the global ped. |
| 153 | + |
| 154 | +Return `true` if the interactions was removed. |
| 155 | +Removes the interaction for all peds in the world. |
| 156 | + |
| 157 | +**Example** |
| 158 | +```lua |
| 159 | +local removed = exports.it_bridge:RemoveGlobalPed(pedData) |
| 160 | +``` |
| 161 | + |
| 162 | +## AddGlobalPlayer |
| 163 | +```lua |
| 164 | +exports.it_bridge:AddGlobalPlayer(options) |
| 165 | +``` |
| 166 | + |
| 167 | +- options: `table`: The options of the global player. |
| 168 | + |
| 169 | +Return all options that where added to the players. |
| 170 | +Adds a interaction for all players in the world. |
| 171 | + |
| 172 | +**Example** |
| 173 | +```lua |
| 174 | +local playerData = exports.it_bridge:AddGlobalPlayer({ |
| 175 | + label = 'Example Player', |
| 176 | + icon = 'fas fa-user', |
| 177 | + canInteract = function(entity, distance) |
| 178 | + return distance < 2.5 |
| 179 | + end, |
| 180 | + onSelect = function(entity) |
| 181 | + print('You have interacted with the player.') |
| 182 | + end, |
| 183 | + distance = 2.5, |
| 184 | +}) |
| 185 | +``` |
| 186 | + |
| 187 | +## RemoveGlobalPlayer |
| 188 | +```lua |
| 189 | +exports.it_bridge:RemoveGlobalPlayer(options) |
| 190 | +``` |
| 191 | + |
| 192 | +- options: `table`: The options of the global player. |
| 193 | + |
| 194 | +Return `true` if the interactions was removed. |
| 195 | +Removes the interaction for all players in the world. |
| 196 | + |
| 197 | +**Example** |
| 198 | +```lua |
| 199 | +local removed = exports.it_bridge:RemoveGlobalPlayer(playerData) |
| 200 | +``` |
| 201 | + |
| 202 | +## AddGlobalVehicle |
| 203 | +```lua |
| 204 | +exports.it_bridge:AddGlobalVehicle(options) |
| 205 | +``` |
| 206 | + |
| 207 | +- options: `table`: The options of the global vehicle. |
| 208 | + |
| 209 | +Return all options that where added to the vehicles. |
| 210 | +Adds a interaction for all vehicles in the world. |
| 211 | + |
| 212 | +**Example** |
| 213 | +```lua |
| 214 | +local vehicleData = exports.it_bridge:AddGlobalVehicle({ |
| 215 | + label = 'Example Vehicle', |
| 216 | + icon = 'fas fa-car', |
| 217 | + canInteract = function(entity, distance) |
| 218 | + return distance < 2.5 |
| 219 | + end, |
| 220 | + onSelect = function(entity) |
| 221 | + print('You have interacted with the vehicle.') |
| 222 | + end, |
| 223 | + distance = 2.5, |
| 224 | +}) |
| 225 | +``` |
| 226 | + |
| 227 | +## RemoveGlobalVehicle |
| 228 | +```lua |
| 229 | +exports.it_bridge:RemoveGlobalVehicle(options) |
| 230 | +``` |
| 231 | + |
| 232 | +- options: `table`: The options of the global vehicle. |
| 233 | + |
| 234 | +Return `true` if the interactions was removed. |
| 235 | +Removes the interaction for all vehicles in the world. |
| 236 | + |
| 237 | +**Example** |
| 238 | +```lua |
| 239 | +local removed = exports.it_bridge:RemoveGlobalVehicle(vehicleData) |
| 240 | +``` |
| 241 | + |
| 242 | +## AddTargetModel |
| 243 | +```lua |
| 244 | +exports.it_bridge:AddTargetModel(models, options) |
| 245 | +``` |
| 246 | + |
| 247 | +- models: `table | string`: The models to add as target models. |
| 248 | +- options: `table`: The options of the target models. |
| 249 | + |
| 250 | +Return all options that where added to the models. |
| 251 | +Adds the specified models as target models. |
| 252 | + |
| 253 | +**Example** |
| 254 | +```lua |
| 255 | +local modelData = exports.it_bridge:AddTargetModel('a_m_m_skater_01', { |
| 256 | + label = 'Example Model', |
| 257 | + icon = 'fas fa-user', |
| 258 | + canInteract = function(entity, distance) |
| 259 | + return distance < 2.5 |
| 260 | + end, |
| 261 | + onSelect = function(entity) |
| 262 | + print('You have interacted with the model.') |
| 263 | + end, |
| 264 | + distance = 2.5, |
| 265 | +}) |
| 266 | +``` |
| 267 | + |
| 268 | +## RemoveTargetModel |
| 269 | +```lua |
| 270 | +exports.it_bridge:RemoveTargetModel(models, options) |
| 271 | +``` |
| 272 | + |
| 273 | +- models: `table | string`: The models to remove as target models. |
| 274 | +- options: `table`: The options of the target models. |
| 275 | + |
| 276 | +Return all options that where removed from the models. |
| 277 | +Removes the specified models as target models. |
| 278 | + |
| 279 | +**Example** |
| 280 | +```lua |
| 281 | +local removed = exports.it_bridge:RemoveTargetModel('a_m_m_skater_01', modelData) |
| 282 | +``` |
0 commit comments