Today i got idea to make jobs in my server so then i maked one script for save and load values. but my script doesn't loading variables
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
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
job = {2} addhook("join","load_job") addhook("leave","save_job") function load_job(id) if (player(id,"usgn")>0) then local filename = "sys/lua/rp/money/account/%s.txt" local file = io.open(filename:format(player(id,"usgn"), "r")) local line if not file then line = {2} else line = file:read("*a"):split() end job[id] = tonumber(line[2]) msg2(id,"©255000000Your job is" ..job[id]) job=0 end end function save_job(id) if (player(id,"usgn")>0) then io.output(io.open("sys/lua/rp/money/account/"..player(id,"usgn").."Job.txt","w+")) io.write(n/ job[id]) io.close() end end
i have new errors:
"server.lua:16: attempt to concatenate field '?' (a nil value)" and "server.lua:24: attempt to perform arithmetic on global 'n' (a nil value)
edited 6×, last 04.02.15 04:34:41 pm