Why doesn't this function work?

Dm1try_

Участник
Автор темы
11
0
Версия MoonLoader
.026-beta
Because it doesn't work I want to check if the player next to me is using a jetpack
I don't want to use this here "if sampGetPlayerSpecialAction(id) == 2 then" I want to use the function

Lua:
for id = 0, sampGetMaxPlayerId(false) do
    if sampIsPlayerConnected(id) then
        local result, ped = sampGetCharHandleBySampPlayerId(id)
        local my_pos = { getCharCoordinates(playerPed) }
        local playerHandle_pos = { getCharCoordinates(id) }
        local distance = getDistanceBetweenCoords3d(my_pos[1], my_pos[2], my_pos[3], playerHandle_pos[1], playerHandle_pos[2], playerHandle_pos[3])
        
        if result then
            if distance <= 300 and isPlayerUsingJetpack(ped) then
                sampAddChatMessage('Player ID '..id.. ' esta usando Jetpack', -1)
            else
                sampAddChatMessage('Player ID '..id.. ' nao esta usando Jetpack', -1)
            end
        end
    end
end