Server Functions (QB-Core)

Server editables can be found in: server/esx_framework.lua

GetPoliceCount

This function returns how many cops are online.

function GetPoliceCount()
    local count = 0
    for ServerId, Player in ipairs(QBCore.Functions.GetQBPlayers()) do
        if Player.PlayerData.job.name == "police" then
            count = count + 1
        end
    end
    return count
end

GiveGrabbedCash

This function gives the player the cash he just grabbed. (In Black Money)

function GiveGrabbedCash(player_src, event)
    QBCore.Functions.GetPlayer(player_src).Functions.AddMoney("cash", event.earnings)
end

Parameters

  • player_src: integer, player server ID. In this case, equivalent to source.

  • event:

    • earnings: number, amount given after a full stack of cash is grabbed.

DoesPlayerHaveItem

This function returns whether the player has the item or not.

Parameters

  • player_src: integer, player server ID. In this case, equivalent to source.

  • item: string, item name.

DiscordLog

This function is called when a discord log should be sent. You have to set up your own discord log system.

Parameters

  • player_src: integer, player server ID. In this case, equivalent to source.

  • event:

    • name: string, log name. (Possible values: “cheat”, “cash”, “start”, “reset”)

    • earnings: number, amount of cash earned. (Only for event.name “cash”)

SendPoliceAlert [Event]

This event is triggered when a player starts to hack a bank vault. Its purpose is to alert cops.

Parameters

  • coords: vector3, world position of the bank being robbed.

Last updated