You could do something like this:
Code:
local News_ID = 192 -- Change to the ID of your newspaper
function Update_Newspaper_Timer()
for a, plrs in pairs(GetPlayersInWorld()) do -- Get all the players in the world
if plrs:HasItem(News_ID) == false then
plrs:AddItem(News_ID, 1) -- Add 1 of the news ID if the player doesn't have one already
plrs:SendBroadcastMessage("The latest newspaper was added to your inventory!")
plrs:SendAreaTriggerMessage("The latest newspaper was added to your inventory!")
end
end
end
RegisterTimedEvent("Update_Newspaper_Timer", 30000, 0) -- Call the function every 30 seconds
That directly adds to inventory, if you find out how the mail system works you could use:
Code:
CharDBQuery("INSERT INTO `mail` VALUES `"..player:GetGUID()..",1,2525,Hello,This Is a message")
etc etc
That would currently work as a Lua script, although take it as pseudo code.
If it was used as a Lua script then you could use the reloading function to reload the script when you change the item ID so you don't need to restart the server for changes to take effect.
Alternatively, you could simply have it read the first line of a text file and get the ID from that every x seconds. You wouldn't need to read it every 30 seconds either (as that puts more load on server resources if you care about that sort of thing). Have a separate function that calls every 600 seconds instead and have that update the local variable to the ID read from the text file.