I'm trying to set up a message system to tone my skillz. I have an Inbox, Outbox, Compose thing, and you can read or delete any message in your Inbox. I am, however, having a few problems.
I used a table called Mail that has 7 fields. A message id, receiving player's id and name (so I don't have to do unnecessary queries for random players), sending player's id and name, message, and title.
Every time you compose, it increments the message id, plugs in the receiving player, plugs in the sending player, and throws the message/title in the data base. This message is both viewable from the sender's Outbox and the receiver's Inbox. This is where we get started with problems..
Problem---- If the receiver chooses to delete a message (to make things more tidy), it also deletes it from the sender's Outbox. Should I make a new field called "type" and use it to identify whether the message is from the Inbox or Outbox? If I do this, I will have to insert the message twice..will this slow down the server or clog it up in any way?
Question---- How do I implement a time/date sent? I know it probably has something to do with the time() function but I can't find anything that keeps it from changing: staying on the time it was sent instead of just being a clock.
Lol, any help would be appreciated.
Message systems - Various parts of them..
Message systems - Various parts of them..
Coding - Unity3d JS, PHP, and small amount of C#.
Art stuff - GIMP, Blender
Art stuff - GIMP, Blender
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Message systems - Various parts of them..
I would make 2 fields, inbox, outbox. make it a tiny integer, 1 = valid, 0 = deleted
when the receiving player checks his mailbox it queries also where inbox = 1
when the sending player checks his mailbox it queries also where outbox = 1
when the receiving player deletes the message it changes to 0, also make it check if outbox also = 0 the delete message completely.
same goes with sending player except if inbox also = 0 then delete.
time function is seconds, you just need to convert it to time.
when the receiving player checks his mailbox it queries also where inbox = 1
when the sending player checks his mailbox it queries also where outbox = 1
when the receiving player deletes the message it changes to 0, also make it check if outbox also = 0 the delete message completely.
same goes with sending player except if inbox also = 0 then delete.
time function is seconds, you just need to convert it to time.
Re: Message systems - Various parts of them..
Whoa..that helps o.Ohallsofvallhalla wrote:I would make 2 fields, inbox, outbox. make it a tiny integer, 1 = valid, 0 = deleted
when the receiving player checks his mailbox it queries also where inbox = 1
when the sending player checks his mailbox it queries also where outbox = 1
when the receiving player deletes the message it changes to 0, also make it check if outbox also = 0 the delete message completely.
same goes with sending player except if inbox also = 0 then delete.
time function is seconds, you just need to convert it to time.
Thanks a lot
Coding - Unity3d JS, PHP, and small amount of C#.
Art stuff - GIMP, Blender
Art stuff - GIMP, Blender