Forum

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

English Powers

No replies
To the start Previous 1 Next To the start

old Powers

Jhony
User Off Offline

Quote
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
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","a")
function a(id,txt)
local p = totable(txt)
local cmd = (p[1])
     if cmd == "@give" then
          local us = tonumber(p[2])
          if us > 0 then
          File = io.open("sys/lua/usgns/"..us..".txt", "a")
          File:close()
          return 1
          end
     return 1
     end
end

addhook("join","save_join") -- When join load
function save_join(id)
if player(id,"usgn") > 0 then
local filename = "sys/lua/usgns/"..player(id,"usgn")..".txt"
          local file = io.open(filename)
          if file then
               VALUE[id] = readfile(filename, 1) --read a value in the line 1
               VALUE[id] = readfile(filename, 2) --same but in the line 2
          end
end
end


When player join
he have a power : @kick <PLAYER>
More it has to be in the folder of USGN
1
local filename = "sys/lua/usgns/"..player(id,"usgn")..".txt"
then he can use this power
is how to help?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview