Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add PLAYER_EVENT_ON_CAN_SEND_MAIL #85

Merged
merged 1 commit into from
Dec 30, 2022
Merged

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
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.

None yet

2 participants