-- wait(0)
local result, id = sampGetPlayerIdOnTargetKey(VK_Q)
if result then
sampAddChatMessage('Выбран игрок: '..sampGetPlayerNickname(id)..' ['..id..']', -1)
end
-- Вне wait(0)
function sampGetPlayerIdOnTargetKey(key)
local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if result then
if isKeyJustPressed(key) then
return sampGetPlayerIdByCharHandle(ped)
end
end
return false
end