Translated by Khan ( My neighbour )
i have a csgo rank icons, and i found this script.
this gave me an idea!
<-Credit-> Mozilla. ( Khan says caps is a kid things so i made it normal )
I need help for this script, i got CSGO Rank Icons. And this code, all i want is how to make the image apply to each rank, well i need help, i will share if theres somebody in need :3 well thanks. that's all.
Array.lua
Spoiler 

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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
p_exp			= initArray(32,0)
p_level			= initArray(32,0)
p_usgn			= initArray(32,0)
p_killstreak 	= initArray(32,0)
p_lastkill		= initArray(32,0)
p_rank			= initArray(32,"")
levelname = {}
levelname[1] = "Silver I"
levelname[3] = "Silver II"
levelname[5] = "Silver III"
levelname[7] = "Silver IIII"
levelname[8] = "Silver IIIII"
levelname[10] = "Silver Elite Master"
levelname[11] = "Gold Nova I"
levelname[12] = "Gold Nova II"
levelname[13] = "Gold Nova III"
levelname[14] = "Gold Nova Master"
levelname[15] = "Master Guardian I"
levelname[18] = "Master Guardian II"
levelname[19] = "Master Guardian Elite"
levelname[20] = "Distinguished Master Guardian"
levelname[21] = "Legendary Eagle"
levelname[22] = "Supreme Master First Class"
levelname[25] = "Global Elite"
Function.lua
Spoiler 

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
-- Core functions --
Image = {}
function initArray(length,mode)
local array = {}
for i = 1,length do
array[i] = mode
end
return array
end
function string_split(str,pattern)
local entry = {}
for str in string.gmatch(str,pattern) do
if str ~= "" then
table.insert(entry,str)
end
end
return entry
end
function is_file(filename)
local file = io.open(filename)
if file then
io.close(file)
return true
end
return false
end
function create_user(uid)
local usgn = get_usgn(uid)
local path = saves_folder..usgn..".txt"
if not is_file(path) then
file = io.open(path,"w")
file : write("maxexp="..p_maxexp[uid].."\n")
file : write("level="..p_level[uid].."\n")
file : write("rank="..p_rank[uid].."\n")
file : write("exp="..p_exp[uid].."\n")
file : close()
print("The user with number "..usgn.." created successfully.")
else
print("The user with number "..usgn.." already exists in the database.")
end
end
function refresh_user(uid)
local usgn = get_usgn(uid)
local path = saves_folder..usgn..".txt"
if is_file(path) then
file = io.open(path,"w")
file : write("maxexp="..p_maxexp[uid].."\n")
file : write("level="..p_level[uid].."\n")
file : write("rank="..p_rank[uid].."\n")
file : write("exp="..p_exp[uid].."\n")
file : close()
print("The user "..usgn.." successfully updated.")
else
print("The user "..usgn.." does not exist in the database.")
end
end
function isPlayer(uid)
return player(uid,"exists")
end
function playerInScreen(uid,player)
x,y = get_pos(uid)
px,py = get_pos(player)
if px - x > 320 or py - y > 240 then
return false
else
return true
end
end
function get_pos(uid)
return player(uid,"x"),player(uid,"y")
end
function get_name(uid)
return player(uid,"name")
end
function get_usgn(uid)
return player(uid,"usgn")
end
function get_ip(uid)
return player(uid,"ip")
end
function reset_flags(uid)
p_maxexp[uid] = 50
p_level[uid] = 1
p_rank[uid] = "[Norank]"
p_exp[uid] = 0
	 p_image[uid] = ("..levelimage..")
