Critico
Sexy
- Joined
- Mar 25, 2010
- Messages
- 370
- Reaction score
- 176
About: I created this function because the function 'getItemIdByName(name)' no has the parameter 'false' to not display the error in console.
talk exemple:
Lua:
function ExistItemByName(name) -- by vodka
local items = io.open("data/items/items.xml", "r"):read("*all")
local get = items:match('name="' .. name ..'"')
if get == nil or get == "" then
return false
end
return true
end
talk exemple:
Lua:
function onSay(cid, words, param)
if not ExistItemByName(param) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"this item does exist")
end
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,param.." ID: ["..getItemIdByName(param).."].")
end