GithubHelp home page GithubHelp logo

Comments (5)

Archangelza1 avatar Archangelza1 commented on July 17, 2024

Hey vanilla

If you are wanting to do an item check

then you can use

item = 'handcuffs',

If you only want to display an option when they have a specific item you can use

QBCore.Functions.HasItem

From QBCore in order to return if they player has the item or not

Please feel free to ask anything else if I misunderstood your question 😄

from qb-target.

BerkieBb avatar BerkieBb commented on July 17, 2024

No it's actually different, let me write it out wait a second

from qb-target.

BerkieBb avatar BerkieBb commented on July 17, 2024

The Player.Functions table is btw server side thus won't work

from qb-target.

BerkieBb avatar BerkieBb commented on July 17, 2024
canInteract = function()
    local hasitem = nil
    QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
        if result then
            hasitem = true
        else
            hasitem = false
        end
    end)
 
    while hasitem == nil do
        Wait(1)
    end

    return hasitem
end,

This is the way you should do it if you want to use the config, if you're using exports or it is in the client/main.lua of qb-target, then you can use this, you do have to define PlayerData with QBCore.Functions.GetPlayerData()

canInteract = function()
    for k, v in pairs(PlayerData.items)
        if v.name == "lockpick" then
            return true
        end
    end
end,

from qb-target.

evanillaa avatar evanillaa commented on July 17, 2024

thank you all

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.