end
function set_flags(uid)
local usgn = get_usgn(uid)
local name = get_name(uid)
local path = saves_folder..usgn..".txt"
p_usgn[uid] = usgn
if is_file(path) then
local file = io.open(path,"r")
local temp = {}
for line in file:lines() do
local temp = string_split(line,"[^=]*")
if temp[1] == "maxexp" then p_maxexp[uid] = tonumber(temp[2]) end
if temp[1] == "level" then p_level[uid] = tonumber(temp[2]) end
if temp[1] == "rank" then p_rank[uid] = tostring(temp[2]) end
if temp[1] == "exp" then p_exp[uid] = tonumber(temp[2]) end
end
file : close()
msg2(uid,"©210235255Welcome "..name.." his USGN is "..usgn..", your information has been loaded successfully!")
elseif usgn ~= 0 then
create_user(uid)
msg2(uid,"©210235255Welcome "..name.." his USGN is "..usgn..", your information has been created successfully!")
else
msg2(uid,"©210235255"..name..", Please login into your usgn! Your data will not save.")
end
end
function refresh_hud(uid)
hud_txt2(uid,1,"©255255255 Experience: "..p_exp[uid].."/"..p_maxexp[uid],2,115,0)
hud_txt2(uid,2,"©255255255 USGN: "..player(uid,"usgn"),2,130,0)
hud_txt2(uid,3,"©255255255 Level: "..p_level[uid],2,145,0)
hud_txt2(uid,4,"©255255255 Rank: "..p_rank[uid],2,160,0)
end
function get_max_xp(level)
max_xp=(50*(level-1)*(level-1)*(level-1)-150*(level-1)*(level-1)+400*(level-1))/3
return max_xp
end
function check_level(uid)
if p_exp[uid] >= p_maxexp[uid] then
p_level[uid] = p_level[uid]+1
p_exp[uid] = 0
end
local x,y = get_pos(uid)
local level = p_level[uid]
p_rank[uid] = levelname[level]
msg2(uid,"©210235255You just go to the patent "..p_rank[uid])
end
p_maxexp[uid]=get_max_xp(level)
effect("flare",x,y,20,20,255,255,0)
msg2(uid,"©210235255[Levelup] From "..(level-1).." to level "..level..".")
		
end
end
function hud_txt2(uid,id,text,x,y,align)
parse("hudtxt2 "..uid.." "..id.." \""..text.."\" "..x.." "..y.." "..align)
end
function effect(name,x,y,radius,amount,r,g,b)
parse("effect \""..name.."\" "..x.." "..y.." "..radius.." "..amount.." "..r.." "..g.." "..b)
end
Hooks.lua
Spoiler 

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
addhook("kill","killstreak")
addhook("kill","r_kill")
addhook("join","r_join")
addhook("leave","r_leave")
addhook("say","r_say")
--------------------------------------------------
-- Hook Functions --
--------------------------------------------------
function r_kill(uid,vid,weapon)
	local x,y = get_pos(uid)
	local killer = get_name(uid)
	local victim = get_name(vid)
	if weapon==50 then
		msg2(uid,"©210235255You won "..knife_kill.." experience per kill knife!@C")
		p_exp[uid]=p_exp[uid]+knife_kill
	elseif not playerInScreen(uid,vid) then
		msg2(uid,"©210235255You won "..pesked_kill.." experience per kill from afar!@C")
		p_exp[uid]=p_exp[uid]+pesked_kill
	else
		p_exp[uid]=p_exp[uid]+normal_kill
	end
	
	refresh_hud(uid)
end
function killstreak(uid,vid,weapon)
	local x,y = get_pos(uid)
	local killer = string.upper(get_name(uid))
	local victim = string.upper(get_name(vid))
	
	if p_lastkill[uid] < os.time() then
		p_killstreak[uid] = 0
	end
	
	p_killstreak[uid] = p_killstreak[uid] + 1
	p_lastkill[uid] = os.time() + 3
	local level = p_killstreak[uid]
end
function r_join(uid)
	reset_flags(uid)
	set_flags(uid)
	
	check_level(uid)
	refresh_hud(uid)
end
function r_leave(uid)
	refresh_user(uid)
end
function r_say(uid,txt)
	local usgn = get_usgn(uid)
	local path = saves_folder..usgn..".txt"
	if txt == "!reset_lvl" then
		file = os.remove(path,"w")
		msg2(uid,"©200000200User with number "..usgn.." was removed successfully.")
		msg2(uid,"©255000000Updating server files, kicking players.")
		timer(5000,"parse","kick "..uid.." \" Retry \" ")
	return 1
	elseif txt == "!save" then
		refresh_user(uid)
	return 1
	elseif txt == "!help" then
		msg2(uid,"©200000200Type !reset_lvl to reset level")
		msg2(uid,"©050000200Type !save to save your data")
	return 1
	end
end
Thanks for the help! i will give credits! at my server
edited 1×, last 10.02.16 03:50:46 pm
Rank + Image
1 
Offline
Akira Kurusu
Edit: Right, you edited the last post. Yet I urge you to read my second prerequisite.