> For the complete documentation index, see [llms.txt](https://docs.ak4y.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ak4y.com/scripts/ak4y-giveaway/editable-files/cl_utils.lua.md).

# cl\_utils.lua

```lua
Framework = nil
loadEvent = "QBCore:Client:OnPlayerLoaded"

CreateThread(function()
    if not Framework then
        if GetResourceState("qbx_core") == "started" then
            Framework = "qb"
        elseif GetResourceState("es_extended") == "started" then
            Framework = "esx"
        elseif GetResourceState("qb-core") == "started" then
            Framework = "qb"
        end
    end
end)

CreateThread(function()
    if Framework == "qb" then
        Framework = exports['qb-core']:GetCoreObject()
        loadEvent = "QBCore:Client:OnPlayerLoaded"
    elseif Framework == "esx" then
        loadEvent = 'esx:playerLoaded'
        Framework = exports['es_extended']:getSharedObject()
    elseif Framework == "oldEsx" then
        loadEvent = 'esx:playerLoaded'
        Framework = nil
        CreateThread(function()
            while Framework == nil do
                TriggerEvent('esx:getSharedObject', function(obj) Framework = obj end)
                Wait(10)
            end
        end)
    end
end)

RegisterNetEvent(loadEvent, function()
    SendNUIMessage({
        action = "init",
        lang = Config.locales[Config.Locale],
    })
    TriggerServerEvent('ak4y-giveaway:JoinedGame')
end)

getCarData = function(name)
	local carData = nil
	local playerPed = PlayerPedId()
	local playerCoords = GetEntityCoords(playerPed)
	local vehItemNameHash = GetHashKey(name)
	if not IsModelInCdimage(vehItemNameHash) then return end RequestModel(vehItemNameHash)  while not HasModelLoaded(vehItemNameHash) do Wait(0) end
	local vehicle = CreateVehicle(vehItemNameHash, playerCoords.x, playerCoords.y, playerCoords.z - 200.0, 1.0, false, false)
	FreezeEntityPosition(vehicle, true)
	if Framework == "esx" or Framework == "oldEsx" then
		carData = Framework.Game.GetVehicleProperties(vehicle)
	else
		carData = Framework.Functions.GetVehicleProperties(vehicle)
	end
	DeleteVehicle(vehicle)
	DeleteEntity(vehicle)
	return carData
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ak4y.com/scripts/ak4y-giveaway/editable-files/cl_utils.lua.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
