English Removing Archive in Folder

7 replies
Goto Page
To the start Previous 1 Next To the start
05.05.12 02:47:31 am
Up
Jhony
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function readfile(filelocation, linenum) 
          savestr = {}
saveline=1
                      for line in io.lines(filelocation) do 
savestr[saveline]=line
              saveline=saveline+1
end
            return savestr[linenum]
end

function totable(t,match)
          local cmd = {}
               if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
           table.insert(cmd, word)
end
return cmd
end

addhook("say","givesline")  function givesline(id,txt)
                         local p = totable(txt)
             local cmd = (p[1])
  if cmd == "!set" then
                   local us = tonumber(p[2])
                                      if us > 0 then
                  File = io.open("sys/lua/usgns/"..us..".txt", "a")
                                  msg2(id,"©000255255 You Used !set")
          return 1
                                      end
                                           return 1
     end
  end

addhook("say","delete")
function dele(id,t)
if t == "!delete" then
local us = tonumber(p[2])
File = os.remove("sys/lua/usgns/"..us..".txt", "a")
end
return 1
end

addhook("join","save_join")
function save_join(id)
                     if player(id,"usgn") > 0 then
local filename = "sys/lua/usgns/"..player(id,"usgn")..".txt"
          local file = io.open(filename)
end
end

function fileExists(location)
                local f=io.open(location)
     if f~=nil then
                      io.close(f)
   end
                     return f~=nil
end


It Possible Remove a USGN in folder?

Code:
1
2
3
4
5
6
7
8
addhook("say","delete")
function dele(id,t)
if t == "!delete" then
local us = tonumber(p[2])
File = os.remove("sys/lua/usgns/"..us..".txt", "a")
end
return 1
end
No Works , Help me , if possible?
05.05.12 10:28:06 am
Up
Alistaire
User
Offline Off
You're adding a new file for every joined player?

----

Btw, you added the hook 'Delete', but the function is called 'Dele'.
IMG:http://i.imgur.com/5zhwOTP.png
05.05.12 10:33:51 am
Up
user Alistaire has written:
Btw, you added the hook 'Delete', but the function is called 'Dele'.

Owned
06.05.12 12:15:49 am
Up
Jhony
User
Offline Off
@user Alistaire: I Fixed, But No Works Now
06.05.12 09:46:21 am
Up
Alistaire
User
Offline Off
user Jhony has written:
@user Alistaire: I Fixed, But No Works Now


Idk about this, but you could ask Engineer or someone.
IMG:http://i.imgur.com/5zhwOTP.png
06.05.12 04:13:51 pm
Up
PyKemis
User
Offline Off
I think it's

Code:
1
File = os.remove("sys/lua/usgns/"..us..".txt")


not

Code:
1
File = os.remove("sys/lua/usgns/"..us..".txt", "a")
06.05.12 04:16:42 pm
Up
Alistaire
User
Offline Off
Hahaha yes you can't use os.remove('file', 'a').

Code:
1
io.open('file', 'a')


Means you add stuff to one thing.

Code:
1
os.remove


Removes the output source, you can't use an add part with removing something.
IMG:http://i.imgur.com/5zhwOTP.png
06.05.12 05:25:21 pm
Up
sheeL
User
Offline Off
addhook("say","delete") function dele? <--

Code:
1
2
3
4
5
6
7
8
addhook("say","delete")
function dele(id,t)
if t == "!delete" then
local us = tonumber(p[2])
File = os.remove("sys/lua/usgns/"..us..".txt", "a")
end
return 1
end


change to

Code:
1
2
3
4
5
6
7
8
addhook("say","delete")
function delete(id,t)
if t == "!delete" then
local us = tonumber(p[2])
File = os.remove("sys/lua/usgns/"..us..".txt", "a")
end
return 1
end
edited 1×, last 07.05.12 05:18:37 am
To the start Previous 1 Next To the start