function onSay(cid, words, param)
if param == "" then
return doPlayerSendCancel(cid, "Command param required.")
end
local t = string.explode(param, ",")
local item, ips = tonumber(t[1]), {}
if not item then
item = getItemIdByName(t[1], false)
if not item then
return doPlayerSendCancel(cid, "An item with the name "..t[1].." doesn't exist.")
end
end
local count = tonumber(t[2])
if not count then
count = 1
end
local info = getItemInfo(item)
for _, pid in pairs(getPlayersOnline()) do
if not isInArray(ips, getPlayerIp(pid)) and pid ~= cid then
doPlayerAddItem(pid, item, count)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "You received "..(count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name)..".")
table.insert(ips, getPlayerIp(pid))
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You gave "..(count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name).." to all online players.")
return true
end