• 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!

[Request]

Rufo

New Member
Joined
Jan 9, 2008
Messages
251
Reaction score
1
Would be nice if the server makes a log of sent parcels,

Example:
Code:
14:15 Rufo sent parcel to Knight'Poderoso weight: 80 oz.


So you can find hackers :)
 
Lua:
function onSendMail(cid, receiver, item, openBox)
	doWriteLogFile("data/logs/sentMailLog.txt", "[".. os.date('%d %B %y - %H:%M') .."] " .. cid .. " sent a parcel to " .. receiver .. " that weighted " .. getItemWeight(item.uid) .. ".")
end

Also, register it in login.lua.
 
Shouldn't it be?

Code:
function onSendMail(cid, receiver, item, openBox)
    return doWriteLogFile("data/logs/sentMailLog.txt", "[".. os.date('%d %B %y - %H:%M') .."] " .. cid .. " sent a parcel to " .. receiver .. " that weighted " .. getItemWeight(item.uid) .. ".")
end
 
Not tested
Lua:
<channel id="10" name="Mail" active="no"/>

Add this to constant.lua(after channel_help):
Lua:
CHANNEL_MAIL = 10

Lua:
function onSendMail(cid, receiver, item, openBox)
	for _, pid in ipairs(getPlayersOnline()) do
		doPlayerSendChannelMessage(pid, "", getCreatureName(cid) .. " sent a parcel to " .. getCreatureName(receiver) .. ", weight: " .. getItemWeight(item.uid), TALKTYPE_CHANNEL_Y, CHANNEL_MAIL)
	end
	return true
end
 
@JDB
There's not really much of a difference ._.
I suppose that'd be better, yes. (Shorter, as you don't have to return 1 afterwards. I forgot to add return 1 :p)
 
Code:
function onSendMail(cid, receiver, item, openBox)
	if (doWriteLogFile("data/logs/sentMailLog.txt", "[".. os.date('%d %B %y - %H:%M') .."] " .. cid .. " sent a parcel to " .. receiver .. " that weighted " .. getItemWeight(item.uid) .. ".")) then
		return true
	else
		print("Can't write log file.")
		return false
	end
	return false
end

xO!
 
Code:
function onSendMail(cid, receiver, item, openBox)
	if (doWriteLogFile("data/logs/sentMailLog.txt", "[".. os.date('%d %B %y - %H:%M') .."] " .. cid .. " sent a parcel to " .. receiver .. " that weighted " .. getItemWeight(item.uid) .. ".")) then
		return true
	else
		print("Can't write log file.")
		return false
	end
	[B][COLOR="Red"]return false[/COLOR][/B]
end

xO!
You don't need to return there because it'll return already.
 
Back
Top