0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

FiveM 汎用関数

Last updated at Posted at 2025-08-29

警察の人数を取得する関数

server.lua
local function getPoliceCount()
    local count = 0
    local players = QBCore.Functions.GetPlayers()

    for _, playerId in ipairs(players) do
        local player = QBCore.Functions.GetPlayer(playerId)

        if player and player.PlayerData.job.name == 'police' and player.PLayerData.job.onduty then
            count = count + 1
        end
    end
    return count
end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?