๐ฎ Trigger
Use this trigger to open the BIT-Coin System menu programmatically.
Open Menu
TriggerClientEvent("bit-donatorsystem:open")
Usage Examples
Open for Specific Player
-- Server-side
TriggerClientEvent("bit-donatorsystem:open", source)
Open with Command
-- Client-side
RegisterCommand('coinshop', function()
TriggerEvent("bit-donatorsystem:open")
end, false)
Open from Another Script
-- Client-side
exports['bit-donatorsystem']:openMenu()
-- Or use the event:
TriggerEvent("bit-donatorsystem:open")
Key Binding
Players can also open the menu using the configured key (default: F3)
-- In config.lua
Config.OpenWithKey = true
Config.OpenKey = 170 -- F3 key
To disable key opening, set Config.OpenWithKey to false.
Integration Examples
Open from NPC Interaction
-- Client-side
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerCoords = GetEntityCoords(PlayerPedId())
local npcCoords = vector3(123.45, -678.90, 12.34) -- Your NPC location
local distance = #(playerCoords - npcCoords)
if distance < 2.0 then
DrawText3D(npcCoords.x, npcCoords.y, npcCoords.z + 1.0, "Press [E] to open Coin Shop")
if IsControlJustReleased(0, 38) then -- E key
TriggerEvent("bit-donatorsystem:open")
end
end
end
end)
function DrawText3D(x, y, z, text)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
local px, py, pz = table.unpack(GetGameplayCamCoords())
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x, _y)
end
Open from Marker
-- Client-side
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerCoords = GetEntityCoords(PlayerPedId())
local markerCoords = vector3(123.45, -678.90, 12.34)
local distance = #(playerCoords - markerCoords)
if distance < 10.0 then
DrawMarker(1, markerCoords.x, markerCoords.y, markerCoords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 255, 215, 0, 100, false, true, 2, false, nil, nil, false)
if distance < 2.0 then
if IsControlJustReleased(0, 38) then -- E key
TriggerEvent("bit-donatorsystem:open")
end
end
end
end
end)
Open from Item Usage
-- Server-side (ESX)
ESX.RegisterUsableItem('coincard', function(source)
TriggerClientEvent("bit-donatorsystem:open", source)
end)
-- Server-side (QBCore)
QBCore.Functions.CreateUseableItem("coincard", function(source, item)
TriggerClientEvent("bit-donatorsystem:open", source)
end)
Admin Command to Open for Player
-- Server-side
RegisterCommand('givecoinmenu', function(source, args, rawCommand)
local targetId = tonumber(args[1])
if targetId then
-- Check if player has admin permission
if IsPlayerAdmin(source) then
TriggerClientEvent("bit-donatorsystem:open", targetId)
end
end
end, false)
Notes
- The trigger only opens the menu client-side
- Ensure players have permission to use the menu
- Menu will display current coin balance
- All purchases require sufficient coins