Jump to content

sendmail porblem


bookkc

Recommended Posts

local function ChatSystem(event, player, msg, _, lang)
local plll = player:GetName()
local subject = "Hello"
local text = "Hello"
SendMail(subject, text, 18, plll, 62)
print "aaaaaaaaaa"
end

RegisterPlayerEvent(18, ChatSystem)
 lua_scripts\exhanger.lua:7: bad argument #4 to 'SendMail' (Player expected)

whats wrong? i give the player name...

Link to comment
Share on other sites

It expects a Player object, not a string. A name is a string.
So player, not player:GetName().

 

Seems the documentation is wrong/outdated for the function too. Says it takes in a number when the error clearly says it takes a Player.

Link to comment
Share on other sites

On 6/7/2018 at 10:46 PM, Rochet2 said:

It expects a Player object, not a string. A name is a string.
So player, not player:GetName().

 

Seems the documentation is wrong/outdated for the function too. Says it takes in a number when the error clearly says it takes a Player.

documentation is ok and there should be low GUID not player.

bookkcyou need to read documentation carefully and use correct type of data otherwise will be error. 

receiverGUIDLow - Low GUID of the receiver.
senderGUIDLow - Low GUID of the sender.

Therefore use sender:GetGUIDLow() and receiver:GetGUIDLow() and remember that you can't send email to yourself.

maybe this not working on old core but in my case all ok.

 

Link to comment
Share on other sites

2018-06-12 14:40:50 lua_scripts\exhanger.lua:2: bad argument #4 to 'SendMail' (Player expected)


 

local function ChatSystem(event, player, msg, _, lang)
SendMail( "subject", "this is from server", player:GetGUIDLow(), 0)


end

RegisterPlayerEvent(18, ChatSystem)

 

Link to comment
Share on other sites

okay

 

2018-06-12 15:41:00 lua_scripts\exhanger.lua:2: bad argument #4 to 'SendMail' (Player expected

local function ChatSystem(event, player, msg, _, lang)
SendMail( "subject", "this is from server", player:GetGUIDLow(), player:GetGUIDLow())
end

RegisterPlayerEvent(18, ChatSystem)

 

 

i have this

 

lua_register(L, "SendMail", &LuaGlobalFunctions::SendMail);                                             // SendMail(subject, text, receiverLowGUID[, sender, stationary, delay, itemEntry, itemAmount, itemEntry2, itemAmount2...]) - Sends a mail to player with lowguid. use nil to use default values on optional arguments. Sender is an optional player object. UNDOCUMENTED

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use