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
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
addhook("say","SaveRPname") function SaveRPname(id,txt,name) if txt:find("!register %S+")==1 then -- You're need to compare it with 1 to make sure if he/she doesn't type it at middle of text(e.x.: lol !register AuahDark) local name=txt:sub(11) local usgn = GetUsgn(id); if usgn > 0 then local file=io.open(path.."saves/"..name..".txt","r") if file then -- check if the file already exist return 1 end file = io.open(path.."saves/"..name..".txt","w"); if file then file:write(tostring(Player[id].name.."\n")); file:close() end return 1 end end end cGREEN = "©000255000"; cWHITE = "©255255255"; addhook("spawn","hud_text") function hud_text(id) parse('hudtxt2 '..id..' 1 "'..cGREEN..'ID: '..player(id,"usgn")..'" 8 440'); 	 parse('hudtxt2 '..id..' 2 "'..cGREEN..'Name: '..name..'" 8 455'); 	 parse('hudtxt2 '..id..' 3 "'..cGREEN..'Bank: '..player(id,"money")..'" 235 440'); 	 parse('hudtxt2 '..id..' 4 "'..cGREEN..'Money: '..player(id,"money")..'" 235 455'); 	 parse('hudtxt2 '..id..' 5 "'..cGREEN..'Salary: '..player(id,"money")..' (120 minutes)" 400 440'); 	 parse('hudtxt2 '..id..' 6 "'..cWHITE..'Health" 540 70'); 	 parse('hudtxt2 '..id..' 7 "'..cWHITE..'Armor" 540 110'); 	 end
I got two errors:
LUA ERROR: sys/lua/test.lua:30: attempt to concatenate global 'name' (a nil value)
if i type !register something..
LUA ERROR: sys/lua/test.lua:5: attempt to call global 'GetUsgn' (a nil value