Jump to content

IO.Open Function - Announcements


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hello metin2dev, i will teach you how to use the io.open function. You can create an editable quest announcement without restarting the server or reload anything.

 

On login example

quest ioopenexample_1 begin
  state start begin
    when login begin 
      announcements = io.open("locale/location/announcements.txt")
      notice("News:"..announcements:read()) 
    end
  end
end

That's pretty simple. :D

  • Metin2 Dev 5
  • Good 2
  • Love 1
  • Love 10
Link to comment
https://metin2.dev/topic/5639-ioopen-function-announcements/
Share on other sites

  • 2 weeks later...
  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hello metin2dev, i will teach you how to use the io.open function. You can create an editable quest announcement without restarting the server or reload anything.

 

• on login example

quest ioopenexample_1 begin
state start begin
when login begin 
announcements = io.open("locale/location/announcements.txt")
notice("News:"..announcements:read()) 
end 
end
end

That's pretty simple. :D

 


(get_locale_base_path().."/announcements.txt")

maybe this could be better

  • Premium

And The Best Way To Write Inside It By quest So it's auto load without need restart the server

local addnews = io.open("data/last_one_stand", "a+")
say("news")
local news = input()
addnews:write(news.."tn")
addnews:close()

If you're going to do something, then do it right.

 

Hello metin2dev, i will teach you how to use the io.open function. You can create an editable quest announcement without restarting the server or reload anything.

 

• on login example

quest ioopenexample_1 begin
state start begin
when login begin 
announcements = io.open("locale/location/announcements.txt")
notice("News:"..announcements:read()) 
end 
end
end

That's pretty simple. :D

 


(get_locale_base_path().."/announcements.txt")

maybe this could be better

 

It's not necessary to run the txt from locale , it can be anywhere else.

E.g.: /usr/home/game/for_quests/announcements.txt

But , good point !

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.