local BankPed = nil local Till = {} function spawnCustomRegisters() Wait(1000) for k, v in pairs(Config.CustomCashRegisters) do for i = 1, #v do local job, gang = v[i].gang and nil or k, v[i].gang and k or nil local img = v.img or v[i].img createBoxTarget( {"CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, {name="CustomRegister: "..k..i, heading=v[i].coords[4], debugPoly=debugMode, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4}}, {{ action=function() TriggerEvent(getScript()..":client:Charge", {job=job, gang=gang, img=img}) end, icon="fas fa-credit-card", label=locale("target","charge"), job=job, gang=gang }}, 2.0 ) if v[i].prop then makeProp({prop="prop_till_03", coords=v[i].coords+vec4(0,0,1.0,0.0)},1,false) end end end end onPlayerLoaded(function() spawnCustomRegisters() end, true) RegisterNetEvent(getScript()..":client:Charge", function(data, outside) local billPrev = "cash" --if not outside and not onDuty and data.gang == nil then triggerNotify(nil, locale("error", "not_onduty") return end local newinputs = {} -- Begin qb-input creation here. local nearbyList = {} if Config.General.List then -- If nearby player list is wanted: --Retrieve a list of nearby players from server local onlineList = triggerCallback(getScript()..":MakePlayerList") --Convert list of players nearby into one qb-input understands + add distance info local playerCoords = GetEntityCoords(PlayerPedId()) if onlineList == nil or #onlineList == 0 then goto failed end for _, v in ipairs(GetPlayersFromCoords(playerCoords, Config.General.PaymentRadius)) do local ped = GetPlayerPed(v) local dist = #(GetEntityCoords(ped) - playerCoords) for i = 1, #onlineList do if onlineList[i].value == GetPlayerServerId(v) then if v ~= PlayerId() or debugMode then nearbyList[#nearbyList+1] = { value = onlineList[i].value, label = onlineList[i].text .. ' (' .. math.floor(dist+0.05) .. 'm)', text = onlineList[i].text .. ' (' .. math.floor(dist+0.05) .. 'm)' } end end end end ::failed:: --If list is empty(no one nearby) show error and stop if not nearbyList[1] then triggerNotify(nil, locale("error" ,"no_one"), "error") return end newinputs[#newinputs+1] = { type = "select", text = locale("menu", "cus_id"), name = "citizen", label = locale("menu", "cus_id"), default = 1, options = nearbyList } elseif Config.General.lookAtCharge then local selectedPed = nil local highlightedPed = nil local running = true CreateThread(function() while running do Wait(0) -- Raycast to get entity being looked at local camCoord = GetGameplayCamCoord() local direction = RotationToDirection(GetGameplayCamRot(2)) local targetCoord = camCoord + direction * 6.0 local hit, _ , hitCoords, _, entityHit = PerformRaycast(camCoord, targetCoord, PlayerPedId(), 4) if hit then DrawSphere(hitCoords.x, hitCoords.y, hitCoords.z, 0.05, 255, 255, 255, 0.5) end if entityHit and IsEntityAPed(entityHit) and entityHit ~= PlayerPedId() then if highlightedPed ~= entityHit then if highlightedPed and DoesEntityExist(highlightedPed) then SetEntityAlpha(highlightedPed, 255, false) ResetEntityAlpha(highlightedPed) end highlightedPed = entityHit SetEntityAlpha(highlightedPed, 200, false) end elseif highlightedPed then SetEntityAlpha(highlightedPed, 255, false) ResetEntityAlpha(highlightedPed) highlightedPed = nil end local loc = vec2(0.89+0.037, 0.9) DrawSprite("timerbars", "all_black_bg", loc.x, loc.y, 0.12, 0.05, 0.0, 255, 255, 255, 255) SetTextScale(0.80, 0.80) SetTextWrap(0.75, 0.985) SetTextJustification(2) SetTextFont(4) SetTextColour(255, 255, 255, 255) BeginTextCommandDisplayText("STRING") AddTextComponentSubstringKeyboardDisplay(highlightedPed and "~s~Selected ID: ~g~"..GetPlayerServerId(NetworkGetPlayerIndexFromPed(highlightedPed)) or "~s~No Selection") EndTextCommandDisplayText(loc.x+0.06, loc.y - 0.026) -- Show instructional UI local buttons = { { keys = { 194 }, text = "Cancel" } } if highlightedPed then table.insert(buttons, { keys = { 86, 191 }, text = "Confirm" }) end makeInstructionalButtons(buttons) -- Handle controls if IsControlJustPressed(0, 194) then -- Backspace if highlightedPed then SetEntityAlpha(highlightedPed, 255, false) ResetEntityAlpha(highlightedPed) end running = false return end if highlightedPed and (IsControlJustPressed(0, 191) or IsControlJustPressed(0, 86)) then local serverId = GetPlayerServerId(NetworkGetPlayerIndexFromPed(highlightedPed)) if serverId then running = false SetEntityAlpha(highlightedPed, 255, false) ResetEntityAlpha(highlightedPed) --Grab Player Job name or Gang Name if needed local getInfo = getPlayer() --Check if image was given when opening the regsiter local img = data.img ~= nil and (Config.System.Menu == "qb" and "