Jump to content

IO.Open Function - Announcements


Syron

Recommended Posts

M2 Download Center

Download Here ( 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

  • Love 5
Link to comment
  • 2 weeks later...

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

Link to comment
  • VIP

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.

Link to comment

 

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 !

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

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.