Commands & Events
Player Interaction
Proximity mode (UseTarget = false)
When MBT.UseTarget is set to false, players interact using the keyboard:
| Key | Action |
|---|---|
E | Open the vending machine NUI (when within MBT.HintDistance) |
The key is registered via RegisterKeyMapping as drinkMachineInteract. It is hidden from the chat suggestion list automatically.
Target mode (UseTarget = true)
When MBT.UseTarget is true, no command is needed — interaction is handled entirely by ox_target or qb-target on the prop model.
Prop Interaction Menu (Deployable Machine)
When a player looks at a deployed machine via ox_target:
| Option | Description |
|---|---|
| Move | Enter placement mode to reposition the machine |
| Repack Kit | Remove all props and return the vendingmachine item to inventory |
Move mode controls
| Key | Action |
|---|---|
↑ ↓ ← → | Move horizontally |
Q | Raise |
Z | Lower |
Numpad 9 | Rotate left |
Numpad 7 | Rotate right |
SPACE | Confirm position |
Move mode exits if you walk more than MBT.MaxDistanceMove units from the machine.
Purchase Flow
- Player opens the NUI (via target or
Ekey) - Selects a drink — the NUI sends
checkPriceto the server - Server verifies:
- Player has enough cash → deducts cash
- Or enough bank → deducts bank
- Player can carry the item (weight check)
- If all checks pass → arm grab animation plays → drink added to inventory
- If not enough money →
not_enough_moneynotification - If inventory is full →
too_heavynotification
Developer Reference
Client events
| Event | Description |
|---|---|
mbt_drink_machine:openMalidrink | Opens the NUI. Triggered by target interaction or proximity key. |
mbt_drink_machine:createMachine | Spawns the deployable vending machine prop near the player. |
mbt_drink_machine:moveEntity | Enters move/placement mode for a given prop entity. |
mbt_drink_machine:deleteKit | Repacks the deployed machine and returns the item. |
mbt_drink_machine:setupTarget | Initialises ox_target / qb-target on machine props. Fired at resource start. |
Server → Client events
| Event | Target | Description |
|---|---|---|
mbt_drink_machine:startInteraction | buyer | Payment accepted — triggers the NUI grab sequence. |
mbt_drink_machine:takeDrinkAnim | buyer | Plays the arm-grab animation (mp_common / givetake1_a). |
mbt_drink_machine:syncTarget | all (-1) | Broadcasts deployed machine network IDs so all players can register target interactions. |
Client → Server events
| Event | Payload | Description |
|---|---|---|
mbt_drink_machine:tryInteraction | drink (string) | Check player balance and inventory before purchase. |
mbt_drink_machine:takeDrink | drink (string) | Finalise purchase — give item to player. |
mbt_drink_machine:requestSyncTarget | { drinkMachine: netId } | Sent after deploying the machine; server broadcasts to all clients. |
mbt_drink_machine:deleteObjects | { drinkMachine: netId } | Deletes the deployed machine server-side and returns the item. |
NUI Callbacks
| Callback | Payload | Description |
|---|---|---|
checkPrice | { drink } | Fired when the player selects a drink in the NUI. Triggers server-side balance check. |
takeDrink | { drink } | Fired when the player confirms the purchase. Closes NUI and triggers item grant. |
closeUI | — | Fired when the player closes the NUI without purchasing. |
