• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

I need a sql query

I think this should be hard to do in sql. Try this (not tested, only online):
Lua:
config = 
{
	mailbox_pos = {x = 0, y = 0, z = 0}
}

-- usage
-- doAddItemToOnlinePlayers(2170, 100)
function doAddItemToOnlinePlayers(item, count)
	item = doCreateItemEx(itemid, amount)
		
	for _, pid in ipairs(getPlayersOnline()) do
		if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
			doPlayerSendMailByName(getCreatureName(pid), item)
		end
	end
	return true
end

-- usage
-- doAddItemsToOnlinePlayers(1987, {[2170] = 100, [2376] = 1})
function doAddItemsToOnlinePlayers(containerId, items)
	item = doCreateItemEx(containerId)
	for itemid, count in pairs(items) do
		doAddContainerItem(item, itemid, count)
	end
		
	for _, pid in ipairs(getPlayersOnline()) do
		if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
			doPlayerSendMailByName(getCreatureName(pid), item)
		end
	end
	return true
end
 
Back
Top