Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 14:38

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE]Data_tool ( lua & i/o easy way )

Discussion on [RELEASE]Data_tool ( lua & i/o easy way ) within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
d3m0n3's Avatar
 
elite*gold: 0
Join Date: Jun 2011
Posts: 75
Received Thanks: 178
[RELEASE]Data_tool ( lua & i/o easy way )

hi all,

i will release a small but useful tool to manage the read / write file I / O system in lua commonly used in many scripts also creates a backup copy of the edited file (in write mode)


copy in questlib.lua:

Code:
DATA_READ = 0
DATA_WRITE = 1


function data_tool(DATA_MODE, DATA_FILE, DATA_LINE)
    local x = 1
    local file = ""
    if DATA_MODE == DATA_READ then
        file = io.open(DATA_FILE, "r")
        while true do
            local line = file:read("*l")
            if line == nil then 
                break 
            end
            text = string.gsub(line, "\n", "")
            if x == DATA_LINE then 
                io.close(file)
                return text
            end
            x = x + 1
        end
        io.close(file)
    elseif DATA_MODE == DATA_WRITE then
        os.rename(DATA_FILE, DATA_FILE..".BAK")
        file = io.open(DATA_FILE, "w")
        file:write(DATA_LINE)
        io.close(file)
        os.execute("chmod 777 "..DATA_FILE)
    end
end
how to use it:

first be copied to questlib.lua and we should be all right here ... xD

VARIABLES:

DATA_MODE = indicates how to act on the file (DATA_READ / 0 = read, DATA_WRITE / 1 = write)

Data_file = specifies the file on which to act (absolute path)

DATA_LINE = in read mode indicates the number of the line to be read, in write mode the text to write.

as use read / write:
as an example we use the file: file.txt located in the path / home / game /

Code:
read example:

local data = "/home/game/file.txt"
local linea = 3
local result = data_tool(DATA_READ, data, linea)

write example:

local data = "/home/game/file.txt"
local linea = "ciao"
data_tool(DATA_WRITE, data, linea)
In the first case we read from file.txt line number 3
in the second case we wrote in file.txt ciao

I hope I was clear enough and useful

P.S.: if you want you can add the flag to increase the functionality, but this is up to you ...

enjoy

d3m0n3
d3m0n3 is offline  
Thanks
5 Users
Old 09/08/2012, 00:59   #2
 
elite*gold: 0
Join Date: Jun 2012
Posts: 15
Received Thanks: 19
No One comment? I Think it's so usefull to control I/O Lua in a better way. Now i use this system! Is So GOOD
--DarkScorp-- is offline  
Old 09/08/2012, 02:38   #3
 
Red Firestar's Avatar
 
elite*gold: 0
The Black Market: 185/0/0
Join Date: Jul 2012
Posts: 5,520
Received Thanks: 1,350
Nice *-*


nicht vergessen auf den Spoiler drücken schadet nicht
Red Firestar is offline  
Old 09/08/2012, 11:49   #4
 
elite*gold: 0
Join Date: Nov 2011
Posts: 395
Received Thanks: 29
thanks a lot
Laben is offline  
Old 09/13/2012, 17:30   #5
 
miguelmig's Avatar
 
elite*gold: 0
Join Date: Dec 2009
Posts: 113
Received Thanks: 44
What about a DATA_READ_ALL and a DATA_APPEND format?
I think it would be a good idea.
miguelmig is offline  
Old 09/14/2012, 17:40   #6
 
d3m0n3's Avatar
 
elite*gold: 0
Join Date: Jun 2011
Posts: 75
Received Thanks: 178
Quote:
Originally Posted by miguelmig View Post
What about a DATA_READ_ALL and a DATA_APPEND format?
I think it would be a good idea.
as I wrote in the first post you can add an input variable to handle the flag and expand the full functionality of the tool of course with the addition of other flags should be made ​​more checks on operations
d3m0n3 is offline  
Reply


Similar Threads Similar Threads
[Release]Easy Launcher + Easy Injector In 1! [Release]
09/09/2010 - Soldier Front Hacks, Bots, Cheats & Exploits - 64 Replies
Hello Elitepvpers, I'm back with a new project! I was bored so i made a USF EasyLauncher + EasyInjector! (ONLY FOR USF! Not for PSF!) U only have to press 3 buttons to start sf with a hack in it! Easy isn't it? U can use it without hack to! Instruction: 1)Open EasyLaunch.exe 2)Login (It's on ijji's site so trusted!)
[Release] RangeHack easy ..
05/14/2008 - Kal Online - 19 Replies
Hi @ all, Im bored So I gonna release a easy version of rangehack ..without modify a pk file .. :) 1. First open your UCE 2. Attach Process 3. Start Game 4. Go back to your UCE and go into the Memory viewer. 5. Press CTRL + F for search .. type in your Skill .. my skill is Passive Attck so I type Passive and search for it... 6. When you found it you scroll abit down and look for lines like these : http://img176.imageshack.us/img176/5768/step1eu5. th.jpg



All times are GMT +2. The time now is 14:38.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.