function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('nn', function() status = not status end)
while true do wait(0)
if status then
for i = 0, sampGetMaxPlayerId(true) do
if sampIsPlayerConnected(i) then
local result, ped = sampGetCharHandleBySampPlayerId(i)
if result then
local positionX, positionY, positionZ = getCharCoordinates(ped)
local localX, localY, localZ = getCharCoordinates(PLAYER_PED)
local distance = getDistanceBetweenCoords3d(positionX, positionY, positionZ, localX, localY, localZ)
if distance <= 3.0 then
EmulShowNameTag(i, true)
else
EmulShowNameTag(i, false)
end
end
end
end
end
end
end
function EmulShowNameTag(id, value)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt16(bs, id)
raknetBitStreamWriteBool(bs, value)
raknetEmulRpcReceiveBitStream(80, bs)
raknetDeleteBitStream(bs)
end