-- Creditos a Doughell
function onSay(cid, words, param)  
local maxLen = 15 -- tamanho maximo do nome
local itemid = 2145 ------ Numero do Item que ser&#225; removido
local proibido = {"!","@","*", "]", "["}-- simbolos proibidos
 
 
	  for i = 1, #proibido do		  
		  if string.find(tostring(param), proibido[i]) then			  
			 doPlayerSendCancel(cid,"[AUTO SHOP] You can not use symbols in their name.")			  
			 return TRUE		  
		  end	  
	  end			  
	  
	  if tostring(param) == "" then -- checkar se n&#227;o &#233; nome vazio		
		 doPlayerSendCancel(cid, "[AUTO SHOP] Choose a name to make the change of his surname.")		
		 return TRUE	  
	  end			  
	  
	  if string.len(tostring(param)) > maxLen then		  
		 doPlayerSendCancel(cid, "[AUTO SHOP] You can use a maximum of " .. maxLen .. " letters.")		  
		 return TRUE	  
	  end			
	  
	  if not getTilePzInfo(getCreaturePosition(cid)) then	  
		 doPlayerSendCancel(cid,"[AUTO SHOP] Can only be used in Protection Zone.")	  
		 return TRUE	  
	  end					
	  
	  if getPlayerItemCount(cid, itemid) >= 1 then		  
		 doPlayerRemoveItem(cid, itemid, 10)		  
		 db.executeQuery("UPDATE `players` SET `name` = '"..param.."' WHERE `id` = "..getPlayerGUID(cid)..";")			
		 doPlayerSendTextMessage(cid,25,"[AUTO SHOP] You will be logged out in 5 seconds for the changes to be made.")		  
		 addEvent(doRemoveCreature, 5*1000, cid, true)	  
	  else		  
		 doPlayerSendCancel(cid,"[AUTO SHOP] You don't have " .. getItemNameById(itemid) .. " to make the purchase of changename.")	  
	  end
return TRUE
end