Welcome to Metin2Resources

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

[Py] PM with Patch Notes (Tutorial)

RESOURCES HUB

Premium
Joined
Jul 22, 2025
Messages
126
Reaction score
170
Points
43
Location
London
Discord
jigsaw86
Add a little "system" on your Metin2 server, when you make an update -> players get a PM (Whisper) with what changes have been made to the server.

It is written only in python + LUA (quest), very simple to implement by anyone!
- All players will receive this Private Message when they connect to the server.
- It appears only once, so players will not receive this message every time they log in, only the first time.
x1k1iKJ.gif


We open game.py and search for:
Code:
"mall"
We add:
Code:
"open_notice_info"        : self.__open_notice_info,
"write_notice_info"        : self.__write_notice_info,
We are looking for:
Code:
__InGameShop_Show(self,url):
We add:
Code:
def __open_notice_info(self):
    self.interface.RegisterGameMasterName("<--System-->")
    self.interface.RecvWhisper("<--System-->")
        
def __write_notice_info(self,text):
    chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, "<--System-->", text.replace("_", " "))
This is what it should look like:

file.php

Install the next quest:
Code:
quest reizo_notice begin
    state start begin
        function read_notice_line(l)
            return readline("/quest/notice/notice.txt", l)
        end
        
        when login begin
            local qf = readline("/quest/notice/qf.txt", 1)
            local lineas = 0
            if tonumber(qf) > pc.getqf("reizo_notice") then
                for line in io.lines("/quest/notice/notice.txt") do lineas = lineas + 1 end
                cmdchat("open_notice_info")
                for i = 1,lineas do
                    cmdchat("write_notice_info "..string.gsub(reizo_notice.read_notice_line(i), ' ', '_'))
                end
                pc.setqf("reizo_notice", qf)
            end
        end
    end
end
Now, we create a folder in the "quest" folder called "notice" and add 2 txt with the names: notice.txt and qf.txt.

In qf.txt you will have to put a number for example 0 we add a 0 and hit save, and in notice we put what we want to appear in pm.

In case we don't have the readline function we add:
Code:
function readline(path, x)
    local linetable = {}
    for line in io.lines(path) do
        table.insert(linetable, line)
    end
    return linetable[x]
end
We add the following to quest_functions:
Code:
readline
io.lines
How do I add a new message?
1) Open notice.txt from the notice fodler, and add the message that you want to appear in PM to players.
2) Open qf.txt and change the number there +1. That is if we have 0, we change it to 1.

Now, the message will appear to the players at first login.

If we did another update, we do the same. We change the message in notice.txt and change in qf.txt from 1 --> to 2.
Now the new message will appear again to players at first login.
 
573Threads
1,138Messages
264Members
cqara80Latest member
Back
Top