function onSay(player, words, param)
if(not player:getGroup():getAccess()) then
return true
end
if(player:getAccountType() < ACCOUNT_TYPE_GOD) then
return false
end
logCommand(player, words, param)
local split = param:split(",")
local itemType = nil
local data = tonumber(split[1]) or split[1]
if(type(data) == "number") then
for id = 100, 99999 do
local clientType = ItemType(id)
if(clientType:getClientId() == data) then
itemType = clientType
end
end
else
itemType = ItemType(data)
end
if(itemType == nil or itemType:getId() == 0) then
player:sendCancelMessage("There is no item with that id or name.")
return false
end
local count = tonumber(split[2])
if(count ~= nil) then
if(itemType:isStackable()) then
count = math.min(10000, math.max(1, count))
elseif(not itemType:isFluidContainer()) then
count = math.min(100, math.max(1, count))
else
count = math.max(0, count)
end
else
if(not itemType:isFluidContainer()) then
count = 1
else
count = 0
end
end
local result = player:addItem(itemType:getId(), count)
if(result ~= nil) then
if(not itemType:isStackable()) then
if(type(result) == "table") then
for _, item in ipairs(result) do
item:decay()
end
else
result:decay()
end
end
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
return false
end