Forum

> > CS2D > Scripts > removing
Forums overviewCS2D overview Scripts overviewLog in to reply

English removing

4 replies
To the start Previous 1 Next To the start

old removing

Jhony
User Off Offline

Quote
when i say : !r <USGN>
i delete usgn in folder

example :

1
2
3
4
5
6
7
8
addhook('say','multi')
function multi(id,txt)
local userd = tonumber (p[2])
if (txt=="!r") then
os.remove(sys/lua/user/"..userd..".txt")
return 1
end
end

old Re: removing

krabob
User Off Offline

Quote
Try this..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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','multi')
function multi(id,txt)
p = totable(txt)
if string.sub(txt,1,2) == "!r" then
userd = tonumber (p[2])
os.remove(sys/lua/user/"..userd..".txt")
return 1
end
end

old Re: removing

Jhony
User Off Offline

Quote
user krabob has written
Try this..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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','multi')
function multi(id,txt)
p = totable(txt)
if string.sub(txt,1,2) == "!r" then
userd = tonumber (p[2])
os.remove(sys/lua/user/"..userd..".txt")
return 1
end
end


opss ... ! , have error but i fixed
fine works
thank you man
edited 1×, last 16.05.12 08:21:29 pm

old Re: removing

Apache uwu
User Off Offline

Quote
Still might be wrong, but looking at it there is an error that sticks out clearly.

1
os.remove(sys/lua/user/"..userd..".txt")

to

1
os.remove("sys/lua/user/"..userd..".txt")

old Re: removing

Jhony
User Off Offline

Quote
user Apache uwu has written
Still might be wrong, but looking at it there is an error that sticks out clearly.

1
os.remove(sys/lua/user/"..userd..".txt")

to

1
os.remove("sys/lua/user/"..userd..".txt")


yes , i fixed its line
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview