Jump to content

sendmail porblem


bookkc

Recommended Posts

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

Posted

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.

Posted
8 hours ago, bookkc said:

like this ??

player:GetObjectGUID ???i nit understand

 

Just player.

 

It seems you are using Eluna which is from 2014.
Hmm, what core are you using and where did you get it from?

Posted

i use old core, but its need to me...

 

in this old eluna i dont have additem() but i need to get item to player, i think its possible by sendmail

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

 

Posted
SendMail( "subject", "this is from server", receiver:GetGUIDLow(), 0)

it works but i get email after relogin only. maybe need some time without relogin i dont know

Posted
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)

 

Posted

ok then

SendMail( "subject", "this is from server", receiver:GetGUIDLow(), receiver:GetGUIDLow())

but in my case i receive after relogin only

Posted

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

 

Posted

then i dont know seems like your old core.

i receive email even with this 

SendMail( "subject", "this is from server", p:GetGUIDLow());

 

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