summaryrefslogtreecommitdiff
path: root/gamemode/cl_deathmenu.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/cl_deathmenu.lua')
-rw-r--r--gamemode/cl_deathmenu.lua79
1 files changed, 36 insertions, 43 deletions
diff --git a/gamemode/cl_deathmenu.lua b/gamemode/cl_deathmenu.lua
index 6b023eb..b228ee8 100644
--- a/gamemode/cl_deathmenu.lua
+++ b/gamemode/cl_deathmenu.lua
@@ -46,6 +46,13 @@ local function receive_message(len)
res = net.ReadTable()
wep = net.ReadTable()
+for k,v in pairs(wep) do
+ print("death weapon: "..k.." : "..v)
+ end
+ for k,v in pairs(res) do
+ print("death resource: "..k.." : "..v)
+ end
+
if (active == 0) then dmFrame = vgui.Create("dmFrame") active = 1 end
end
@@ -164,9 +171,7 @@ function PANEL:Init()
local tbl1 = string.Split(res[k], " ")
local tbl2 = string.Split(tbl1[#tbl1], "x")
- local ntbl = tbl1
- table.remove(ntbl)
- rName = string.Implode(" ", ntbl)
+
local amount = tbl2[2]
resPNL.DoClick = function()
@@ -178,10 +183,9 @@ function PANEL:Init()
if (amount - 1 <= 0) then
amount = 0
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, 1, i)
+ if (getResName(v) == getResName(o)) then
+ print(getResName(v).." : "..getResName(o))
+ giveRes(getResName(o), 1, i)
table.remove(res,i)
end
end
@@ -191,12 +195,9 @@ function PANEL:Init()
for i,o in pairs(res) do
-
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, 1, i)
- res[i] = rName .. " x" .. amount
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), 1, i)
+ res[i] = getResName(o) .. " x" .. amount
v = res[i]
end
end
@@ -213,10 +214,8 @@ function PANEL:Init()
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, 5, i)
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), 5, i)
table.remove(res, i)
end
end
@@ -230,10 +229,8 @@ function PANEL:Init()
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, num2, i)
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), num2, i)
table.remove(res,i)
end
end
@@ -244,11 +241,9 @@ function PANEL:Init()
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, 5, i)
- res[i] = rName .. " x" .. amount
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), 5, i)
+ res[i] = getResName(o) .. " x" .. amount
v = res[i]
end
end
@@ -264,10 +259,8 @@ function PANEL:Init()
amount = 0
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, 10, i)
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), 10, i)
table.remove(res, i)
end
end
@@ -280,10 +273,8 @@ function PANEL:Init()
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, num2, i)
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), num2, i)
table.remove(res,i)
end
end
@@ -296,11 +287,9 @@ function PANEL:Init()
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, 10, i)
- res[i] = rName .. " x" .. amount
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), 10, i)
+ res[i] = getResName(o) .. " x" .. amount
v = res[i]
end
end
@@ -312,10 +301,8 @@ function PANEL:Init()
for i,o in pairs(res) do
- spl1 = string.Split(v, " ")
- spl2 = string.Split(o, " ")
- if (spl1[#spl1] == spl2[#spl2]) then
- giveRes(rName, amount, i)
+ if (getResName(v) == getResName(o)) then
+ giveRes(getResName(o), amount, i)
amount = 0
table.remove(res,i)
end
@@ -345,6 +332,12 @@ function PANEL:Init()
end
+function getResName(str)
+ spl = string.Split(str, " ")
+ table.remove(spl)
+ return string.Implode(" ", spl)
+end
+
function PANEL:Close()
active = 0
self:Remove()