Skip to content

Conversation

@r-o-b-o-t-o
Copy link
Member

Adds a new Player event:

PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail

Example Lua snippet:

local PLAYER_EVENT_ON_CAN_SEND_MAIL = 49

local function OnSendMail(event, player, receiverGuid, mailbox, subject, body, money, cod, item)
	local receiver = GetPlayerByGUID(receiverGuid)
	if (receiver ~= nil) then
		print(player:GetName() .. " wants to send a mail to " .. receiver:GetName())
	else
		print(player:GetName() .. " wants to send a mail to " .. tostring(receiverGuid))
	end
	print("Subject: " .. subject)
	if money > 0 then
		print("Attached: " .. tostring(money) .. " copper")
	end
	if item ~= nil then
		print("Attached: " .. item:GetName())
	end
	if cod > 0 then
		print("COD: " .. tostring(cod) .. " copper")
	end
	print("Body:")
	print(body)

	return false -- prevent the mail from being sent
end
RegisterPlayerEvent(PLAYER_EVENT_ON_CAN_SEND_MAIL, OnSendMail)

@r-o-b-o-t-o r-o-b-o-t-o merged commit 3700b42 into master Dec 30, 2022
@r-o-b-o-t-o r-o-b-o-t-o deleted the feat/on-can-send-mail branch December 30, 2022 23:43
mostlynick3 pushed a commit to mostlynick3/mod-eluna that referenced this pull request Aug 5, 2025
mostlynick3 pushed a commit to mostlynick3/mod-eluna that referenced this pull request Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants