|
Ilnair
|
 |
« on: June 23, 2006, 03:40:28 AM » |
|
Another script submission from me, i'm not gonna do a complete tutorial this time, newby's won't be able to do this, kinda hard, and the advanced scripters over here won't need a tutorial.
Here it goes:
The Subs:
'************************************************ 'Start Mail System! Dinand Mentink - Ilnair '************************************************ Sub ReadMailBox(index) Dim msg1 Dim msg2 Dim msg3 Dim msg4 Dim msg5
msg1 = GetVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "mailbox1") msg2 = GetVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "mailbox2") msg3 = GetVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "mailbox3") msg4 = GetVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "mailbox4") msg5 = GetVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "mailbox5")
If msg1 = "No message" Then Call PlayerMsg(index, "No messages!", 10) Exit Sub End If Call PlayerMsg(index, "Message1: " & msg1, 10) If msg2 = "No message" Then Exit Sub End If Call PlayerMsg(index, "Message2: " & msg2, 10) If msg3 = "No message" Then Exit Sub End If Call PlayerMsg(index, "Message3: " & msg3, 10) If msg4 = "No message" Then Exit Sub End If Call PlayerMsg(index, "Message4: " & msg4, 10) If msg5 = "No message" Then Exit Sub End If Call PlayerMsg(index, "Message5: " & msg5, 10) Call ClearMailBox(index) End Sub
Sub ClearMailBox(index) Dim postbox
postbox = 1
Do While postbox < 6 Call PutVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "mailbox" & postbox, "No message") postbox = postbox + 1 Loop
Call PlayerMsg(index, "Mailbox cleared!", 10) Call PutVar("mailbox.ini", "playernames", GetPlayerName(index), GetPlayerLogin(index) & GetPlayerCharNum(index)) End Sub '************************************************ 'End Mail System! Dinand Mentink - Ilnair '************************************************
Add the following stuff: Inside Sub Onjoin:
Call PutVar("mailbox.ini", "playernames", GetPlayerName(index), GetPlayerLogin(index) & GetPlayerCharNum(index)) If GetPlayerLevel(index) = 1 and GetPlayerExp(index) = 0 Then Call ClearMailBox(index) End If
Create the following scripted item: Case 15 Call playerquerybox(index, "Who do you want to send a message?", 1) Exit Sub
Create the following query box cases:
Case 1 player = response If GetVar("mailbox.ini", "playernames", player & "") = "" Then Call PlayerMsg(index, "Invalid player", 12) Exit Sub Else player = GetVar("mailbox.ini", "playernames", player & "") Call PutVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "player", player & "") Call playerquerybox(index, "What message do you want to send?", 2) End If Exit Sub
Case 2 msg = 1 player = GetVar("mailbox.ini", GetPlayerLogin(index) & GetPlayerCharNum(index), "player")
msg1 = GetVar("mailbox.ini", player & "", "mailbox1") msg2 = GetVar("mailbox.ini", player & "", "mailbox2") msg3 = GetVar("mailbox.ini", player & "", "mailbox3") msg4 = GetVar("mailbox.ini", player & "", "mailbox4") msg5 = GetVar("mailbox.ini", player & "", "mailbox5") If msg1 = "No message" Then Call PutVar("mailbox.ini", player & "", "mailbox1", GetPlayerName(index) & ": " & response & "") Call PlayerMsg(index, "Message Send!", 10) Exit Sub End If If msg2 = "No message" Then Call PutVar("mailbox.ini", player & "", "mailbox2", GetPlayerName(index) & ": " & response & "") Call PlayerMsg(index, "Message Send!", 10) Exit Sub End If If msg3 = "No message" Then Call PutVar("mailbox.ini", player & "", "mailbox3", GetPlayerName(index) & ": " & response & "") Call PlayerMsg(index, "Message Send!", 10) Exit Sub End If If msg4 = "No message" Then Call PutVar("mailbox.ini", player & "", "mailbox4", GetPlayerName(index) & ": " & response & "") Call PlayerMsg(index, "Message Send!", 10) Exit Sub End If If msg5 = "No message" Then Call PutVar("mailbox.ini", player & "", "mailbox5", GetPlayerName(index) & ": " & response & "") Call PlayerMsg(index, "Message Send!", 10) Exit Sub End If Call PlayerMsg(index, "Targets Mailbox full!", 10) Exit Sub
Ok, should be working now. Everyone will have an empty mail box when they first join, if you inplement this script when a few people already have an account, just delete them and have them join again ^^.
To read the message box, make a scripted tile with the following command:
Case X Call ReadMailBox(index)
to delete the messages (reset mail box), the following command: Case X Call ClearMailBox(index)
and the following command will open a player prompt for the message (to send it):
Case X Call playerquerybox(index, "Who do you want to send a message?", 2)
Good luck
|