function main()
if not isSampLoaded() then return end
while not isSampAvailable() do wait(10) end
sampRegisterChatCommand('mynick',_cmd_mynick)
while true do
wait(0)
local res, tar = getCharPlayerIsTargeting(playerHandle)
if res then res, tarId = sampGetPlayerIdByCharHandle(tar) end
if res and isKeyDown(VK_KEY_H) then
local tarName = sampGetPlayerNickname(tarId)
print(tarId, tarName)
end
end
end
function _cmd_mynick()
local clientId = sampGetPlayerIdByCharHandle(playerPed)
local res, clientName = sampGetPlayerNickname(clientId)
if res then
print(clientId, clientName)
end
end