function main()
while not isSampAvailable() do wait(100) end
local oldWp = -1
while true do
wait(0)
local curWp = getCurrentCharWeapon(PLAYER_PED)
if curWp ~= oldWp then
sampAddChatMessage("{FFFF00}[Weapon]: {FFFFFF}ID: " .. curWp, -1)
oldWp = curWp
end
end
end