GithubHelp home page GithubHelp logo

Comments (9)

justkryptic avatar justkryptic commented on July 17, 2024

Hey!

I am trying to setup a pedestrian to open a shop (shop inventory). I see you have a client event to open a shop, but I am stuck on how to get the target to open a shop rather than just the players inventory. Right now when the player uses the target it opens just a normal inventory and not a shop. Do you by chance know how to do this? Any help would be much appreciated, thanks.

What Happens When Opening The Shop: https://imgur.com/a/B1ip9fK

Also this is what my code looks like in the qb-target config:

["scrapyard-guy"] = {
    models = {
        "g_m_importexport_01"
    },
    options = {
        {
            type = "server",
            event = "inventory:server:OpenInventory",
            icon = "fab fa-amazon-pay", 
            label = "Shop",
        }
    },
    distance = 4.5,
}

}

from qb-target.

BlueSky-fur avatar BlueSky-fur commented on July 17, 2024

Im still experimenting with it, the zone we created gets displayed with debugPoly but we cant do anything with the eye on it, doesnt show any type of interaction. if i find out more ill let ya know.

from qb-target.

BerkieBb avatar BerkieBb commented on July 17, 2024

Try again with V5.0.0 which will come tomorrow

from qb-target.

BerkieBb avatar BerkieBb commented on July 17, 2024

Update and try

from qb-target.

BlueSky-fur avatar BlueSky-fur commented on July 17, 2024

Understood, ill try!

from qb-target.

BlueSky-fur avatar BlueSky-fur commented on July 17, 2024

we still have the same issue sadly.

from qb-target.

BlueSky-fur avatar BlueSky-fur commented on July 17, 2024

it just buggs me so much because theres absolutely no errors and nothing

from qb-target.

BlueSky-fur avatar BlueSky-fur commented on July 17, 2024

heres the whole file incase that helps in any way

function Load(name)
	local resourceName = GetCurrentResourceName()
	local chunk = LoadResourceFile(resourceName, ('data/%s.lua'):format(name))
	if chunk then
		local err
		chunk, err = load(chunk, ('@@%s/data/%s.lua'):format(resourceName, name), 't')
		if err then
			error(('\n^1 %s'):format(err), 0)
		end
		return chunk()
	end
end

-------------------------------------------------------------------------------
-- Settings
-------------------------------------------------------------------------------

Config = {}

-- It's possible to interact with entities through walls so this should be low
Config.MaxDistance = 5.0

-- Enable debug options
Config.Debug = false

-- Supported values: true, false
Config.Standalone = false

-- Enable outlines around the entity you're looking at
Config.EnableOutline = true

-- Enable default options (Toggling vehicle doors)
Config.EnableDefaultOptions = true

-- Disable the target eye whilst being in a vehicle
Config.DisableInVehicle = false

-- Key to open the target
Config.OpenKey = 'LMENU' -- Left Alt
Config.OpenControlKey = 19 -- Control for keypress detection also Left Alt for the eye itself, controls are found here https://docs.fivem.net/docs/game-references/controls/

-- Key to open the menu
Config.MenuControlKey = 238 -- Control for keypress detection on the context menu, this is the Right Mouse Button, controls are found here https://docs.fivem.net/docs/game-references/controls/

-------------------------------------------------------------------------------
-- Target Configs
-------------------------------------------------------------------------------

-- These are all empty for you to fill in, refer to the .md files for help in filling these in

Config.CircleZones = {

}

Config.BoxZones = {
	["boxzone1"] = {
        name = "MissionRowDutyClipboard",
        coords = vector3(441.7989, -982.0529, 30.67834),
        length = 0.45,
        width = 0.35,
        heading = 11.0,
        debugPoly = false,
        minZ = 30.77834,
        maxZ = 30.87834,
        options = {
            {
                type = "client",
                event = "Toggle:Duty",
                icon = "fas fa-sign-in-alt",
                label = "Sign In",
                job = "police",
            },
        },
        distance = 2.5
    },
	["boxzone2"] = {
        name = "247supermarket",
        coords = vector3(25.06, -1347.3, -90.83),
        length = 0.45,
        width = 0.35,
        heading = 0.0,
        debugPoly = true,
        minZ = 30.10000,
        maxZ = 29.27834,
        options = {
            {
                type = "client",
                event = "inventory:server:OpenInventory",
                icon = "fas fa-sign-in-alt",
                label = "Open Shop",
            },
        },
        distance = 2.5
    },
	["boxzone3"] = {
        name = "247supermarket2",
        coords = vector3(25.06, -1344.97, -90.83),
        length = 0.45,
        width = 0.35,
        heading = 0.0,
        debugPoly = true,
        minZ = 30.10000,
        maxZ = 29.27834,
        options = {
            {
		type = "client",
		event = "inventory:server:OpenInventory",
		icon = "fas fa-sign-in-alt",
		label = "Open Shop",
            },
        },
        distance = 2.5
    },
}

Config.PolyZones = {

}

Config.TargetBones = {

}

Config.TargetEntities = {

}

Config.TargetModels = {

}

Config.GlobalPedOptions = {

}

Config.GlobalVehicleOptions = {

}

Config.GlobalObjectOptions = {

}

Config.GlobalPlayerOptions = {

}

Config.Peds = {

}

-------------------------------------------------------------------------------
-- Functions
-------------------------------------------------------------------------------
local function JobCheck() return true end
local function GangCheck() return true end
local function ItemCount() return true end
local function CitizenCheck() return true end

CreateThread(function()
	if not Config.Standalone then
		local QBCore = exports['qb-core']:GetCoreObject()
		local PlayerData = QBCore.Functions.GetPlayerData()

		ItemCount = function(item)
			for _, v in pairs(PlayerData.items) do
				if v.name == item then
					return v.amount
				end
			end
			return 0
		end

		JobCheck = function(job)
			if type(job) == 'table' then
				job = job[PlayerData.job.name]
				if PlayerData.job.grade.level >= job then
					return true
				end
			elseif job == 'all' or job == PlayerData.job.name then
				return true
			end
			return false
		end

		GangCheck = function(gang)
			if type(gang) == 'table' then
				gang = gang[PlayerData.gang.name]
				if PlayerData.gang.grade.level >= gang then
					return true
				end
			elseif gang == 'all' or gang == PlayerData.gang.name then
				return true
			end
			return false
		end

		CitizenCheck = function(citizenid)
			return (citizenid == PlayerData.citizenid or citizenid[PlayerData.citizenid])
		end

		RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
			PlayerData = QBCore.Functions.GetPlayerData()
			SpawnPeds()
		end)

		RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
			PlayerData = {}
		end)

		RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo)
			PlayerData.job = JobInfo
		end)

		RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo)
			PlayerData.gang = GangInfo
		end)

		RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
			PlayerData = val
		end)
	else
		local firstSpawn = false
		AddEventHandler('playerSpawned', function()
			if not firstSpawn then
				SpawnPeds()
				firstSpawn = true
			end
		end)
	end
end)

function CheckOptions(data, entity, distance)
	if distance and data.distance and distance > data.distance then return false end
	if data.job and not JobCheck(data.job) then return false end
	if data.gang and not GangCheck(data.gang) then return false end
	if data.item and ItemCount(data.item) < 1 then return false end
	if data.citizenid and not CitizenCheck(data.citizenid) then return false end
	if data.canInteract and not data.canInteract(entity, distance, data) then return false end
	return true
end

from qb-target.

BerkieBb avatar BerkieBb commented on July 17, 2024

You need to have an object inside the boxzone to interact with, player with it a bit to get the right angle

from qb-target.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.