addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer,
function ( old, current )
local weapon = getPedWeapon ( localPlayer, current )
local level = getElementData ( localPlayer, "levelnum" )
if ( weapon == 31 ) then
if ( level < 3 ) then
setPedWeaponSlot ( localPlayer, old )
end
elseif ( weapon == 34 ) then
if ( level < 4 ) then
setPedWeaponSlot ( localPlayer, old )
end
end
end
)
Try it.