maybe can you try with this changes:
local action = Action()
function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You can change your PvP status...