You used the old function's declaration:
function mining.onUse(cid, item, fromPosition, itemEx, toPosition)
This is a new one:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
So cid = player and itemEx = target
Change for the new one and it should work.