ID:2104322
 
(See the best response by Nadrew.)
Hi,how I can send message for off-line players in game?
Like using the player key and if they log they will see the message and if he see the message then he cant see the same message again. Dont matter the date,if player takes 5 days to log he will get this message.
You'd have to store the message in some kind of file, indexed by the player's key in some way. Then when that player logs in you retrieve the data if it exists and display it, removing it when it gets displayed.
In response to Nadrew
like
var/messagefile/S = new("Savefiles/Message/[key].sav")
mob
Login()
if(messagefile)
alert("messagefile]")
del("Savefiles/Message/[key].sav")

something like this?
You're thinking the right way, but you're not quite there, you don't even really need a savefile for this, a plain text file would probably be plenty. Take a look at the "text2file" and "file2text" procs, you'll also want to take a look at "fexists".
In response to Nadrew
I will take a look but it seems strange,how saves will save a message? :/
Best response
You don't need a savefile because the message is very basic text.

mob/admin/verb/LeaveMessage()
var/who_for = input("What key do you want to leave a message for?")as null|text
if(isnull(who_for)) return
who_for = ckey(who_for)
var/old_message
if(fexists("messages/[who_for].txt"))
old_message = file2text("messages/[who_for].txt")
var/message = input("What do you want to leave for [who_for]?","Message",old_mesage)as null|message
if(isnull(message)) return
text2file(message,"messages/[who_for].txt")
src << "Message left."

mob/Login()
..()
if(fexists("messages/[src.ckey].txt"))
var/message = file2text("messages/[src.ckey].txt")
if(message)
src << "You were left a message when you were offline:<br>[message]"
fdel("messages/[src.ckey].txt")


I wrote this off the top of my head, don't expect it to compile it is purely an example. I didn't comment it because it's fairly self-explanatory. If you don't understand something there look it up.

There's obviously stuff missing, like checking if the player is online when a message is left, and just sending it directly to them, but that should get you started.
In response to Nadrew
Thanks for the help,It is working