From 4551dce132c36e2be0f332409d550d87615a21e9 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 8 Jul 2022 17:05:19 +0200 Subject: [PATCH 01/71] Add files via upload --- endstats.lua | 1016 +++++++++++++++++++++++++++++++++++++++++++ objtrack.lua | 1170 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2186 insertions(+) create mode 100644 endstats.lua create mode 100644 objtrack.lua diff --git a/endstats.lua b/endstats.lua new file mode 100644 index 0000000..f63e75e --- /dev/null +++ b/endstats.lua @@ -0,0 +1,1016 @@ +-- endstats.lua by x0rnn, shows some interesting game statistics at the end of a round (highest light weapon acc, highest hs acc, most dynamites planted, most pistol kills, kill/death stats vs. all opponents, etc.) + +killing_sprees = {} +death_sprees = {} +kmulti = {} +kendofmap = false +eomap_done = false +eomaptime = 0 +gamestate = -1 +topshots = {} +axis_time = {} +allies_time = {} +mkps = {} +weaponstats = {} +endplayers = {} +endplayerscnt = 0 +tblcount = 0 +vsstats = {} +vsstats_kills = {} +vsstats_deaths = {} +kills = {} +deaths = {} +worst_enemy = {} +easiest_prey = {} +vsstats = {} +vsstats_kills = {} +vsstats_deaths = {} + +topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned" } + +function et_InitGame(levelTime, randomSeed, restart) + + et.RegisterModname("endstats.lua "..et.FindSelf()) + sv_maxclients = tonumber(et.trap_Cvar_Get("sv_maxclients")) + + local i = 0 + for i=0, sv_maxclients-1 do + killing_sprees[i] = 0 + death_sprees[i] = 0 + kmulti[i] = { [1]=0, [2]=0, } + topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0 } + mkps[i] = { [1]=0, [2]=0, [3]=0 } + axis_time[i] = 0 + allies_time[i] = 0 + kills[i] = 0 + deaths[i] = 0 + end + + local j = 0 + for j=0,sv_maxclients-1 do + vsstats[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_kills[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_deaths[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + worst_enemy[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + easiest_prey[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + end +end + +function n2b(number) -- thanks to adawolfa + local bits = {} + + local i = 1 + while 2 ^ (i + 1) < number do + i = i + 1 + end + + while i >= 0 do + if 2 ^ i <= number then + table.insert(bits, 2 ^ i) + number = number - 2 ^ i + end + i = i - 1 + end + + return bits, #bits +end + +local function roundNum(num, n) + local mult = 10^(n or 0) + return math.floor(num * mult + 0.5) / mult +end + +function getKeysSortedByValue(tbl, sortFunction) + local keys = {} + for key in pairs(tbl) do + table.insert(keys, key) + end + + table.sort(keys, function(a, b) + return sortFunction(tbl[a], tbl[b]) + end) + + return keys +end + +function topshots_f(id) + local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local i = 0 + for i=0, sv_maxclients-1 do + local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) + if team == 1 or team == 2 then + local dg = tonumber(et.gentity_get(i, "sess.damage_given")) + local dr = tonumber(et.gentity_get(i, "sess.damage_received")) + local tdg = tonumber(et.gentity_get(i, "sess.team_damage_given")) + local tdr = tonumber(et.gentity_get(i, "sess.team_damage_received")) + local tk = tonumber(et.gentity_get(i, "sess.team_kills")) + local sk = tonumber(et.gentity_get(i, "sess.self_kills")) + local d = tonumber(et.gentity_get(i, "sess.deaths")) + local k = tonumber(et.gentity_get(i, "sess.kills")) + local kd = 0 + if d ~= 0 then + kd = k/d + else + kd = k + 1 + end + + -- damage given + if dg > max[1] then + max[1] = dg + max_id[1] = i + end + -- damage received + if dr > max[2] then + max[2] = dr + max_id[2] = i + end + -- team damage given + if tdg > max[3] then + max[3] = tdg + max_id[3] = i + end + -- team damage received + if tdr > max[4] then + max[4] = tdr + max_id[4] = i + end + -- teamkills + if tk > max[5] then + max[5] = tk + max_id[5] = i + end + -- selfkills + if sk > max[6] then + max[6] = sk + max_id[6] = i + end + -- deaths + if d > max[7] then + max[7] = d + max_id[7] = i + end + -- kills per minute + if team == 1 then + if k > 10 then + local kpm = k/(((eomaptime - axis_time[i])/1000)/60) + if kpm > max[8] then + max[8] = kpm + max_id[8] = i + end + end + elseif team == 2 then + if k > 10 then + local kpm = k/(((eomaptime - allies_time[i])/1000)/60) + if kpm > max[8] then + max[8] = kpm + max_id[8] = i + end + end + end + -- quickest lightweapon multikill + if topshots[i][14] >= max[9] then + if topshots[i][14] > max[9] then + max[9] = topshots[i][14] + max[10] = topshots[i][15] + max_id[9] = i + max_id[10] = i + elseif topshots[i][14] == max[9] then + if topshots[i][15] < max[10] then + max[9] = topshots[i][14] + max[10] = topshots[i][15] + max_id[9] = i + max_id[10] = i + end + end + end + -- farthest riflegrenade kill + if topshots[i][16] > max[11] then + max[11] = topshots[i][16] + max_id[11] = i + end + -- lightweapon kills + if topshots[i][1] > max[12] then + max[12] = topshots[i][1] + max_id[12] = i + end + -- pistol kills + if topshots[i][2] > max[13] then + max[13] = topshots[i][2] + max_id[13] = i + end + -- rifle kills + if topshots[i][3] > max[14] then + max[14] = topshots[i][3] + max_id[14] = i + end + -- riflegrenade kills + if topshots[i][4] > max[15] then + max[15] = topshots[i][4] + max_id[15] = i + end + -- sniper kills + if topshots[i][5] > max[16] then + max[16] = topshots[i][5] + max_id[16] = i + end + -- knife kills + if topshots[i][6] > max[17] then + max[17] = topshots[i][6] + max_id[17] = i + end + -- air support kills + if topshots[i][7] > max[18] then + max[18] = topshots[i][7] + max_id[18] = i + end + -- mine kills + if topshots[i][8] > max[19] then + max[19] = topshots[i][8] + max_id[19] = i + end + -- grenade kills + if topshots[i][9] > max[20] then + max[20] = topshots[i][9] + max_id[20] = i + end + -- panzerfaust kills + if topshots[i][10] > max[21] then + max[21] = topshots[i][10] + max_id[21] = i + end + -- mortar kills + if topshots[i][11] > max[22] then + max[22] = topshots[i][11] + max_id[22] = i + end + -- panzerfaust deaths + if topshots[i][12] > max[23] then + max[23] = topshots[i][12] + max_id[23] = i + end + -- mortar deaths + if topshots[i][13] > max[24] then + max[24] = topshots[i][13] + max_id[24] = i + end + -- multikills + if topshots[i][17] > max[25] then + max[25] = topshots[i][17] + max_id[25] = i + end + -- mg42 kills + if topshots[i][18] > max[26] then + max[26] = topshots[i][18] + max_id[26] = i + end + -- mg42 deaths + if topshots[i][19] > max[27] then + max[27] = topshots[i][19] + max_id[27] = i + end + -- most revives + if topshots[i][20] > max[28] then + max[28] = topshots[i][20] + max_id[28] = i + end + -- most revived + if topshots[i][21] > max[29] then + max[29] = topshots[i][21] + max_id[29] = i + end + -- k/d ratio + if k > 9 then + if kd > max[30] then + max[30] = kd + max_id[30] = i + end + end + -- most dynamites planted + if topshots[i][22] > max[31] then + max[31] = topshots[i][22] + max_id[31] = i + end + -- most dynamites defused + if topshots[i][23] > max[32] then + max[32] = topshots[i][23] + max_id[32] = i + end + -- most doublekills + local dk = topshots[i][24] - topshots[i][17] + if dk > max[33] then + max[33] = dk + max_id[33] = i + end + --longest kill spree + if topshots[i][25] > max[34] then + max[34] = topshots[i][25] + max_id[34] = i + end + --longest death spree + if topshots[i][26] > max[35] then + max[35] = topshots[i][26] + max_id[35] = i + end + --most objectives stolen + if topshots[i][27] > max[36] then + max[36] = topshots[i][27] + max_id[36] = i + end + --most objectives returned + if topshots[i][28] > max[37] then + max[37] = topshots[i][28] + max_id[37] = i + end + end + end + if id == -2 then + local ws_max = { 0, 0, 0, 0 } + local ws_max_id = { 0, 0, 0, 0} + local cnt = 0 + for cnt=0, sv_maxclients-1 do + if endplayers[cnt] then + -- highest light weapons accuracy + if weaponstats[cnt][2] > 100 then + if (weaponstats[cnt][1]/weaponstats[cnt][2])*100 > ws_max[1] then + ws_max[1] = (weaponstats[cnt][1]/weaponstats[cnt][2])*100 + ws_max_id[1] = cnt + end + end + -- highest headshot accuracy + if weaponstats[cnt][1] > 10 and weaponstats[cnt][2] > 100 then + if (weaponstats[cnt][3]/weaponstats[cnt][1])*100 > ws_max[2] then + ws_max[2] = (weaponstats[cnt][3]/weaponstats[cnt][1])*100 + ws_max_id[2] = cnt + end + end + -- most headshots + if weaponstats[cnt][3] > ws_max[3] then + ws_max[3] = weaponstats[cnt][3] + ws_max_id[3] = cnt + end + -- most bullets fired + if weaponstats[cnt][2] > ws_max[4] then + ws_max[4] = weaponstats[cnt][2] + ws_max_id[4] = cnt + end + end + end + local j = 1 + local players = {} + for j=1, 37 do + if max[j] > 1 then + if j ~= 10 and j ~= 25 and j ~= 33 then + if j == 8 then + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. "\"\n") + table.insert(players, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + roundNum(max[j], 2) + }) + elseif j == 9 then + -- dirty "fix" instead of reordering all indexes lol + if max[33] > 1 then + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[33] .. ": " .. et.gentity_get(max_id[33], "pers.netname") .. " ^z- ^1" .. max[33] .. "\"\n") + table.insert(players, { + topshot_names[33], + et.gentity_get(max_id[33], "pers.netname"), + max[33] + }) + end + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[25] .. ": " .. et.gentity_get(max_id[25], "pers.netname") .. " ^z- ^1" .. max[25] .. "\"\n") + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. max[j] .. " ^zkills in ^1" .. roundNum(max[10]/1000, 3) .. " ^zseconds\"\n") + table.insert(players, { + topshot_names[25], + et.gentity_get(max_id[25], "pers.netname"), + max[25] + }) + table.insert(players, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + max[j] .. " ^7kills in " .. roundNum(max[10]/1000, 2) .. "s" + }) + elseif j == 11 then + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. " ^zm\"\n") + table.insert(players, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + roundNum(max[j], 2) .. " ^7m" + }) + else + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. max[j] .. "\"\n") + table.insert(players, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + max[j] + }) + end + end + end + end + local z = 1 + for z = 1, 4 do + if ws_max[z] > 1 then + if z == 1 then + --et.trap_SendServerCommand(-1, "chat \"^zHighest light weapons accuracy: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. roundNum(ws_max[z], 2) .. " ^zpercent\"\n") + table.insert(players, { + "Highest light weapons accuracy", + et.gentity_get(ws_max_id[z], "pers.netname"), + roundNum(ws_max[z], 2) .. " percent" + }) + elseif z == 2 then + --et.trap_SendServerCommand(-1, "chat \"^zHighest headshot accuracy: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. roundNum(ws_max[z], 2) .. " ^zpercent\"\n") + table.insert(players, { + "Highest headshot accuracy", + et.gentity_get(ws_max_id[z], "pers.netname"), + roundNum(ws_max[z], 2) .. " percent" + }) + elseif z == 3 then + --et.trap_SendServerCommand(-1, "chat \"^zMost headshots: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. ws_max[z] .. "\"\n") + table.insert(players, { + "Most headshots", + et.gentity_get(ws_max_id[z], "pers.netname"), + ws_max[z] + }) + elseif z == 4 then + --et.trap_SendServerCommand(-1, "chat \"^zMost bullets fired: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. ws_max[z] .. "\"\n") + table.insert(players, { + "Most bullets fired", + et.gentity_get(ws_max_id[z], "pers.netname"), + ws_max[z] + }) + end + end + end + send_table(-1, { + {name = "Award" }, + {name = "Player", align = "right"}, + {name = "Value", align = "right"}, + }, players) + local p = 0 + for p=0, sv_maxclients-1 do + local t = tonumber(et.gentity_get(p, "sess.sessionTeam")) + if t == 1 or t == 2 then + et.trap_SendServerCommand(p, "cpm \"^zKills: ^1" .. kills[p] .. " ^z- Deaths: ^1" .. deaths[p] .. " ^z- Damage given: ^1" .. tonumber(et.gentity_get(p, "sess.damage_given")) .. "\"\n") + local top_we = {0, 0} + local top_ep = {0, 0} + local e = 0 + for e=0, sv_maxclients-1 do + if e ~= p then + local t2 = tonumber(et.gentity_get(e, "sess.sessionTeam")) + if t2 == 1 or t2 == 2 then + if t ~= t2 then + vsstats_f(p, e) + if worst_enemy[p][e] > top_we[1] then + top_we[1] = worst_enemy[p][e] + top_we[2] = e + end + if easiest_prey[p][e] > top_ep[1] then + top_ep[1] = easiest_prey[p][e] + top_ep[2] = e + end + end + end + end + end + local sortedKeys = getKeysSortedByValue(vsstats_kills[p], function(a, b) return a > b end) + local players2 = {} + for _, key in ipairs(sortedKeys) do + if not (vsstats_kills[p][key] == 0 and vsstats_deaths[p][key] == 0) then + local t3 = tonumber(et.gentity_get(key, "sess.sessionTeam")) + if t3 == 1 or t3 == 2 then + if t ~= t3 then + --et.trap_SendServerCommand(p, "chat \"" .. et.gentity_get(key, "pers.netname") .. "^7: ^3Kills: ^7" .. vsstats_kills[p][key] .. " ^3Deaths: ^7" .. vsstats_deaths[p][key] .. "\"") + table.insert(players2, { + et.gentity_get(key, "pers.netname"), + vsstats_kills[p][key], + vsstats_deaths[p][key] + }) + end + end + end + end + send_table(p, { + {name = "Player" }, + {name = "Kills", align = "right"}, + {name = "Deaths", align = "right"}, + }, players2) + + if top_ep[1] > 3 then + et.trap_SendServerCommand(p, "cpm \"^zEasiest prey: " .. et.gentity_get(top_ep[2], "pers.netname") .. "^z- Kills: ^1" .. top_ep[1] .. "\"\n") + end + if top_we[1] > 3 then + et.trap_SendServerCommand(p, "cpm \"^zWorst enemy: " .. et.gentity_get(top_we[2], "pers.netname") .. "^z- Deaths: ^1" .. top_we[1] .. "\"\n") + end + end + end + end +end + +function vsstats_f(id, id2) + local ratio = 0 + if vsstats[id2][id] == 0 then + ratio = vsstats[id][id2] + else + if vsstats[id][id2] == 0 then + ratio = -vsstats[id2][id] + else + ratio = roundNum(vsstats[id][id2]/vsstats[id2][id], 2) + end + end + if not (vsstats[id][id2] == 0 and vsstats[id2][id] == 0) then + vsstats_kills[id][id2] = vsstats[id][id2] + vsstats_deaths[id][id2] = vsstats[id2][id] + end +end + +function et_Print(text) + if gamestate == 0 then + if string.find(text, "Medic_Revive") then + local junk1,junk2,medic,zombie = string.find(text, "^Medic_Revive:%s+(%d+)%s+(%d+)") + topshots[tonumber(medic)][20] = topshots[tonumber(medic)][20] + 1 + topshots[tonumber(zombie)][21] = topshots[tonumber(zombie)][21] + 1 + end + if string.find(text, "Dynamite_Plant") then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + topshots[id][22] = topshots[id][22] + 1 + end + if string.find(text, "Dynamite_Diffuse") then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + topshots[id][23] = topshots[id][23] + 1 + end + if string.find(text, "team_CTF_redflag") or string.find(text, "team_CTF_blueflag") then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + if string.find(text, "team_CTF_redflag") then + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + if team == 2 then + topshots[id][27] = topshots[id][27] + 1 + elseif team == 1 then + topshots[id][28] = topshots[id][28] + 1 + end + elseif string.find(text, "team_CTF_blueflag") then + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + if team == 1 then + topshots[id][27] = topshots[id][27] + 1 + elseif team == 2 then + topshots[id][28] = topshots[id][28] + 1 + end + end + end + end + + if kendofmap and string.find(text, "^WeaponStats: ") == 1 then + if endplayerscnt < tblcount then + for id, m, bla in string.gmatch(text, "WeaponStats: ([%d]+) [%d]+ ([%d]+) ([^\n]+)") do + if endplayers[tonumber(id)] then + if weaponstats[tonumber(id)] == nil then + endplayerscnt = endplayerscnt + 1 + if tonumber(m)~=0 and tonumber(m)~=1 and tonumber(m)~=2 and tonumber(m)~=4 and tonumber(m)~=8 and tonumber(m)~=16 and tonumber(m)~=32 and tonumber(m)~=64 and tonumber(m)~=128 and tonumber(m)~=256 and tonumber(m)~=512 and tonumber(m)~=1024 and tonumber(m)~=2048 and tonumber(m)~=4096 and tonumber(m)~=8192 and tonumber(m)~=16384 and tonumber(m)~=32768 and tonumber(m)~=65536 and tonumber(m)~=131072 and tonumber(m)~=262144 and tonumber(m)~=524288 and tonumber(m)~=1048576 and tonumber(m)~=2097152 then + bits, bits_len = n2b(tonumber(m)) + local j = 1 + local knife = false + local w = 0 + for j = 1,bits_len do + if bits[j] == 1 or bits[j] == 2 or bits[j] == 4 or bits[j] == 8 or bits[j] == 16 or bits[j] == 32 then + if bits[j] == 1 then + knife = true + else + w = w + 1 + end + end + end + if w ~= 0 then + if knife == true then + if w == 1 then + for hits, shots, hs in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits), [2]=tonumber(shots), [3]=tonumber(hs) } + end + elseif w == 2 then + for hits1,shots1,hs1,hits2,shots2,hs2 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2), [2]=tonumber(shots1)+tonumber(shots2), [3]=tonumber(hs1)+tonumber(hs2) } + end + elseif w == 3 then + for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3) } + end + elseif w == 4 then + for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4) } + end + elseif w == 5 then + for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4,hits5,shots5,hs5 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4)+tonumber(hits5), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4)+tonumber(shots5), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4)+tonumber(hs5) } + end + end + else + if w == 1 then + for hits, shots, hs in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits), [2]=tonumber(shots), [3]=tonumber(hs) } + end + elseif w == 2 then + for hits1,shots1,hs1,hits2,shots2,hs2 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2), [2]=tonumber(shots1)+tonumber(shots2), [3]=tonumber(hs1)+tonumber(hs2) } + end + elseif w == 3 then + for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3) } + end + elseif w == 4 then + for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4) } + end + elseif w == 5 then + for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4,hits5,shots5,hs5 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4)+tonumber(hits5), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4)+tonumber(shots5), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4)+tonumber(hs5) } + end + end + end + else + weaponstats[tonumber(id)] = { [1]=0, [2]=0, [3]=0 } + end + else + if tonumber(m) == 2 or tonumber(m) == 4 or tonumber(m) == 8 or tonumber(m) == 16 or tonumber(m) == 32 then + for hits, shots, hs in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do + weaponstats[tonumber(id)] = { [1]=tonumber(hits), [2]=tonumber(shots), [3]=tonumber(hs) } + end + else + weaponstats[tonumber(id)] = { [1]=0, [2]=0, [3]=0 } + end + end + end + end + end + if endplayerscnt == tblcount then + eomap_done = true + eomaptime = et.trap_Milliseconds() + 1000 + end + end + return(nil) + end + + if text == "Exit: Timelimit hit.\n" or text == "Exit: Wolf EndRound.\n" then + local x = 0 + for x=0,sv_maxclients-1 do + local team = tonumber(et.gentity_get(x, "sess.sessionTeam")) + if team == 1 or team == 2 then + endplayers[x] = true + end + end + for _ in pairs(endplayers) do + tblcount = tblcount + 1 + end + kendofmap = true + for i = 0, sv_maxclients-1 do + if killing_sprees[i] > 0 then + checkKSpreeEnd(i) + end + end + return(nil) + end +end + +function checkMultiKill (id, mod) + local lvltime = et.trap_Milliseconds() + if (lvltime - kmulti[id][1]) < 3000 then + kmulti[id][2] = kmulti[id][2] + 1 + if mod==7 or mod==8 or mod==9 or mod==10 or mod==58 or mod==59 then + mkps[id][1] = mkps[id][1] + 1 + if mkps[id][2] == 0 then + mkps[id][2] = lvltime + else + mkps[id][3] = et.trap_Milliseconds() + end + if mkps[id][1] >= 3 then + if mkps[id][1] >= topshots[id][14] then + if mkps[id][1] > topshots[id][14] then + topshots[id][14] = mkps[id][1] + topshots[id][15] = mkps[id][3] - mkps[id][2] + elseif mkps[id][1] == topshots[id][14] then + if (mkps[id][3] - mkps[id][2]) < topshots[id][15] then + topshots[id][15] = mkps[id][3] - mkps[id][2] + end + end + end + end + end + + if kmulti[id][2] == 2 then + topshots[id][24] = topshots[id][24] + 1 + elseif kmulti[id][2] == 3 then + topshots[id][17] = topshots[id][17] + 1 + elseif kmulti[id][2] == 6 then + topshots[id][17] = topshots[id][17] + 1 + end + else + kmulti[id][2] = 1 + mkps[id][1] = 1 + mkps[id][2] = 0 + mkps[id][3] = 0 + end + kmulti[id][1] = lvltime +end + +function dist(a, b) + ax, ay, az = a[1], a[2], a[3] + bx, by, bz = b[1], b[2], b[3] + dx = math.abs(bx - ax) + dy = math.abs(by - ay) + dz = math.abs(bz - az) + d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) + return math.floor(d) / 39.37 +end + +function et_Obituary(victim, killer, mod) + if gamestate == 0 then + local v_teamid = et.gentity_get(victim, "sess.sessionTeam") + local k_teamid = et.gentity_get(killer, "sess.sessionTeam") + if (victim == killer) then -- suicide + + if mod == 37 or mod == 64 then + checkKSpreeEnd(victim) + if mod == 37 then + death_sprees[victim] = death_sprees[victim] + 1 + end + end + + killing_sprees[victim] = 0 + if mod == 37 then + deaths[victim] = deaths[victim] + 1 + end + + elseif (v_teamid == k_teamid) then -- team kill + + checkKSpreeEnd(victim) + killing_sprees[victim] = 0 + --death_sprees[victim] = death_sprees[victim] + 1 + + else -- nomal kill + if killer ~= 1022 and killer ~= 1023 then -- no world / unknown kills + + killing_sprees[killer] = killing_sprees[killer] + 1 + death_sprees[victim] = death_sprees[victim] + 1 + + vsstats[killer][victim] = vsstats[killer][victim] + 1 + kills[killer] = kills[killer] + 1 + deaths[victim] = deaths[victim] + 1 + worst_enemy[victim][killer] = worst_enemy[victim][killer] + 1 + easiest_prey[killer][victim] = easiest_prey[killer][victim] + 1 + local posk = et.gentity_get(victim, "ps.origin") + local posv = et.gentity_get(killer, "ps.origin") + local killdist = dist(posk, posv) + + checkMultiKill(killer, mod) + + checkKSpreeEnd(victim) + checkDSpreeEnd(killer) + + -- most lightweapons kills + if mod==7 or mod==8 or mod==9 or mod==10 or mod==11 or mod==14 or mod==50 or mod==58 or mod==59 or mod==60 or mod==61 then + -- most pistol kills + if mod==7 or mod==8 or mod==14 or mod==50 or mod==58 or mod==59 or mod==60 or mod==61 then + topshots[killer][2] = topshots[killer][2] + 1 + end + topshots[killer][1] = topshots[killer][1] + 1 + end + -- most rifle kills + if mod == 12 or mod == 55 or mod == 41 or mod == 42 then + topshots[killer][3] = topshots[killer][3] + 1 + end + -- most riflegrenade kills + farthest riflegrenade kill + if mod == 43 or mod == 44 then + topshots[killer][4] = topshots[killer][4] + 1 + if killdist > topshots[killer][16] then + topshots[killer][16] = killdist + end + end + -- most sniper kills + if mod == 51 or mod == 56 then + topshots[killer][5] = topshots[killer][5] + 1 + end + -- most knife kills + if mod == 6 then + topshots[killer][6] = topshots[killer][6] + 1 + end + -- most air support kills + if mod == 27 or mod == 30 then + topshots[killer][7] = topshots[killer][7] + 1 + end + -- most mine kills + if mod == 45 then + topshots[killer][8] = topshots[killer][8] + 1 + end + -- most grenade kills + if mod == 18 then + topshots[killer][9] = topshots[killer][9] + 1 + end + -- most panzer kills + if mod == 17 then + topshots[killer][10] = topshots[killer][10] + 1 + end + -- most mortar kills + if mod == 57 then + topshots[killer][11] = topshots[killer][11] + 1 + end + -- most panzer deaths + if mod == 17 then + topshots[victim][12] = topshots[victim][12] + 1 + end + -- most mortar deaths + if mod == 57 then + topshots[victim][13] = topshots[victim][13] + 1 + end + -- most mg42 kills + if mod == 1 or mod == 2 or mod == 3 or mod == 49 then + topshots[killer][18] = topshots[killer][18] + 1 + end + -- most mg42 deaths + if mod == 1 or mod == 2 or mod == 3 or mod == 49 then + topshots[victim][19] = topshots[victim][19] + 1 + end + else + checkKSpreeEnd(victim) + if killer ~= 1022 then + death_sprees[victim] = death_sprees[victim] + 1 + end + end + killing_sprees[victim] = 0 + death_sprees[killer] = 0 + end + end -- gamestate +end + +function checkKSpreeEnd(id) + if killing_sprees[id] >= 3 then + if killing_sprees[id] > topshots[id][25] then + topshots[id][25] = killing_sprees[id] + end + end +end + +function checkDSpreeEnd(id) + if death_sprees[id] >= 3 then + if death_sprees[id] > topshots[id][26] then + topshots[id][26] = death_sprees[id] + end + end +end + +function et_RunFrame(levelTime) + if math.fmod(levelTime, 500) ~= 0 then return end + + local ltm = et.trap_Milliseconds() + if eomap_done then + if eomaptime < ltm then + eomap_done = false + topshots_f(-2) + end + end +end + +function et_ClientBegin(id) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + if team == 1 then + axis_time[id] = et.trap_Milliseconds() + elseif team == 2 then + allies_time[id] = et.trap_Milliseconds() + end +end + +function et_ClientSpawn(id, revived) + killing_sprees[id] = 0 + if revived ~= 1 then + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + if team == 1 and axis_time[id] == 0 then + axis_time[id] = et.trap_Milliseconds() + elseif team == 2 and allies_time[id] == 0 then + allies_time[id] = et.trap_Milliseconds() + elseif team == 3 then + axis_time[id] = 0 + allies_time[id] = 0 + end + end +end + +function et_ClientDisconnect(id) + killing_sprees[id] = 0 + death_sprees[id] = 0 + topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0 } + axis_time[id] = 0 + allies_time[id] = 0 + mkps[id] = { [1]=0, [2]=0, [3]=0 } + vsstats[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_kills[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_deaths[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + worst_enemy[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + easiest_prey[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + kills[id] = 0 + deaths[id] = 0 + local j = 0 + for j=0,sv_maxclients-1 do + vsstats[j][id] = 0 + worst_enemy[j][id] = 0 + easiest_prey[j][id] = 0 + vsstats_kills[j][id] = 0 + vsstats_deaths[j][id] = 0 + end +end + +--- Sends a nice table to a client. +-- @param id client slot +-- @param columns {name = "column header title", align = "right/left/ommit"}, ... +-- @param rows { { x0, x1, ...} { ... } ... } +-- @param separator print separators between rows? +function send_table(id, columns, rows, separator) + + local lens = {} + + --table.foreach(columns, function(index, column) + --lens[index] = string.len(et.Q_CleanStr(column.name)) + --end) + + for index, column in pairs(columns) do + lens[index] = string.len(et.Q_CleanStr(column.name)) + end + + --table.foreach(rows, function(_, row) + for _, row in pairs(rows) do + + --table.foreach(row, function(index, value) + for index, value in pairs(row) do + + local len = string.len(et.Q_CleanStr(value)) + + if lens[index] < len then + lens[index] = len + end + + --end) + end + + --end) + end + + local width = 1 + + --table.foreach(lens, function(_, len) + --width = width + len + 3 -- 3 = padding around the value and cell separator + --end) + for _, len in pairs(lens) do + width = width + len + 3 -- 3 = padding around the value and cell separator + end + + -- Header separator + et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") + + -- Column names + local row = "^7|" + + --table.foreach(columns, function(index, column) + --row = row .. " " .. column.name .. string.rep(' ', lens[index] - string.len(et.Q_CleanStr(column.name))) .. " |" + --end) + for index, column in pairs(columns) do + row = row .. " " .. column.name .. string.rep(' ', lens[index] - string.len(et.Q_CleanStr(column.name))) .. " |" + end + et.trap_SendServerCommand(id, "chat \"" .. row .. "\"") + + if #rows > 0 then + + -- Data separator + et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") + + -- Rows + --table.foreach(rows, function(_, r) + for _, r in pairs(rows) do + + local row = "^7|" + + --table.foreach(r, function(index, value) + for index, value in pairs(r) do + if columns[index].align == "right" then + row = row .. " " .. string.rep(' ', lens[index] - string.len(et.Q_CleanStr(value))) .. value .. " ^7|" + else + row = row .. " " .. value .. string.rep(' ', lens[index] - string.len(et.Q_CleanStr(value))) .. " ^7|" + end + --end) + end + + et.trap_SendServerCommand(id, "chat \"" .. row .. "\"") -- values + + if separator then + et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") -- separator + end + + --end) + end + + end + + -- Bottom line + if not separator then + et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") + end + +end diff --git a/objtrack.lua b/objtrack.lua new file mode 100644 index 0000000..b564e04 --- /dev/null +++ b/objtrack.lua @@ -0,0 +1,1170 @@ +-- objtrack.lua by x0rnn, tracks and announces who stole, returned or secured objectives +-- preconfigured maps only; support for additional maps needs to be added manually + +mapname = "" +goldcarriers = {} +goldcarriers_id = {} +doccarriers = {} +doccarriers_id = {} +objcarriers = {} +objcarriers_id = {} +second_obj = false +firstflag = false +secondflag = false + +function et_InitGame(levelTime, randomSeed, restart) + et.RegisterModname("objtrack.lua "..et.FindSelf()) + + mapname = string.lower(et.trap_Cvar_Get("mapname")) +end + +function et_Print(text) + if mapname == "radar" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + if firstflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the West Radar Parts!\"\n") + elseif secondflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the East Radar Parts!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole a Radar Part!\"\n") + end + elseif team == 1 then + if firstflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the West Radar Parts!\"\n") + elseif secondflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the East Radar Parts!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a Radar Part!\"\n") + end + end + end + if(string.find(text, "Allies have secured the East")) then + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers[objcarriers_id[x]] == true then + local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(objcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the East Radar Parts!\"\n") + objcarriers[objcarriers_id[x]] = nil + table.remove(objcarriers_id, x) + end + end + x = x + 1 + end + firstflag = true + end + if(string.find(text, "Allies have secured the West")) then + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers[objcarriers_id[x]] == true then + local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(objcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the West Radar Parts!\"\n") + objcarriers[objcarriers_id[x]] = nil + table.remove(objcarriers_id, x) + end + end + x = x + 1 + end + secondflag = true + end + end -- end radar + + if mapname == "goldrush" or mapname == "uje_goldrush" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + goldcarriers[id] = true + table.insert(goldcarriers_id, id) + if #goldcarriers_id == 1 then + if firstflag == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the first Gold Crate!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + end + elseif #goldcarriers_id == 2 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + end + elseif team == 1 then + if firstflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + else + if #goldcarriers_id == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a Gold Crate!\"\n") + end + end + end + end + if(string.find(text, "Allied team has secured the first Gold Crate")) then + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers[goldcarriers_id[x]] == true then + local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(goldcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") + goldcarriers[goldcarriers_id[x]] = nil + table.remove(goldcarriers_id, x) + end + end + x = x + 1 + end + firstflag = true + end + if(string.find(text, "Allied team has secured the second Gold Crate")) then + local name = et.gentity_get(goldcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the second Gold Crate!\"\n") + goldcarriers[goldcarriers_id[1]] = nil + table.remove(goldcarriers_id, 1) + end + end -- end goldrush + + if (string.find(mapname, "frostbite")) then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Supply Documents!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Deciphered Supply Documents!\"\n") + end + elseif team == 1 then + if second_obj == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Deciphered Supply Documents!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Supply Documents!\"\n") + end + end + end + if(string.find(text, "The Allies have transmitted the Supply")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Supply Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + second_obj = true + end + if(string.find(text, "The Allies have transmitted the Deciphered")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Deciphered Supply Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end frostbite + + if mapname == "missile_b3" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Gate Power Supply!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Rocket Control!\"\n") + end + elseif team == 1 then + if second_obj == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Rocket Control!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Gate Power Supply!\"\n") + end + end + end + if(string.find(text, "Allies have transported the Power")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Gate Power Supply!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + second_obj = true + end + if(string.find(text, "Allies have transported the Rocket")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Rocket Control!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end missile_b3 + + if mapname == "sp_delivery_te" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + goldcarriers[id] = true + table.insert(goldcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole a Gold Crate!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a Gold Crate!\"\n") + end + end + if(string.find(text, "The Allies have secured a gold crate")) then + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers[goldcarriers_id[x]] == true then + local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(goldcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured a Gold Crate!\"\n") + goldcarriers[goldcarriers_id[x]] = nil + table.remove(goldcarriers_id, x) + end + end + x = x + 1 + end + end + end -- end sp_delivery_te + + if mapname == "sw_goldrush_te" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + goldcarriers[id] = true + table.insert(goldcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Gold Bars!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Gold Bars!\"\n") + end + end + if(string.find(text, "Allied team is escaping with the Gold")) then + local name = et.gentity_get(goldcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Gold Bars!\"\n") + goldcarriers[goldcarriers_id[1]] = nil + table.remove(goldcarriers_id, 1) + end + end -- end sw_goldrush_te + + if mapname == "bremen_b3" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Keycard!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Keycard!\"\n") + end + end + if(string.find(text, "The Allies have captured the keycard")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Keycard!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end bremen_b3 + + if (string.find(mapname, "adlernest")) then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Documents!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Documents!\"\n") + end + end + if(string.find(text, "Allied team has transmitted the documents")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end adlernest + + if mapname == "et_beach" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the War Documents!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the War Documents!\"\n") + end + end + if(string.find(text, "Allied team transmit the War Documents")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the War Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end et_beach + + if mapname == "venice" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Relic!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Relic!\"\n") + end + end + if(string.find(text, "Allied team has secured the Relic")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Relic!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end venice + + if mapname == "library_b3" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Secret Documents!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Secret Documents!\"\n") + end + end + if(string.find(text, "The Allies have sent the secret docs")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Secret Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end library_b3 + + if mapname == "pirates" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + goldcarriers[id] = true + table.insert(goldcarriers_id, id) + if #goldcarriers_id == 1 then + if firstflag == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the first Gold Crate!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + end + elseif #goldcarriers_id == 2 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + end + elseif team == 1 then + if firstflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + else + if #goldcarriers_id == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a Gold Crate!\"\n") + end + end + end + end + if(string.find(text, "Allied team has secured the first Gold Crate")) then + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers[goldcarriers_id[x]] == true then + local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(goldcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") + goldcarriers[goldcarriers_id[x]] = nil + table.remove(goldcarriers_id, x) + end + end + x = x + 1 + end + firstflag = true + end + if(string.find(text, "Allied team has secured the second Gold Crate")) then + local name = et.gentity_get(goldcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the second Gold Crate!\"\n") + goldcarriers[goldcarriers_id[1]] = nil + table.remove(goldcarriers_id, 1) + end + end -- end pirates + + if mapname == "karsiah_te2" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + if firstflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the South Documents!\"\n") + elseif secondflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the North Documents!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole a stack of Documents!\"\n") + end + elseif team == 1 then + if firstflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the South Documents!\"\n") + elseif secondflag == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the North Documents!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a stack of Documents\"\n") + end + end + end + if(string.find(text, "Allies have transmitted the North Documents")) then + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers[objcarriers_id[x]] == true then + local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(objcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the North Documents!\"\n") + objcarriers[objcarriers_id[x]] = nil + table.remove(objcarriers_id, x) + end + end + x = x + 1 + end + firstflag = true + end + if(string.find(text, "Allies have transmitted the South Documents")) then + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers[objcarriers_id[x]] == true then + local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + if redflag == 0 then + local name = et.gentity_get(objcarriers_id[x], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the South Documents!\"\n") + objcarriers[objcarriers_id[x]] = nil + table.remove(objcarriers_id, x) + end + end + x = x + 1 + end + secondflag = true + end + end -- end karsiah_te2 + + if mapname == "et_ufo_final" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the UFO Documents!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the UFO Documents!\"\n") + end + end + if(string.find(text, "Allies Transmitted the UFO Documents")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the UFO Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end et_ufo_final + + if mapname == "sos_secret_weapon" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Secret Weapon!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Secret Weapon!\"\n") + end + end + if(string.find(text, "Allied team has secured the secret weapon")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Secret Weapon!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end sos_secret_weapon + + if mapname == "falkenstein_b3" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Prototype!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Prototype!\"\n") + end + end + if(string.find(text, "ALLIES ESCAPED WITH THE OBJECTIVE")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Prototype!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end falkenstein_b3 + + if (string.find(mapname, "decay")) then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Access Codes!\"\n") + else + if firstflag == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the first Gold Crate!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + end + end + elseif team == 1 then + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Access Codes!\"\n") + else + if firstflag == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the first Gold Crate!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + end + end + end + end + if(string.find(text, "The Allies have transmitted the Access codes")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Access Codes!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + second_obj = true + end + if(string.find(text, "The Allies have secured a gold crate!")) then + if firstflag == false then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + firstflag = true + elseif firstflag == true then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the second Gold Crate!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end + end --end decay_b7/decay_sw + + -- decay_b7 alternate script + --if mapname == "decay_b7" then + --if(string.find(text, "team_CTF_redflag")) then + --local i, j = string.find(text, "%d+") + --local id = tonumber(string.sub(text, i, j)) + --local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + --local name = et.gentity_get(id, "pers.netname") + --if team == 2 then + --objcarriers[id] = true + --table.insert(objcarriers_id, id) + --if second_obj == false then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Access Codes!\"\n") + --else + --if #objcarriers_id == 1 then + --if firstflag == false then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the first Gold Crate!\"\n") + --else + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + --end + --elseif #objcarriers_id == 2 then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the second Gold Crate!\"\n") + --end + --end + --elseif team == 1 then + --if second_obj == false then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Access Codes!\"\n") + --else + --if firstflag == true then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + --else + --if #objcarriers_id == 1 then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the second Gold Crate!\"\n") + --else + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a Gold Crate!\"\n") + --end + --end + --end + --end + --end + --if(string.find(text, "The Allies have transmitted the Access codes")) then + --local name = et.gentity_get(objcarriers_id[1], "pers.netname") + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Access Codes!\"\n") + --objcarriers[objcarriers_id[1]] = nil + --table.remove(objcarriers_id, 1) + --second_obj = true + --end + --if(string.find(text, "The Allies have secured a gold crate!")) then + --if firstflag == false then + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers[objcarriers_id[x]] == true then + --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + --if redflag == 0 then + --local name = et.gentity_get(objcarriers_id[x], "pers.netname") + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") + --objcarriers[objcarriers_id[x]] = nil + --table.remove(objcarriers_id, x) + --end + --end + --x = x + 1 + --end + --firstflag = true + --elseif firstflag == true then + --local name = et.gentity_get(objcarriers_id[1], "pers.netname") + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the second Gold Crate!\"\n") + --objcarriers[objcarriers_id[1]] = nil + --table.remove(objcarriers_id, 1) + --end + --end + --end -- end decay_b7 alternate script + + if mapname == "te_escape2" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the ^1Unholy Grail^7!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the ^1Unholy Grail^7!\"\n") + end + end + if(string.find(text, "The Allied team escaped with the Unholy Grail")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the ^1Unholy Grail^7!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end te_escape2 + + if mapname == "radar_phx_b_3" or (string.find(mapname, "radar_truck")) then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Axis Documents!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Axis Documents!\"\n") + end + end + if(string.find(text, "Allies have secured the Documents")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Axis Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end radar_phx_b_3 + + if mapname == "et_village" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + goldcarriers[id] = true + table.insert(goldcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Gold!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Gold!\"\n") + end + end + if(string.find(text, "Allied team has escaped with the gold!")) then + local name = et.gentity_get(goldcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Gold!\"\n") + goldcarriers[goldcarriers_id[1]] = nil + table.remove(goldcarriers_id, 1) + end + end -- end et_village + + if mapname == "1944_beach" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Axis Documents!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Axis Documents!\"\n") + end + end + if(string.find(text, "Allies have transmitted the documents")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Axis Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end 1944_beach + + if mapname == "et_brewdog" then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Quiz Answers!\"\n") + elseif team == 1 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Quiz Answers!\"\n") + end + end + if(string.find(text, "Allies have transmitted the Quiz Answers!")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Quiz Answers!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end et_brewdog + + if (string.find(mapname, "_ice")) then + if(string.find(text, "team_CTF_blueflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 1 then + doccarriers[id] = true + table.insert(doccarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Secret War Documents!\"\n") + elseif team == 2 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Secret War Documents!\"\n") + end + end + if(string.find(text, "The Axis team has transmited the Secret")) then + local name = et.gentity_get(doccarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the Secret War Documents!\"\n") + doccarriers[doccarriers_id[1]] = nil + table.remove(doccarriers_id, 1) + end + end -- end et_ice +end + +function et_Obituary(victim, killer, mod) + if mapname == "radar" then + objcarriers[victim] = nil + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers_id[x] == victim then + table.remove(objcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "goldrush" or mapname == "uje_goldrush" then + goldcarriers[victim] = nil + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers_id[x] == victim then + table.remove(goldcarriers_id, x) + end + x = x + 1 + end + end + if (string.find(mapname, "frostbite")) then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "missile_b3" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + if mapname == "sp_delivery_te" then + goldcarriers[victim] = nil + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers_id[x] == victim then + table.remove(goldcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "sw_goldrush_te" then + goldcarriers[victim] = nil + if goldcarriers_id[1] == victim then + table.remove(goldcarriers_id, 1) + end + end + if mapname == "bremen_b3" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + if (string.find(mapname, "adlernest")) then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "et_beach" then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "venice" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + if mapname == "library_b3" then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "pirates" then + goldcarriers[victim] = nil + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers_id[x] == victim then + table.remove(goldcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "karsiah_te2" then + objcarriers[victim] = nil + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers_id[x] == victim then + table.remove(objcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "et_ufo_final" then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "sos_secret_weapon" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + if mapname == "falkenstein_b3" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + if (string.find(mapname, "decay")) then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + + --decay_b7 alternate script + --if mapname == "decay_b7" then + --objcarriers[victim] = nil + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers_id[x] == victim then + --table.remove(objcarriers_id, x) + --end + --x = x + 1 + --end + --end + + if mapname == "te_escape2" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + if mapname == "radar_phx_b_3" or (string.find(mapname, "radar_truck")) then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "et_village" then + goldcarriers[victim] = nil + if goldcarriers_id[1] == victim then + table.remove(goldcarriers_id, 1) + end + end + if (string.find(mapname, "_ice")) then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "1944_beach" then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end + if mapname == "et_brewdog" then + doccarriers[victim] = nil + if doccarriers_id[1] == victim then + table.remove(doccarriers_id, 1) + end + end +end + +function et_ClientDisconnect(i) + if mapname == "radar" then + objcarriers[i] = nil + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers_id[x] == i then + table.remove(objcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "goldrush" or mapname == "uje_goldrush" then + goldcarriers[i] = nil + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers_id[x] == i then + table.remove(goldcarriers_id, x) + end + x = x + 1 + end + end + if (string.find(mapname, "frostbite")) then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "missile_b3" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + if mapname == "sp_delivery_te" then + goldcarriers[i] = nil + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers_id[x] == i then + table.remove(goldcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "sw_goldrush_te" then + goldcarriers[i] = nil + if goldcarriers_id[1] == i then + table.remove(goldcarriers_id, 1) + end + end + if mapname == "bremen_b3" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + if (string.find(mapname, "adlernest")) then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "et_beach" then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "venice" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + if mapname == "library_b3" then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "pirates" then + goldcarriers[i] = nil + local x = 1 + for index in pairs(goldcarriers_id) do + if goldcarriers_id[x] == i then + table.remove(goldcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "karsiah_te2" then + objcarriers[i] = nil + local x = 1 + for index in pairs(objcarriers_id) do + if objcarriers_id[x] == i then + table.remove(objcarriers_id, x) + end + x = x + 1 + end + end + if mapname == "et_ufo_final" then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "sos_secret_weapon" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + if mapname == "falkenstein_b3" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + if (string.find(mapname, "decay")) then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + + -- decay_b7 alternate script + --if mapname == "decay_b7" then + --objcarriers[i] = nil + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers_id[x] == i then + --table.remove(objcarriers_id, x) + --end + --x = x + 1 + --end + --end + + if mapname == "te_escape2" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + if mapname == "radar_phx_b_3" or (string.find(mapname, "radar_truck")) then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "et_village" then + goldcarriers[i] = nil + if goldcarriers_id[1] == i then + table.remove(goldcarriers_id, 1) + end + end + if (string.find(mapname, "_ice")) then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "1944_beach" then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end + if mapname == "et_brewdog" then + doccarriers[i] = nil + if doccarriers_id[1] == i then + table.remove(doccarriers_id, 1) + end + end +end + +function et_ConsoleCommand() + if et.trap_Argv(0) == "pb_sv_kick" then + if et.trap_Argc() >= 2 then + local cno = tonumber(et.trap_Argv(1)) + if cno then + cno = cno - 1 + et_ClientDisconnect(cno) + end + end + return 1 + end + return(0) +end \ No newline at end of file From b997690f278af1b147aca6d75d923a016a978f24 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 13 Jul 2022 21:26:45 +0200 Subject: [PATCH 02/71] Add files via upload --- objtrack.lua | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index b564e04..72458cb 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -207,7 +207,7 @@ function et_Print(text) end end -- end missile_b3 - if mapname == "sp_delivery_te" then + if mapname == "sp_delivery_te" or mapname == "etl_sp_delivery" then if(string.find(text, "team_CTF_redflag")) then local i, j = string.find(text, "%d+") local id = tonumber(string.sub(text, i, j)) @@ -236,7 +236,7 @@ function et_Print(text) x = x + 1 end end - end -- end sp_delivery_te + end -- end sp_delivery_te/etl_sp_delivery if mapname == "sw_goldrush_te" then if(string.find(text, "team_CTF_redflag")) then @@ -840,7 +840,7 @@ function et_Obituary(victim, killer, mod) table.remove(objcarriers_id, 1) end end - if mapname == "sp_delivery_te" then + if mapname == "sp_delivery_te" or mapname == "etl_sp_delivery" then goldcarriers[victim] = nil local x = 1 for index in pairs(goldcarriers_id) do @@ -1014,7 +1014,7 @@ function et_ClientDisconnect(i) table.remove(objcarriers_id, 1) end end - if mapname == "sp_delivery_te" then + if mapname == "sp_delivery_te" or mapname == "etl_sp_delivery" then goldcarriers[i] = nil local x = 1 for index in pairs(goldcarriers_id) do @@ -1154,17 +1154,3 @@ function et_ClientDisconnect(i) end end end - -function et_ConsoleCommand() - if et.trap_Argv(0) == "pb_sv_kick" then - if et.trap_Argc() >= 2 then - local cno = tonumber(et.trap_Argv(1)) - if cno then - cno = cno - 1 - et_ClientDisconnect(cno) - end - end - return 1 - end - return(0) -end \ No newline at end of file From 3919ca67d19bbe50623f826222e81ec6e00ba6c1 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 13 Jul 2022 21:30:21 +0200 Subject: [PATCH 03/71] Add files via upload --- objtrack.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index 72458cb..961ca4e 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -207,7 +207,7 @@ function et_Print(text) end end -- end missile_b3 - if mapname == "sp_delivery_te" or mapname == "etl_sp_delivery" then + if (string.find(mapname, "sp_delivery")) then if(string.find(text, "team_CTF_redflag")) then local i, j = string.find(text, "%d+") local id = tonumber(string.sub(text, i, j)) @@ -840,7 +840,7 @@ function et_Obituary(victim, killer, mod) table.remove(objcarriers_id, 1) end end - if mapname == "sp_delivery_te" or mapname == "etl_sp_delivery" then + if (string.find(mapname, "sp_delivery")) then goldcarriers[victim] = nil local x = 1 for index in pairs(goldcarriers_id) do @@ -1014,7 +1014,7 @@ function et_ClientDisconnect(i) table.remove(objcarriers_id, 1) end end - if mapname == "sp_delivery_te" or mapname == "etl_sp_delivery" then + if (string.find(mapname, "sp_delivery")) then goldcarriers[i] = nil local x = 1 for index in pairs(goldcarriers_id) do From 8e09f25bfc1a4fc196fc466100338a337b133805 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 2 Nov 2022 10:25:36 +0100 Subject: [PATCH 04/71] Add files via upload --- endstats.lua | 47 +++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/endstats.lua b/endstats.lua index f63e75e..bb94d77 100644 --- a/endstats.lua +++ b/endstats.lua @@ -729,15 +729,15 @@ function et_Obituary(victim, killer, mod) local k_teamid = et.gentity_get(killer, "sess.sessionTeam") if (victim == killer) then -- suicide - if mod == 37 or mod == 64 then + if mod == 33 or mod == 59 then checkKSpreeEnd(victim) - if mod == 37 then + if mod == 33 then death_sprees[victim] = death_sprees[victim] + 1 end end killing_sprees[victim] = 0 - if mod == 37 then + if mod == 33 then deaths[victim] = deaths[victim] + 1 end @@ -768,66 +768,57 @@ function et_Obituary(victim, killer, mod) checkDSpreeEnd(killer) -- most lightweapons kills - if mod==7 or mod==8 or mod==9 or mod==10 or mod==11 or mod==14 or mod==50 or mod==58 or mod==59 or mod==60 or mod==61 then + if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 then -- most pistol kills - if mod==7 or mod==8 or mod==14 or mod==50 or mod==58 or mod==59 or mod==60 or mod==61 then + if mod==6 or mod==7 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 then topshots[killer][2] = topshots[killer][2] + 1 end topshots[killer][1] = topshots[killer][1] + 1 end -- most rifle kills - if mod == 12 or mod == 55 or mod == 41 or mod == 42 then + if mod == 11 or mod == 50 or mod == 37 or mod == 38 then topshots[killer][3] = topshots[killer][3] + 1 end -- most riflegrenade kills + farthest riflegrenade kill - if mod == 43 or mod == 44 then + if mod == 39 or mod == 40 then topshots[killer][4] = topshots[killer][4] + 1 if killdist > topshots[killer][16] then topshots[killer][16] = killdist end end -- most sniper kills - if mod == 51 or mod == 56 then + if mod == 46 or mod == 51 then topshots[killer][5] = topshots[killer][5] + 1 end -- most knife kills - if mod == 6 then + if mod == 5 then topshots[killer][6] = topshots[killer][6] + 1 end -- most air support kills - if mod == 27 or mod == 30 then + if mod == 23 or mod == 26 then topshots[killer][7] = topshots[killer][7] + 1 end -- most mine kills - if mod == 45 then + if mod == 41 then topshots[killer][8] = topshots[killer][8] + 1 end -- most grenade kills - if mod == 18 then + if mod == 16 then topshots[killer][9] = topshots[killer][9] + 1 end - -- most panzer kills - if mod == 17 then + -- most panzer kills/deaths + if mod == 15 then topshots[killer][10] = topshots[killer][10] + 1 - end - -- most mortar kills - if mod == 57 then - topshots[killer][11] = topshots[killer][11] + 1 - end - -- most panzer deaths - if mod == 17 then topshots[victim][12] = topshots[victim][12] + 1 end - -- most mortar deaths - if mod == 57 then + -- most mortar kills/deaths + if mod == 52 then + topshots[killer][11] = topshots[killer][11] + 1 topshots[victim][13] = topshots[victim][13] + 1 end - -- most mg42 kills - if mod == 1 or mod == 2 or mod == 3 or mod == 49 then + -- most mg42 kills/deaths + if mod == 1 or mod == 2 or mod == 3 or mod == 44 then topshots[killer][18] = topshots[killer][18] + 1 - end - -- most mg42 deaths - if mod == 1 or mod == 2 or mod == 3 or mod == 49 then topshots[victim][19] = topshots[victim][19] + 1 end else From 4dc2662fb3bb02dd89e8826ea06eca296049aa79 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 4 Nov 2022 07:11:06 +0100 Subject: [PATCH 05/71] Add files via upload --- endstats.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/endstats.lua b/endstats.lua index bb94d77..85ee43f 100644 --- a/endstats.lua +++ b/endstats.lua @@ -955,6 +955,7 @@ function send_table(id, columns, rows, separator) -- Header separator et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") + et.G_LogPrint("Endstats: " .. string.rep('-', width) .. "\"\n") -- Column names local row = "^7|" @@ -966,11 +967,13 @@ function send_table(id, columns, rows, separator) row = row .. " " .. column.name .. string.rep(' ', lens[index] - string.len(et.Q_CleanStr(column.name))) .. " |" end et.trap_SendServerCommand(id, "chat \"" .. row .. "\"") + et.G_LogPrint("Endstats: " .. row .. "\"\n") if #rows > 0 then -- Data separator et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") + et.G_LogPrint("Endstats: " .. string.rep('-', width) .. "\"\n") -- Rows --table.foreach(rows, function(_, r) @@ -989,9 +992,11 @@ function send_table(id, columns, rows, separator) end et.trap_SendServerCommand(id, "chat \"" .. row .. "\"") -- values + et.G_LogPrint("Endstats: " .. row .. "\"\n") if separator then et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") -- separator + et.G_LogPrint("Endstats: " .. string.rep('-', width) .. "\"\n") end --end) @@ -1002,6 +1007,7 @@ function send_table(id, columns, rows, separator) -- Bottom line if not separator then et.trap_SendServerCommand(id, "chat \"^7" .. string.rep('-', width) .. "\"") + et.G_LogPrint("Endstats: " .. string.rep('-', width) .. "\"\n") end end From f0f163d0616f648c878396a63b7f5113eb16b383 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 4 Nov 2022 10:17:48 +0100 Subject: [PATCH 06/71] Add files via upload --- dyna.lua | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 336 insertions(+) create mode 100644 dyna.lua diff --git a/dyna.lua b/dyna.lua new file mode 100644 index 0000000..5533226 --- /dev/null +++ b/dyna.lua @@ -0,0 +1,336 @@ +-- x0rnn: added dynamite "sudden death" mode + +--------------------------------- +------- Dynamite counter -------- +------- By Necromancer -------- +------- 5/04/2009 -------- +------- www.usef-et.org -------- +--------------------------------- + +SHOW = 0 +-- 0 means disable timer +-- 1 means only the team that planted the dyno +-- 2 means everyone + +-- This script can be freely used and modified as long as the original author\s are mentioned (and their homepage: www.usef-et.org) + +mapname = "" +gametype = 0 +mapstarted = false +paused = false +mapstart_time = 0 +paused_time = 0 +unpaused_time = 0 +stuck_time = 0 +intervals = {[1]=0, [2]=0} +sudden_death = false +first_obj = false +sw_flag = false + +-- Constans +COLOR = {} +COLOR.PLACE = '^8' +COLOR.TEXT = '^w' +COLOR.TIME = '^8' -- this constat is changing in the print_message() function + +CHAT = "chat" +POPUP = "legacy" + +timer = {} + +OLD = os.time() + +function et_InitGame(levelTime, randomSeed, restart) + et.RegisterModname("dyna.lua" .. et.FindSelf()) + mapname = string.lower(et.trap_Cvar_Get("mapname")) + gametype = tonumber(et.trap_Cvar_Get("g_gametype")) + if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then + sw_flag = true + end +end + +function et_RunFrame( levelTime ) + current = os.time() + for dyno, temp in pairs(timer) do + if timer[dyno]["time"] - current >= 0 then + for key,temp in pairs(timer[dyno]) do + if type(key) == "number" then + if timer[dyno]["time"] - current == key then + send_print(timer,dyno,key) + timer[dyno][key] = nil + --et.G_LogPrint("dynamite key deleted: " .. dyno .." key: " .. key .. "\n") + end + end + end + + else + --et.G_LogPrint("dynamite out: " .. dyno .. "\n") + place_destroyed(timer[dyno]["place"]) + --timer[dyno] = nil + end + end + + if math.fmod(levelTime, 1000) == 0 then + local gamestate = tonumber(et.trap_Cvar_Get("gamestate")) + if gamestate == 0 then + if mapstarted == false then + mapstart_time = et.trap_Milliseconds() + mapstarted = true + else + if paused == true then + local cs = et.trap_GetConfigstring(11) + if intervals[1] == 0 then + intervals[1] = cs + elseif intervals[1] ~= 0 then + if intervals[2] == 0 then + intervals[2] = cs + elseif intervals[2] ~= 0 then + intervals[1] = intervals[2] + intervals[2] = cs + if intervals[1] == intervals[2] then + paused = false + unpaused_time = et.trap_Milliseconds() - 1000 + stuck_time = unpaused_time - paused_time + stuck_time + intervals[1] = 0 + intervals[2] = 0 + end + end + end + end + end + end + end +end + +function et_ConsoleCommand() + local arg = et.trap_Argv(1) + if arg == "pause" then + paused = true + paused_time = et.trap_Milliseconds() + end + if arg == "unpause" then + paused = false + unpaused_time = et.trap_Milliseconds() + stuck_time = unpaused_time - paused_time + stuck_time + 10000 + end + return(0) +end + +function place_destroyed(place) -- removes any dynamties that were planted on this objective + for dynamite, temp in pairs(timer) do + if timer[dynamite]["place"] == place then + timer[dynamite] = nil + end + end +end + +function send_print(timer,dyno,ttime) + if SHOW == 0 then return end + if SHOW == 1 then + for player=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1, 1 do + if et.gentity_get(player,"sess.sessionTeam") == timer[dyno]["team"] then + print_message(player, ttime, timer[dyno]["place"]) + end + end + else + print_message(-1, ttime, timer[dyno]["place"]) + end +end + +function print_message(slot, ttime, place) + if ttime > 3 then + COLOR.TIME = '^8' + else + COLOR.TIME = '^1' + end + + if ttime == -1 then + et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite planted at " .. COLOR.PLACE .. place)) + elseif ttime == -2 then + et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite defused at " .. COLOR.PLACE .. place)) + elseif ttime > 0 then + et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite at " .. COLOR.PLACE .. place .. COLOR.TEXT .. " exploding in " .. COLOR.TIME ..ttime .. COLOR.TEXT .. " seconds!")) + end +end + +function et_Print( text ) + --legacy popup: axis planted "the Old City MG Nest" + start,stop = string.find(text, POPUP .. " popup:",1,true) -- check that its not any player print, trying to manipulate the dyno counter + if start and stop then + start,stop,team,plant = string.find(text, POPUP .. " popup: (%S+) planted \"([^%\"]*)\"") + if start and stop then -- dynamite planted + if team == "axis" then team = 1 + else team = 2 end + index = #timer+1 + timer[index] = {} + timer[index]["team"] = team + timer[index]["place"] = plant + timer[index]["time"] = os.time() +30 + + timer[index][20] = true + timer[index][10] = true + timer[index][5] = true + timer[index][3] = true + timer[index][2] = true + timer[index][1] = true + timer[index][0] = true + + print_message(-1, -1, timer[index]["place"]) + --et.G_LogPrint("dynamite set: " .. index .. "\n") + + if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then + if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then + local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft + timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) + if timeleft < 30000 then + sudden_death = true + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") + et.trap_SendServerCommand(-1, "chat \"^1Sudden Death mode is activated! Defuse the dynamite or lose!\"") + et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") + 0.5) + et.G_globalSound("sound/misc/sudden_death.wav") + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j,"sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + et.gentity_set(j, "ps.ammoclip", 15, 0) + et.trap_SendServerCommand(j, "chat \"^1Sudden Death mode is activated! Can't plant additional dynamites!\"") + end + end + end + end + end + end + end + if mapname == "sw_oasis_b3" or mapname == "oasis" or mapname == "tc_base" or mapname == "erdenberg_t2" then + if first_obj == true then + if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" then + local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft + timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) + if timeleft < 30000 then + sudden_death = true + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") + et.trap_SendServerCommand(-1, "chat \"^1Sudden Death mode is activated! Defuse the dynamite or lose!\"") + et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") + 0.5) + et.G_globalSound("sound/misc/sudden_death.wav") + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j,"sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + et.gentity_set(j, "ps.ammoclip", 15, 0) + et.trap_SendServerCommand(j, "chat \"^1Sudden Death mode is activated! Can't plant additional dynamites!\"") + end + end + end + end + end + end + end + end + end + end + + start,stop,team,plant = string.find(text, POPUP .. " popup: (%S+) defused \"([^%\"]*)\"") + if start and stop then -- dynamite defused + if team == "axis" then team = 1 + else team = 2 end + + if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then + if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then + if sudden_death == true then + local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft + timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) + if timeleft - 30000 > 3750 then + local t = ((timeleft - 30000) / 1000) / 60 + et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") - t) + else + et.trap_Cvar_Set("timelimit", 0.0001) + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") + end + end + end + end + if mapname == "sw_oasis_b3" or mapname == "oasis" or mapname == "tc_base" or mapname == "erdenberg_t2" then + if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" then + if sudden_death == true then + local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft + timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) + if timeleft - 30000 > 3750 then + local t = ((timeleft - 30000) / 1000) / 60 + et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") - t) + else + et.trap_Cvar_Set("timelimit", 0.0001) + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") + end + end + end + end + end + + for index,temp in pairs(timer) do + if timer[index]["place"] == plant then + print_message(-1, -2, timer[index]["place"]) + timer[index] = nil + --et.G_LogPrint("dynamite removed: " .. index .. "\n") + return + end + end + end + end + --legacy announce: "Allied team has destroyed the South Anti-Tank Gun!" + start2,stop2 = string.find(text, POPUP .. " announce:",1,true) -- check that its not any player print, trying to manipulate the dyno counter + if start2 and stop2 then + start2,stop2,plant = string.find(text, POPUP .. " announce: \"([^%\"]*)\"") + if start2 and stop2 then -- dynamite planted + if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if mapname == "oasis" or mapname == "sw_oasis_b3" then + if plant == "Allied team has destroyed the South Anti-Tank Gun!" or plant == "Allied team has destroyed the North Anti-Tank Gun!" then + if first_obj == false then + first_obj = true + else + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") + end + end + elseif mapname == "erdenberg_t2" then + if plant == "The West Flak88 has been destroyed!" or plant == "The East Flak88 has been destroyed!" then + if first_obj == false then + first_obj = true + else + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") + end + end + elseif mapname == "tc_base" then + if plant == "Allied team has disabled the South Radar!" or plant == "Allied team has disabled the North Radar!" then + if first_obj == false then + first_obj = true + else + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") + end + end + end + end + end + end +end + +function et_ClientSpawn(id, revived) + if revived ~= 1 then + if sudden_death == true then + local team = et.gentity_get(id, "sess.sessionTeam") + if team == 2 then + if et.gentity_get(id,"sess.PlayerType") == 2 then + et.gentity_set(id,"ps.ammoclip", 15, 0) + end + end + end + end +end From 9f6128a88af69944566f356f038da9b216e4d540 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 18 Nov 2022 10:09:16 +0100 Subject: [PATCH 07/71] Update objtrack.lua --- objtrack.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index 961ca4e..76eb994 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -170,7 +170,7 @@ function et_Print(text) end end -- end frostbite - if mapname == "missile_b3" then + if (string.find(mapname, "missile")) then if(string.find(text, "team_CTF_redflag")) then local i, j = string.find(text, "%d+") local id = tonumber(string.sub(text, i, j)) @@ -205,7 +205,7 @@ function et_Print(text) objcarriers[objcarriers_id[1]] = nil table.remove(objcarriers_id, 1) end - end -- end missile_b3 + end -- end missile_b3/b4 if (string.find(mapname, "sp_delivery")) then if(string.find(text, "team_CTF_redflag")) then @@ -834,7 +834,7 @@ function et_Obituary(victim, killer, mod) table.remove(doccarriers_id, 1) end end - if mapname == "missile_b3" then + if (string.find(mapname, "missile")) then objcarriers[victim] = nil if objcarriers_id[1] == victim then table.remove(objcarriers_id, 1) @@ -1008,7 +1008,7 @@ function et_ClientDisconnect(i) table.remove(doccarriers_id, 1) end end - if mapname == "missile_b3" then + if (string.find(mapname, "missile")) then objcarriers[i] = nil if objcarriers_id[1] == i then table.remove(objcarriers_id, 1) From bec69a80e967081a735461d1e5135eca2dd404dc Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 20 Nov 2022 11:17:36 +0100 Subject: [PATCH 08/71] Update and rename dyna.lua to suddendeath.lua --- dyna.lua => suddendeath.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename dyna.lua => suddendeath.lua (99%) diff --git a/dyna.lua b/suddendeath.lua similarity index 99% rename from dyna.lua rename to suddendeath.lua index 5533226..b41ac49 100644 --- a/dyna.lua +++ b/suddendeath.lua @@ -41,7 +41,7 @@ timer = {} OLD = os.time() function et_InitGame(levelTime, randomSeed, restart) - et.RegisterModname("dyna.lua" .. et.FindSelf()) + et.RegisterModname("suddendeath.lua" .. et.FindSelf()) mapname = string.lower(et.trap_Cvar_Get("mapname")) gametype = tonumber(et.trap_Cvar_Get("g_gametype")) if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then From ce81e219521ddcdbe2173485d3c643e59b3611f4 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 23 Nov 2022 19:02:10 +0100 Subject: [PATCH 09/71] Update suddendeath.lua --- suddendeath.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/suddendeath.lua b/suddendeath.lua index b41ac49..e5659ba 100644 --- a/suddendeath.lua +++ b/suddendeath.lua @@ -1,4 +1,5 @@ -- x0rnn: added dynamite "sudden death" mode +-- modified Quake 3 sudden death sound: https://github.com/x0rnn/etpro/blob/master/lua/sudden_death.wav --------------------------------- ------- Dynamite counter -------- From a95fc89e9befa6f981f1bbe2c29bbdf1ca4415f0 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 29 Nov 2022 10:10:23 +0100 Subject: [PATCH 10/71] Add files via upload --- objtrack.lua | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/objtrack.lua b/objtrack.lua index 76eb994..5433ba2 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -9,6 +9,8 @@ doccarriers_id = {} objcarriers = {} objcarriers_id = {} second_obj = false +third_obj = false +fourth_obj = false firstflag = false secondflag = false @@ -805,6 +807,118 @@ function et_Print(text) table.remove(doccarriers_id, 1) end end -- end et_ice + + if mapname == "warbell" then + if(string.find(text, "team_CTF_blueflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 1 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the ^1Book of Death^7!\"\n") + elseif team == 2 then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the ^1Book of Death^7!\"\n") + end + end + if(string.find(text, "Axis have delivered the Book of Death")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the ^1Book of Death^7!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end warbell + + --if mapname == "etl_warbell" then + --if(string.find(text, "team_CTF_blueflag")) then + --local i, j = string.find(text, "%d+") + --local id = tonumber(string.sub(text, i, j)) + --local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + --local name = et.gentity_get(id, "pers.netname") + --if team == 1 then + --objcarriers[id] = true + --table.insert(objcarriers_id, id) + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the ^1Book of Death^7!\"\n") + --elseif team == 2 then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the ^1Book of Death^7!\"\n") + --end + --end + --if(string.find(text, "Axis have delivered the Book of Death")) then + --local name = et.gentity_get(objcarriers_id[1], "pers.netname") + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the ^1Book of Death^7!\"\n") + --objcarriers[objcarriers_id[1]] = nil + --table.remove(objcarriers_id, 1) + --end + --end -- end etl_warbell + + -- etl_warbell alternate script + if mapname == "etl_warbell" then + if(string.find(text, "team_CTF_blueflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 1 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the ^1Book of Death^7!\"\n") + else + if third_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the First Sacrifice (Shoe)!\"\n") + else + if fourth_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Second Sacrifice (Chest)!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Third Sacrifice (Sword)!\"\n") + end + end + end + elseif team == 2 then + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the ^1Book of Death^7!\"\n") + else + if third_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the First Sacrifice (Shoe)!\"\n") + else + if fourth_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Second Sacrifice (Chest)!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Third Sacrifice (Sword)!\"\n") + end + end + end + end + end + if(string.find(text, "Axis have delivered the Book of Death")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the ^1Book of Death^7!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + second_obj = true + end + if(string.find(text, "First Sacrifice performed!")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7performed the First Sacrifice!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + third_obj = true + end + if(string.find(text, "Second Sacrifice performed!")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7performed the Second Sacrifice!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + fourth_obj = true + end + if(string.find(text, "Third Sacrifice performed!")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7performed the Third Sacrifice!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end etl_warbell alternate script end function et_Obituary(victim, killer, mod) @@ -979,6 +1093,12 @@ function et_Obituary(victim, killer, mod) table.remove(doccarriers_id, 1) end end + if (string.find(mapname, "warbell")) then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end end function et_ClientDisconnect(i) @@ -1153,4 +1273,10 @@ function et_ClientDisconnect(i) table.remove(doccarriers_id, 1) end end + if (string.find(mapname, "warbell")) then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end end From ad660e7ae24ae3c5593e789822b904374ab6d30c Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 7 Dec 2022 16:48:39 +0100 Subject: [PATCH 11/71] Update objtrack.lua --- objtrack.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index 5433ba2..33d7e56 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -81,7 +81,7 @@ function et_Print(text) end end -- end radar - if mapname == "goldrush" or mapname == "uje_goldrush" then + if mapname == "goldrush" or mapname == "uje_goldrush" or mapname == "goldrush-ga" or mapname == "goldrush-gals" then if(string.find(text, "team_CTF_redflag")) then local i, j = string.find(text, "%d+") local id = tonumber(string.sub(text, i, j)) @@ -932,7 +932,7 @@ function et_Obituary(victim, killer, mod) x = x + 1 end end - if mapname == "goldrush" or mapname == "uje_goldrush" then + if mapname == "goldrush" or mapname == "uje_goldrush" or mapname == "goldrush-ga" or mapname == "goldrush-gals" then goldcarriers[victim] = nil local x = 1 for index in pairs(goldcarriers_id) do @@ -1112,7 +1112,7 @@ function et_ClientDisconnect(i) x = x + 1 end end - if mapname == "goldrush" or mapname == "uje_goldrush" then + if mapname == "goldrush" or mapname == "uje_goldrush" or mapname == "goldrush-ga" or mapname == "goldrush-gals" then goldcarriers[i] = nil local x = 1 for index in pairs(goldcarriers_id) do From 04748dd3a917dff8156f1e8ab19d1e52aa3e771d Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 12 Dec 2022 12:33:47 +0100 Subject: [PATCH 12/71] Add files via upload --- ETWsk.lua | 1106 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1106 insertions(+) create mode 100644 ETWsk.lua diff --git a/ETWsk.lua b/ETWsk.lua new file mode 100644 index 0000000..7ae61e6 --- /dev/null +++ b/ETWsk.lua @@ -0,0 +1,1106 @@ +-------------------------------------------------------------------------------- +-- ETWsk - ETW-FZ Enemy Territory Anti-Spawnkill Mod for etpro +-------------------------------------------------------------------------------- +-- This script can be freely used and modified as long as [ETW-FZ] and the +-- original author are mentioned. +-------------------------------------------------------------------------------- +module_name = "ETWsk" +module_version = "0.9.1" +Author = "[ETW-FZ] Mad@Mat" +-- 2010-11-24 benny [ quakenet @ #hirntot.org ] --> putspec for etpub +-- 2009-03-12 benny [ quakenet @ #hirntot.org ] --> temp ban persistent offenders +-- 2008-11-16 benny [ quakenet @ #hirntot.org ] --> no warmup punish +-- 2008-10-06 benny [ quakenet @ #hirntot.org ] --> sin bin added. + + +-------------------------------------------------------------------------------- +-- DESCRIPTION +-------------------------------------------------------------------------------- +-- ETWsk aims to reduce spawnkilling (SK) on public funservers. An SK here is if +-- someone kills an enemy near a fix spawn point. A fix spawn point means that +-- it can not be cleared by the enemy. E.g. on radar map, the allied Side Gate +-- spawn is not fix as the axis can destroy the command post. However, the Main +-- Bunker spawn is fix after the Allies have destroyed the Main Gate. ETWsk does +-- not prevent but it detects and counts SKs for every player. If a player has +-- caused a certain number of SKs, he gets punished (putspec, kick, ban, ...). +-- As the detection of fix spawns is difficult especially on custom maps, little +-- configuration work has to be done. +-- +-- Features: +-- - circular protection areas around spawn points +-- - two protection radius can be defined: heavy weapons and normal weapons +-- - the spawn protection expires when a player hurts an enemy +-- (can be disabled) +-- - fully configurable for individual maps: fixing radius, positions; +-- adding actions that change protected areas during the game; adding new +-- protection areas. +-- - client console commands for stats and help for configuration +-- - no RunFrame() -> low server load +-- - sin bin [benny] --> don't let clients join a team for XX milliseconds +-- if they have been set spec +-- - temp ban for persistent spawn killers [benny] +-------------------------------------------------------------------------------- +-- CONFIG +-------------------------------------------------------------------------------- +ETWsk_putspec = 1 -- number of sk's needed for setting a client + -- to spectators +ETWsk_kick = 99 -- number of sk's needed for kicking a client +ETWsk_kicklen = 20 -- duration of kick +-- benny ----------------------------------------------------------------------- +ETWsk_persistentoffender = 1 -- enable punishment 4 persistent spawn killers +ETWsk_POThreshold = 2 -- if players has been kicked before, he will + -- be temp banned with his XX spawn kill +ETWsk_banval = 30 -- (ETWsk_banval * 4 ^ kicksb4) = ban + -- If ETWsk_banval = 30, he'll be kicked 4 + -- 120 minutes, next is 480, 1920, 7680, ... +ETWsk_pofile = "ETWsk_PO.txt" -- save to /etpro/ETWsk_PO.txt +-------------------------------------------------------------------------------- +ETWsk_defaultradius1 = 0 -- protection radius for ordinary weapons +ETWsk_defaultradius2 = 0 -- protection radius for heavy weapons. def 800 +ETWsk_savemode = 1 -- if enabled, protection is only active on + -- maps that are configured +ETWsk_expires = 0 -- if enabled, spawn protection expires when + -- the victim hurts an enemy +-- benny ----------------------------------------------------------------------- +sinbin = true -- [true|false] +sinbin_duration = 15000 -- in milliseconds: 30000 = 30 seconds +sinbin_pos = "chat" -- prints to client on sin bin, "b 8 " = chat area +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- heavyweapons = {17,19,27,49,57,30} -- heavy weapon indexes + -- (http://wolfwiki.anime.net/index.php/Etdamage) + +-- benny 'ref remove' doesn't work w/ bots in etpub... +function putspec(id) + return(string.format(putspec_str, id)) +end +putspec_str = "ref remove %d\n" + +heavyweapons = {1, 2, 3, 15, 17, 23, 26, 44, 52} -- heavy weapon indexes + +maxcheckpointdist = 800 -- used to detect capturable flag poles +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- CONSTANTS +NO_PROTECT = 0 +PROTECT_AXIS = 1 +PROTECT_ALLIES = 2 +-------------------------------------------------------------------------------- + +-- benny: sin bin hash + persistent offender hash +sinbinhash = {} +pohash = {} +et.CS_PLAYERS = 689 + +-------------------------------------------------------------------------------- +function getConfig(map) +-------------------------------------------------------------------------------- +-- configures protection of spawn areas in specific maps +-------------------------------------------------------------------------------- +-- elseif map == "" then +-- +-- +-------------------------------------------------------------------------------- +-- spawn definitions: +-- c.spawn[] = {} +-- spawn-num: spawn index (see /etwsk_spawns command) +-- spawn-fields: - comma-separated list of "key = value" +-- - for existing spawns all fields are optional (they overwrite +-- default values). +-- - fields: +-- name = : name of spawn point +-- state = NO_PROTECT|PROTECT_ALLIES|PROTECT_AXIS +-- pos = {x,y,z} : map coordinates of spawn point +-- radius1 = : protection radius for normal weapons +-- radius2 = : protection radius for heavy weapons +-- action definitions: actions are definitions of transitions of one state of a +-- spawn point into another one triggered by a message. +-- c.action[] = {} +-- action-num: just an increment number +-- action-fields: - comma-separated list of "key = value" +-- - all fields are mandatory +-- - fields: +-- spawn = +-- newstate = NO_PROTECT|PROTECT_ALLIES|PROTECT_AXIS +-- trigger = : part of a message that is displayed +-- by the server on a specific event. +-- adding new protection areas to maps: +-- new protection areas can easily been added: +-- 1. enter the map and walk to the location where you want to add the area +-- 2. type /etwsk_spawns and remember the highest spawn index number +-- 3. type /etwsk_pos and write down the coordinates +-- 4. add spawn to config with at least the name,state and pos field +-- default values: +-- At mapstart, ETWsk scans for all spawnpoints and sets the state either to +-- PROTECT_ALLIES or PROTECT_AXIS. It also scans for capturable flag poles +-- and sets the state of a spawnpoint near a flag pole to NO_PROTECT. The +-- location of a spawnpoint is taken from the WOLF_objective entity, the +-- small spawn flag that can be selected in the command map. This entity is +-- usually placed in the center of the individual player-spawnpoints. +-- However, on some maps this is not the case. Check the positions of the +-- small spawn flags on the command map or type /etwsk_pos after you have +-- spawned to check the distance to protected areas. If needed, adjust the +-- radius, or the pos or add a new protection area to the map. +-- If you wish to set all protection areas manually in a map, add: +-- c.defaults = false +-- to the definitions for a map. +-------------------------------------------------------------------------------- + hasconfig = true + local c = {spawns = {}, actions = {}, defaults = true} +-- airassfp1 28.03.2010 + if map == "airassfp1" then + c.spawns[1] = {name = "Base Barracks", state = PROTECT_AXIS, pos = {-410, -4450, 346}, radius2 = 400} + c.spawns[2] = {name = "Airfield Base", state = PROTECT_AXIS, pos = {-1660, 750, 240}, radius2 = 600} + c.spawns[3] = {name = "Airfield Base2", state = PROTECT_AXIS, pos = {-1660, 40, 240}, radius2 = 400} + c.spawns[4] = {name = "Allied Train Entrance", state = PROTECT_ALLIES, pos = {2650, -7530, 410}, radius2 = 1000} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "Allies have blown up the Main Entrance!"} +-- Siwa Oasis 16.11.2008 Update 21.04.2013 + elseif map == "oasis" then +-- c.spawns[1] = {name = "Axis Garrison", state = PROTECT_AXIS, pos = {7400, 4810, -391}, radius2 = 460} + c.spawns[1] = {name = "Axis Garrison", state = PROTECT_AXIS, pos = {7420, 4710, -391}, radius2 = 500} + c.spawns[2] = {name = "Allied Camp Base", state = PROTECT_ALLIES, pos = {1250, 2760, -415}, radius2 = 1140} + c.spawns[3] = {name = "Old City", state = NO_PROTECT, pos = {4300, 7000, -450}, radius2 = 870} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "breached the Old City wall"} +-- __BRIDGES__ 28.03.2010 + elseif map == "__bridges__" then + c.spawns[1] = {name = "The Sawmill Spawns", state = PROTECT_ALLIES, pos = {-4850, -7620, 820}, radius2 = 500} + c.spawns[2] = {name = "The Mill Tunnel Spawns", state = PROTECT_ALLIES, pos = {-1470, -2230, 630}, radius2 = 460} + c.spawns[3] = {name = "The Reservoir Spawns", state = PROTECT_AXIS, pos = {9440, 3680, 680}, radius2 = 500} + c.spawns[4] = {name = "North Tunnel2", state = PROTECT_AXIS, pos = {4020, 1200, 820}, radius2 = 300} + c.spawns[5] = {name = "The Boathouse Spawns", state = NO_PROTECT, pos = {180, 2100, 310}, radius2 = 500} + c.spawns[6] = {name = "The Mill Service Tunnel Spawns", state = NO_PROTECT, pos = {-5094, -2452, 480}, radius2 = 300} + c.actions[1] = {spawn = 5, newstate = PROTECT_AXIS, trigger = "Axis gained spawn positions at The Boathouse!"} + c.actions[2] = {spawn = 4, newstate = PROTECT_ALLIES, trigger = "Allies gained positions in the North Tunnel!"} + c.actions[3] = {spawn = 2, newstate = NO_PROTECT, trigger = "Allies gained positions in the North Tunnel!"} + c.actions[4] = {spawn = 5, newstate = NO_PROTECT, trigger = "Axis are regrouping at the reservoir!"} + c.actions[5] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "allies have gained spawn positions in the Mill Tunnel"} + c.actions[6] = {spawn = 4, newstate = PROTECT_AXIS, trigger = "allies have gained spawn positions in the Mill Tunnel"} + c.actions[7] = {spawn = 2, newstate = PROTECT_AXIS, trigger = "Axis gained spawn positions at The Mill Tunnel"} + c.actions[8] = {spawn = 4, newstate = NO_PROTECT, trigger = "Axis gained spawn positions at The Mill Tunnel"} + c.actions[9] = {spawn = 6, newstate = PROTECT_AXIS, trigger = "Axis gained spawn positions at The Mill Tunnel"} + +-- Axislab 28.03.2010 + elseif map == "axislab_final" then + c.spawns[1] = {name = "Hill Top", state = NO_PROTECT, pos = {-162, 2540, 1130}, radius2 = 600} + c.spawns[2] = {name = "Allied Side", state = PROTECT_ALLIES, pos = {2250, -4140, 170}, radius2 = 1000} + c.spawns[3] = {name = "Allied Cabin", state = NO_PROTECT, pos = {-2900, 225, 330}, radius2 = 100} + c.spawns[4] = {name = "Axis Bunker", state = PROTECT_AXIS, pos = {-1450, 2400, 470}, radius2 = 300} + c.spawns[5] = {name = "Axis Bunker2", state = PROTECT_AXIS, pos = {-1420, 2100, 470}, radius2 = 300} + c.spawns[6] = {name = "Axis Bunker3", state = PROTECT_AXIS, pos = {-990, 2038, 470}, radius2 = 300} + c.spawns[7] = {name = "Boardroom", state = PROTECT_AXIS, pos = {240, 1190, 310}, radius2 = 300} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "Allies have secured the Hill Top!"} +-- et_mor2 28.03.2010 + elseif map == "et_mor2" then + c.spawns[1] = {name = "Desert Camp", state = PROTECT_ALLIES, pos = {9590, 1600, -300}, radius2 = 1300} + c.spawns[2] = {name = "Gate House", state = PROTECT_AXIS, pos = {1720, 700, 30}, radius2 = 470} + c.spawns[3] = {name = "Gate House2", state = PROTECT_AXIS, pos = {2360, 645, 30}, radius2 = 300} + c.spawns[4] = {name = "NorthMarket", state = PROTECT_AXIS, pos = {-1290, 1620, 30}, radius2 = 600} + c.actions[1] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "Allies have destroyed the Main town gate!"} + c.actions[2] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "Allies have destroyed the Main town gate!"} +-- bulge_beta1 aka Wacht am Rhein 07.04.2010 + elseif map == "bulge_beta1" then + c.spawns[1] = {name = "Hotel", state = PROTECT_ALLIES, pos = {4060, -620, 330}, radius2 = 600} + c.spawns[2] = {name = "Allied Town Spawn", state = PROTECT_ALLIES, pos = {-4210, -800, 105}, radius2 = 600} + c.spawns[3] = {name = "Axis Headquarters", state = PROTECT_AXIS, pos = {4120, -4360, 400}, radius2 = 900} + c.actions[1] = {spawn = 1, newstate = PROTECT_AXIS, trigger = "The Tank is at the Hotel"} + c.actions[2] = {spawn = 1, newstate = NO_PROTECT, trigger = "The tank is near the 1st tank barrier"} +-- mp_rocket_et_a1 09.04.2010 + elseif map == "mp_rocket_et_a1" then + c.spawns[1] = {name = "Security Checkpoint", state = NO_PROTECT} + c.spawns[2] = {name = "The Train Cars", state = PROTECT_ALLIES, pos = {2570, -470, 25}, radius2 = 500} + c.spawns[3] = {name = "Security Checkpoint Axis", state = PROTECT_AXIS, pos = {370, 1250, 150}, radius2 = 500} + c.spawns[4] = {name = "Security Checkpoint Axis", state = PROTECT_AXIS, pos = {-10, 1360, 336}, radius2 = 300} +-- caen2 29.04.2010 +-- x0rnn 2018/03/22 decreased allied spawn radius + elseif map == "caen2" then + c.spawns[1] = {name = "TOWN", state = NO_PROTECT} + c.spawns[2] = {name = "Axis Spawn", state = PROTECT_AXIS, pos = {-1690, -2200, 310}, radius2 = 600} + c.spawns[3] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {-2120, 6130, 570}, radius2 = 523} + c.actions[1] = {spawn = 1, newstate = PROTECT_AXIS, trigger = "The Axis are moving the Tank!"} +-- snatch3 29.04.2010 + elseif map == "snatch3" then + c.spawns[1] = {name = "Forest House", state = NO_PROTECT, pos = {-860, -1950, 190}, radius2 = 600} + c.spawns[2] = {name = "Base Spawn", state = PROTECT_AXIS, pos = {40, 2200, 600}, radius2 = 400} + c.spawns[3] = {name = "Allied House", state = PROTECT_ALLIES, pos = {2400, 2220, 215}, radius2 = 600} +-- Railgun + elseif map == "railgun" then + c.spawns[1] = {name = "Axis Tower Spawn", state = NO_PROTECT} + c.spawns[2] = {name = "Axis Construction Site", pos = {-1300, 5183, 420}, state = PROTECT_AXIS, radius2 = 1820} + c.spawns[4] = {name = "Allied Camp", state = PROTECT_ALLIES, radius2 = 700} + c.spawns[5] = {name = "Allied Camp", state = PROTECT_ALLIES, pos = {6000, 3370, 280}, radius2 = 790} +-- Seawall Battery + elseif map == "battery" then + c.spawns[1] = {name = "Axis Main Bunker", state = PROTECT_AXIS, pos = {3000, -5300, 1016}, radius2 = 400} + c.spawns[2] = {name = "Allied East Beach", state = PROTECT_ALLIES, pos = {4565, -620, 113}, radius2 = 450} + c.spawns[3] = {name = "Allied East Beach 2", state = PROTECT_ALLIES, pos = {5136, -1184, 488}, radius2 = 450} + c.spawns[4] = {name = "Allied West Beach", state = PROTECT_ALLIES, pos = {544, -760, 113}, radius2 = 400} + c.spawns[5] = {name = "Command Post spawnt", state = NO_PROTECT} + c.spawns[6] = {name = "West Bunker Allies", state = NO_PROTECT} + c.spawns[7] = {name = "Axis spawn / Command Post", state = NO_PROTECT} +-- SW Seawall Battery + elseif map == "sw_battery" then + c.spawns[1] = {name = "Axis Main Bunker", state = PROTECT_AXIS, pos = {3000, -5300, 1016}, radius2 = 400} + c.spawns[2] = {name = "Allied East Beach", state = PROTECT_ALLIES, pos = {4565, -620, 113}, radius2 = 550} + c.spawns[3] = {name = "Allied West Beach", state = PROTECT_ALLIES, pos = {544, -760, 113}, radius2 = 400} + c.spawns[4] = {name = "Command Post spawnt", state = NO_PROTECT} + c.spawns[5] = {name = "West Bunker Allies", state = NO_PROTECT} + c.spawns[6] = {name = "Axis spawn / Command Post", state = NO_PROTECT} +-- W�rzburg Radar +-- Radar 05.10.2018 - added axis house exit protection + elseif map == "radar" then + c.spawns[1] = {state = NO_PROTECT} -- Side Gate Command Post Spawn + c.spawns[2] = {name = "Abandoned Villa", state = PROTECT_ALLIES, pos = {2504, 3422, 1333}, radius2 = 999} + c.spawns[6] = {name = "Abandoned Villa", state = PROTECT_ALLIES, pos = {1504, 4495, 1333}, radius2 = 660} + c.spawns[3] = {name = "Forward Bunker", state = NO_PROTECT, pos = {-581, 1661, 1364}, radius2 = 785} + c.spawns[4] = {name = "Forward Hut", state = NO_PROTECT} + c.spawns[5] = {name = "Lower Warehouse", state = PROTECT_AXIS, pos = {-1494, -4032, 1248}, radius2 = 330} + c.spawns[7] = {name = "Lower Warehouse II", state = PROTECT_AXIS, pos = {-1270, -3772, 1248}, radius2 = 230} + c.spawns[8] = {name = "Lower Warehouse III", state = PROTECT_AXIS, pos = {-1369, -3662, 1248}, radius2 = 151} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "secured the Forward Bunker"} + elseif map == "radar_phx_b_3" or map == "radar_truck" then + c.spawns[1] = {state = NO_PROTECT} -- Side Gate Command Post Spawn + c.spawns[2] = {name = "Abandoned Villa", state = PROTECT_ALLIES, pos = {2504, 3422, 1333}, radius2 = 999} + c.spawns[6] = {name = "Abandoned Villa", state = PROTECT_ALLIES, pos = {1504, 4495, 1333}, radius2 = 660} + c.spawns[3] = {name = "Forward Bunker", state = NO_PROTECT, pos = {-581, 1661, 1364}, radius2 = 785} + c.spawns[4] = {name = "Forward Hut", state = NO_PROTECT} + c.spawns[5] = {name = "Lower Warehouse", state = PROTECT_AXIS, pos = {-1494, -4032, 1248}, radius2 = 330} + c.spawns[7] = {name = "Lower Warehouse II", state = PROTECT_AXIS, pos = {-1270, -3772, 1248}, radius2 = 230} + c.spawns[8] = {name = "Lower Warehouse III", state = PROTECT_AXIS, pos = {-1369, -3662, 1248}, radius2 = 151} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "secured the Forward Bunker"} + c.actions[2] = {spawn = 2, newstate = PROTECT_AXIS, trigger = "Axis Abandoned Villa spawn enabled"} + c.actions[3] = {spawn = 6, newstate = PROTECT_AXIS, trigger = "Axis Abandoned Villa spawn enabled"} +-- Fueldump +-- Fueldump 05.10.2018 - added lower axis fuel dump spawn exit protection, added allied tunnel spawn protection + elseif map == "fueldump" then + c.spawns[1] = {name = "Tunnel Store Room I", state = PROTECT_AXIS, pos = {-5142, -1724, 500}, radius2 = 290} + c.spawns[6] = {name = "Tunnel Store Room II", state = PROTECT_AXIS, pos = {-5652, -2275, 600}, radius2 = 300} + c.spawns[7] = {name = "Tunnel Store Room Lower Entrance", state = PROTECT_AXIS, pos = {-5655, -1471, 376}, radius2 = 80} + c.spawns[8] = {name = "Tunnel Store Room Stair Way", state = PROTECT_AXIS, pos = {-5661, -1699, 520}, radius2 = 320} + c.spawns[2] = {state = NO_PROTECT} -- Truck + c.spawns[3] = {state = NO_PROTECT} -- Garage HQ + c.spawns[4] = {name = "Axis Fuel Dump", state = PROTECT_AXIS, pos = {-8400, -5663, 417}, radius2 = 665} + c.spawns[9] = {name = "Axis Fuel Dump", state = PROTECT_AXIS, pos = {-8393, -6723, 232}, radius2 = 700} + c.spawns[5] = {name = "Allied Entrance", state = PROTECT_ALLIES, pos = {-857, -8050, 328}, radius2 = 870} + c.spawns[10] = {name = "Tunnel Spawn", state = NO_PROTECT, pos = {-6165, -1288, 344}, radius2 = 300} + c.spawns[11] = {name = "Axis Fuel Dump Lower Exit", state = PROTECT_AXIS, pos = {-8977, -7310, 232}, radius2 = 200} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} + c.actions[2] = {spawn = 6, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} + c.actions[3] = {spawn = 7, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} + c.actions[4] = {spawn = 8, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} + c.actions[5] = {spawn = 10, newstate = PROTECT_ALLIES, trigger = "Tunnel Spawn enabled"} + c.actions[6] = {spawn = 10, newstate = NO_PROTECT, trigger = "Tunnel Spawn disabled"} +-- Adlernest B4 16.11.2008 + elseif map == "adlernest" or map == "etl_adlernest" then + c.spawns[1] = {state = PROTECT_ALLIES, radius2 = 570} + c.spawns[4] = {name = "Tank", state = PROTECT_ALLIES, pos = {2513, -321,-95}, radius2 = 540} + c.spawns[2] = {state = NO_PROTECT} + c.spawns[3] = {name = "Axis1", state = PROTECT_AXIS, pos = {-1949, -725, 72}, radius2 = 334} + c.spawns[5] = {name = "Axis2", state = PROTECT_AXIS, pos = {-1925, -50, 72}, radius2 = 334} + c.spawns[6] = {name = "Axis3", state = PROTECT_AXIS, pos = {-978, -445, 72}, radius2 = 334} + c.spawns[7] = {name = "Axis4", state = PROTECT_AXIS, pos = {-1464, -596, 72}, radius2 = 334} + c.spawns[8] = {name = "Axis5", state = PROTECT_AXIS, pos = {-1241, -212, 72}, radius2 = 434} + c.spawns[9] = {name = "Axis6", state = PROTECT_AXIS, pos = {-1597, -184, 100}, radius2 = 447} + +-- Adlernest_roof_b4 + elseif map == "adlernest_roof_b4" then + c.spawns[1] = {name = "Tank", state = PROTECT_ALLIES, pos = {3476, -1037, -95}, radius2 = 800} + c.spawns[2] = {name = "CP Spawn", state = NO_PROTECT} + c.spawns[3] = {name = "Axis1", state = PROTECT_AXIS, pos = {-1949, -725, 72}, radius2 = 334} + c.spawns[4] = {name = "Axis2", state = PROTECT_AXIS, pos = {-1925, -50, 72}, radius2 = 334} + c.spawns[5] = {name = "Axis3", state = PROTECT_AXIS, pos = {-978, -445, 72}, radius2 = 334} + c.spawns[6] = {name = "Axis4", state = PROTECT_AXIS, pos = {-1464, -596, 72}, radius2 = 334} + c.spawns[7] = {name = "Axis5", state = PROTECT_AXIS, pos = {-1241, -212, 72}, radius2 = 334} + c.spawns[8] = {name = "Axis6", state = PROTECT_AXIS, pos = {-1597, -184, 100}, radius2 = 447} + c.spawns[9] = {name = "Allies Roof1", state = PROTECT_ALLIES, pos = {520, -2522, 546}, radius2 = 650} + c.spawns[10] = {name = "Allies Roof2", state = PROTECT_ALLIES, pos = {-29, -2296, 296}, radius2 = 200} + c.spawns[11] = {name = "Axis Roof1", state = PROTECT_AXIS, pos = {-1543, 264, 72}, radius2 = 293} + c.spawns[12] = {name = "Axis Roof2", state = PROTECT_AXIS, pos = {-1543, 567, 72}, radius2 = 365} + c.spawns[13] = {name = "Axis Roof3", state = PROTECT_AXIS, pos = {-1277, -386, 296}, radius2 = 400} + c.spawns[14] = {name = "Axis Roof4", state = PROTECT_AXIS, pos = {-1701, -149, 296}, radius2 = 200} + +-- Braundorf B4 16.11.2008 + elseif map == "braundorf_b4" or map == "braundorf_final" then + c.spawns[1] = {name = "Factory District", state = NO_PROTECT, pos = {3505, -2355, 320}, radius2 = 375} + c.spawns[9] = {name = "Factory District", state = NO_PROTECT, pos = {3405, -2355, 320}, radius2 = 375} + c.spawns[2] = {name = "Bunker Back", state = PROTECT_AXIS, pos = {2849, 1919, 74}, radius2 = 250} + c.spawns[5] = {name = "Bunker Middle Back", state = PROTECT_AXIS, pos = {2687, 1562, 24}, radius2 = 190} + c.spawns[6] = {name = "Bunker Front", state = PROTECT_AXIS, pos = {2687, 383, 24}, radius2 = 170} + c.spawns[7] = {name = "Bunker Middle Front", state = PROTECT_AXIS, pos = {2687, 741, 24}, radius2 = 180} + c.spawns[8] = {name = "Bunker Middle", state = PROTECT_AXIS, pos = {2693, 1140, 24}, radius2 = 202} + c.spawns[3] = {state = PROTECT_ALLIES, radius2 = 540}--Allied Spawn + c.spawns[4] = {state = NO_PROTECT} --Command Post Spawn + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "Allies permanently capture the factory district!"} + c.actions[2] = {spawn = 9, newstate = PROTECT_ALLIES, trigger = "Allies permanently capture the factory district!"} +-- Karsiah TE2 + elseif map == "karsiah_te2" then + c.spawns[1] = {name = "Backyard", state = PROTECT_AXIS, pos = {-1152, -263, 73}, radius2 = 395} + c.spawns[4] = {name = "Backyard", state = PROTECT_AXIS, pos = {-1050, -263, 73}, radius2 = 395} + c.spawns[5] = {name = "Backyard", state = PROTECT_AXIS, pos = {-1240, -263, 73}, radius2 = 470} + c.spawns[2] = {name = "Allied Hideout", state = PROTECT_ALLIES, pos = {4165, 430, 152}, radius2 = 335} + c.spawns[3] = {name = "Old City", state = NO_PROTECT, pos = {1304, -1430, 290}, radius2 = 400} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "captured the Old City"} +-- SW Siwa Oasias B3 16.11.2008 + elseif map == "sw_oasis_b3" then + c.spawns[1] = {name = "Axis Garrison", state = PROTECT_AXIS, pos = {7420, 4610, -391}, radius2 = 550} + c.spawns[2] = {name = "Old City", state = NO_PROTECT, pos = {4300, 7000, -450}, radius2 = 870} + c.spawns[3] = {name = "Axis Upper Garrison", state = NO_PROTECT} + c.spawns[4] = {name = "Allied Camp Base", state = PROTECT_ALLIES, pos = {1250, 2760, -400}, radius2 = 1140} + c.spawns[5] = {name = "Allied Camp Water Pump", state = NO_PROTECT, pos = {2584, 2144, -592}, radius2 = 1000} + c.spawns[6] = {name = "Axis Garrison Above", state = PROTECT_AXIS, pos = {7378, 4090, -199}, radius2 = 190} + c.actions[1] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "breached the Old City wall"} + c.actions[2] = {spawn = 4, newstate = NO_PROTECT, trigger = "Allies have built the Oasis Water"} + c.actions[3] = {spawn = 5, newstate = PROTECT_ALLIES, trigger = "Allies have built the Oasis Water"} + c.actions[4] = {spawn = 4, newstate = PROTECT_ALLIES, trigger = "Axis have damaged the Oasis Water"} + c.actions[5] = {spawn = 5, newstate = NO_PROTECT, trigger = "Axis have damaged the Oasis Water"} +-- Goldrush 25.11.2008 +-- Goldrush 05.10.2018 - disabled Allied spawnroof protection when truck with gold is near truck barrier #2 + elseif map == "goldrush" or map == "sw_goldrush_te" or map == "uje_goldrush" then + c.spawns[1] = {name = "Tank Depot Main Exit", state = PROTECT_AXIS, pos = {-79, 3005, 320}, radius2 = 250} + c.spawns[4] = {name = "Tank Depot Alternate Exit", state = PROTECT_AXIS, pos = {-664, 3541, 386}, radius2 = 420} + c.spawns[5] = {name = "Tank Depot Room", state = PROTECT_AXIS, pos = {-48, 3649, 344}, radius2 = 550} + c.spawns[13] = {name = "Tank Depot Room Exit", state = PROTECT_AXIS, pos = {110, 3100, 320}, radius2 = 370} + c.spawns[6] = {name = "Tank Depot", state = NO_PROTECT, pos = {-354, 2552, 344}, radius2 = 525} + c.spawns[7] = {name = "Tank Depot", state = NO_PROTECT, pos = {-354, 2052, 344}, radius2 = 525} + c.spawns[8] = {name = "Tank Depot", state = NO_PROTECT, pos = {-354, 1552, 344}, radius2 = 250} + c.spawns[2] = {name = "Axis", state = PROTECT_AXIS, pos = {3000, -822, -435}, radius2 = 600} + c.spawns[9] = {name = "Axis", state = PROTECT_AXIS, pos = {3010, -1555, -435}, radius2 = 250} + c.spawns[10] = {name = "Axis Lower Spawn", state = PROTECT_AXIS, pos = {3000, -822, -435}, radius2 = 600} + c.spawns[11] = {name = "Axis Lower Spawn", state = PROTECT_AXIS, pos = {3010, -1555, -435}, radius2 = 250} + c.spawns[12] = {name = "Axis", state = PROTECT_AXIS, pos = {2327, -868, -199}, radius2 = 200} + c.spawns[3] = {name = "Allied Spawn", state = PROTECT_ALLIES, pos = {-3360, -218, -67}, radius2 = 720} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + c.actions[2] = {spawn = 4, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + c.actions[3] = {spawn = 5, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + c.actions[4] = {spawn = 6, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + c.actions[5] = {spawn = 7, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + c.actions[6] = {spawn = 8, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + c.actions[7] = {spawn = 3, newstate = NO_PROTECT, trigger = "spawnroof protection disabled"} + c.actions[8] = {spawn = 13, newstate = PROTECT_ALLIES, trigger = "Allied team has stolen the Tank"} + +-- Dubrovnik + elseif map == "dubrovnik_final" then + c.spawns[1] = {name = "Convent Up", state = PROTECT_AXIS, pos = {60, 727, 252}, radius2 = 221} + c.spawns[3] = {name = "Convent Up", state = PROTECT_AXIS, pos = {-611, 727, 228}, radius2 = 221} + c.spawns[4] = {name = "Convent Down", state = PROTECT_AXIS, pos = {60, 727, 40}, radius2 = 221} + c.spawns[5] = {name = "Convent Down", state = PROTECT_AXIS, pos = {-611, 727, 40}, radius2 = 221} + c.spawns[6] = {name = "Convent Yard", state = PROTECT_AXIS, pos = {-12, 1655, 40}, radius2 = 601} + c.spawns[2] = {name = "East Courtyard", state = PROTECT_ALLIES, pos = {1015, -2146, 40}, radius2 = 300} + c.spawns[7] = {name = "East Courtyard", state = PROTECT_ALLIES, pos = {1338, -2334, 40}, radius2 = 450} + c.spawns[8] = {name = "East Courtyard", state = PROTECT_ALLIES, pos = {1933, -2477, 40}, radius2 = 590} +-- Frostbite + elseif map == "frostbite" then + c.spawns[1] = {name = "Allied Barracks", state = PROTECT_ALLIES, pos = {-4698, -233, -201}, radius2 = 550} + c.spawns[2] = {name = "Axis Barracks", state = PROTECT_AXIS, pos = {-134, 1331, 280}, radius2 = 450} + c.spawns[3] = {name = "Axis Garage", state = PROTECT_AXIS, pos = {-847, 1440, 24}, radius2 = 440} + c.spawns[4] = {state = NO_PROTECT} -- Upper Complex (Command Post) + c.spawns[5] = {state = NO_PROTECT} --Axis Spawn (Documents) + c.actions[1] = {spawn = 3, newstate = NO_PROTECT, trigger = "Allies have transmitted the Supply Documents"} + +-- ETL Frostbite + elseif map == "etl_frostbite" then + c.spawns[1] = {name = "Allied Barracks", state = PROTECT_ALLIES, pos = {-4698, -233, -201}, radius2 = 550} + c.spawns[2] = {name = "Axis Barracks", state = PROTECT_AXIS, pos = {-140, 1286, 280}, radius2 = 400} + c.spawns[3] = {name = "Axis Garage", state = PROTECT_AXIS, pos = {-847, 1440, 24}, radius2 = 440} + c.spawns[4] = {state = NO_PROTECT} -- Upper Complex (Command Post) + c.spawns[5] = {state = NO_PROTECT} --Axis Spawn (Documents) + c.actions[1] = {spawn = 3, newstate = NO_PROTECT, trigger = "Allies have transmitted the Supply Documents"} + +-- ETL Bergen V3 23.10.2018 + elseif map == "etl_bergen_v3" then + c.spawns[1] = {state = NO_PROTECT} -- Forward Bunker (Flag) + c.spawns[2] = {name = "Axis Spawn", state = PROTECT_AXIS, pos = {6687, -1149, 216}, radius2 = 270} + c.spawns[3] = {name = "Allied Spawn", state = PROTECT_ALLIES, pos = {-1231, -2358, 89}, radius2 = 220} + c.spawns[4] = {name = "Axis Spawn 2", state = PROTECT_AXIS, pos = {6783, -684, 216}, radius2 = 236} + +-- Northpole 2018-12-11 + elseif map == "northpole" then + c.spawns[1] = {name = "Axis Spawn", state = PROTECT_AXIS, pos = {-3216, -2753, 827}, radius2 = 900} + c.spawns[2] = {name = "Town Spawn", state = PROTECT_ALLIES, pos = {2172, -998, 824}, radius2 = 250} + c.spawns[3] = {name = "Town Spawn", state = PROTECT_ALLIES, pos = {2002, -515, 824}, radius2 = 150} + c.spawns[4] = {name = "Town Spawn", state = PROTECT_ALLIES, pos = {2357, -473, 824}, radius2 = 200} + c.spawns[5] = {name = "Town Spawn outside", state = PROTECT_ALLIES, pos = {2697, -431, 827}, radius2 = 150} + c.spawns[6] = {name = "Town Spawn 2nd floor", state = PROTECT_ALLIES, pos = {2296, -653, 1016}, radius2 = 225} + +-- Bremen B2 16.11.2008 + elseif map == "bremen_b2" or map == "bremen_b3" or map == "fa_bremen_b3" or map == "fa_bremen_final" then + c.spawns[1] = {name = "Allied first spawn", state = PROTECT_ALLIES, pos = {-1957, -2222, 88}, radius2 = 440} + c.spawns[6] = {name = "Allied first spawn*", state = PROTECT_ALLIES, pos = {-2264, -1512, 88}, radius2 = 406} + c.spawns[2] = {state = NO_PROTECT} -- Axis Flag Spawn + c.spawns[3] = {name = "Allied Flag", state = NO_PROTECT, pos = {-2517, 1315, 88}, radius2 = 286} + c.spawns[4] = {name = "Axis Rear I", state = PROTECT_AXIS, pos = {727, -608, 88}, radius2 = 660} + c.spawns[7] = {name = "Axis Rear II", state = PROTECT_AXIS, pos = {287, 233, 88}, radius2 = 250} + c.spawns[5] = {state = NO_PROTECT} -- Command Post + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "main gate has been destroyed"} + c.actions[2] = {spawn = 3, newstate = NO_PROTECT, trigger = "Truck has been repaired"} +-- Venice + elseif map == "venice" then + c.spawns[1] = {name = "Allies", state = PROTECT_ALLIES, pos = {-4067, -1001, -103}, radius2 = 850} + c.spawns[2] = {name = "Outpost", state = PROTECT_AXIS, pos = {517, 1286, -135}, radius2 = 381} --Axis/Allies + c.spawns[3] = {name = "Axis", state = PROTECT_AXIS, pos = {4859, 1708, -199}, radius2 = 500} + c.actions[1] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "captured the Outpost"} +-- Venice TC RC2 + elseif map == "venice_tcrc2_v1" then + c.spawns[1] = {name = "Allied", state = PROTECT_ALLIES, pos = {-2464, -1202, -213}, radius2 = 483} + c.spawns[2] = {name = "Outpost", state = PROTECT_AXIS, pos = {517, 1286, -135}, radius2 = 381} --Axis/Allies + c.spawns[3] = {name = "Axis Spawn North", state = PROTECT_AXIS, pos = {4859, 1708, -199}, radius2 = 500} + c.spawns[4] = {name = "Axis Spawn South", state = PROTECT_AXIS, pos = {2544, -2784, -215}, radius2 = 800} + c.actions[1] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "captured the Outpost"} +-- Reactor + elseif map == "reactor_final" then + c.spawns[1] = {name = "Forward Bunker", state = NO_PROTECT, pos = {96, -551, 280}, radius2 = 430} + c.spawns[2] = {name = "Head Quarters", state = PROTECT_AXIS, pos = {-283, 1415, 216}, radius2 = 320} --Axis + c.spawns[6] = {name = "Head Quarters", state = PROTECT_AXIS, pos = {292, 1341, 280}, radius2 = 278} --Axis + c.spawns[3] = {name = "Caves", state = PROTECT_ALLIES, pos = {1668, -3100, 616}, radius2 = 240} + c.spawns[4] = {name = "Caves", state = PROTECT_ALLIES, pos = {1150, -3128, 456}, radius2 = 200} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "secured the forward bunker"} +-- Supply 16.11.2008 + elseif map == "supply" then + c.spawns[1] = {name = "Allied start", state = PROTECT_ALLIES, pos = {-2050, 131, 0}, radius2 = 540} + c.spawns[3] = {name = "Forward", state = NO_PROTECT, pos = {-283, 2391, 264}, radius2 = 220} + c.spawns[4] = {state = NO_PROTECT} --Command Post Spawn + c.spawns[2] = {name = "Axis Depot", state = PROTECT_AXIS, pos = {650, -1810, -135}, radius2 = 330} + c.spawns[7] = {name = "Axis Depot Stairs", state = PROTECT_AXIS, pos = {719, -1487, -31}, radius2 = 150} + c.spawns[5] = {name = "Axis Depot Back Exit", state = PROTECT_AXIS, pos = {771, -2629, -47}, radius2 = 260} + c.spawns[6] = {name = "Axis Depot Tunnel", state = PROTECT_AXIS, pos = {890, -2270, -147}, radius2 = 260} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "breached the Forward Bunker"} + elseif map == "etl_supply" then + c.spawns[1] = {name = "Allied start", state = PROTECT_ALLIES, pos = {-2050, 131, 0}, radius2 = 540} + c.spawns[3] = {name = "Forward", state = NO_PROTECT, pos = {-283, 2391, 264}, radius2 = 220} + c.spawns[4] = {state = NO_PROTECT} --Command Post Spawn + c.spawns[2] = {name = "Axis Depot", state = PROTECT_AXIS, pos = {650, -1810, -135}, radius2 = 330} + c.spawns[7] = {name = "Axis Depot Stairs", state = PROTECT_AXIS, pos = {719, -1487, -31}, radius2 = 150} + c.spawns[5] = {name = "Axis Depot Back Exit", state = PROTECT_AXIS, pos = {771, -2629, -47}, radius2 = 260} + c.spawns[6] = {name = "Axis Depot Tunnel", state = PROTECT_AXIS, pos = {890, -2270, -147}, radius2 = 260} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "breached the Forward Bunker"} +-- Supply Pro 23.10.2018 + elseif map == "supply_pro" then + c.spawns[1] = {name = "Farmhouse", state = PROTECT_ALLIES, pos = {-2175, -210, 24}, radius2 = 221} + c.spawns[5] = {name = "Farmhouse Exit", state = PROTECT_ALLIES, pos = {-2175, 140, 24}, radius2 = 221} + c.spawns[3] = {name = "Forward Bunker Spawn", state = NO_PROTECT, pos = {-271, 2367, 264}, radius2 = 170} + c.spawns[4] = {state = NO_PROTECT} --Command Post Spawn + c.spawns[2] = {name = "Axis Depot Spawn", state = PROTECT_AXIS, pos = {650, -1789, -165}, radius2 = 210} + c.spawns[8] = {name = "Axis Depot Stairs", state = PROTECT_AXIS, pos = {719, -1487, -31}, radius2 = 150} + c.spawns[6] = {name = "Axis Depot Spawn Back Exit", state = PROTECT_AXIS, pos = {771, -2629, -47}, radius2 = 220} + c.spawns[7] = {name = "Axis Depot Spawn Tunnel", state = PROTECT_AXIS, pos = {890, -2270, -147}, radius2 = 260} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "breached the Forward Bunker"} + + +-- missile_b3 + elseif map == "missile_b3" then + c.spawns[1] = {name = "Gate Control Spawn", state = PROTECT_AXIS, pos = {3750, -4823, 80}, radius2 = 400} + c.spawns[3] = {name = "Bunker Spawn", state = PROTECT_ALLIES, radius2 = 700} + c.spawns[5] = {name = "Rocket Hall Spawn", state = PROTECT_AXIS, radius2 = 600} + c.spawns[6] = {name = "Rocket Gate Spawn", state = NO_PROTECT, radius2 = 450} + c.actions[1] = {spawn = 1, newstate = NO_PROTECT, trigger = "Magnetic seal deactivated"} + --c.actions[2] = {spawn = 6, newstate = PROTECT_ALLIES, trigger = "Allies have activated the Gate Controls"} + elseif map == "missile_b4" then + c.spawns[1] = {name = "Gate Control Spawn", state = PROTECT_AXIS, pos = {4119, -4408, 353}, radius2 = 500} + c.spawns[3] = {name = "Bunker Spawn", state = PROTECT_ALLIES, radius2 = 700} + c.spawns[5] = {name = "Rocket Hall Spawn", state = PROTECT_AXIS, radius2 = 560} + c.spawns[6] = {name = "Rocket Gate Spawn", state = NO_PROTECT, radius2 = 450} + c.actions[1] = {spawn = 1, newstate = NO_PROTECT, trigger = "Magnetic seal deactivated"} + --c.actions[2] = {spawn = 6, newstate = PROTECT_ALLIES, trigger = "Allies have activated the Gate Controls"} + + + elseif map == "transmitter" then + c.spawns[3] = {name = "Allied Base", state = PROTECT_ALLIES, radius2 = 1000} + c.spawns[2] = {name = "Castle", state = PROTECT_AXIS, radius2 = 400} +-- 1944_beach + elseif map == "1944_beach" then + c.spawns[1] = {name = "Axis Spawn", state = PROTECT_AXIS, pos = {3254, -4882, 5384}, radius2 = 500} + c.spawns[2] = {name = "Forward Spawn", state = NO_PROTECT} + c.spawns[3] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {310, 1984, 4512}, radius2 = 180} + c.spawns[4] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {310, 1884, 4512}, radius2 = 200} + c.spawns[5] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {310, 1684, 4512}, radius2 = 200} + c.spawns[6] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {310, 1584, 4512}, radius2 = 200} + c.spawns[7] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {333, 1457, 4512}, radius2 = 200} + c.spawns[8] = {name = "Allies Spawn", state = PROTECT_ALLIES, pos = {328, 1211, 4512}, radius2 = 300} + c.spawns[9] = {name = "Transmitter Spawn", state = NO_PROTECT} + c.spawns[10] = {name = "Allies Spawn 2", state = PROTECT_ALLIES, pos = {-2193, 1014, 4472}, radius2 = 100} + c.spawns[11] = {name = "Allies Spawn 2", state = PROTECT_ALLIES, pos = {-2202, 689, 4512}, radius2 = 200} + c.spawns[12] = {name = "Allies Spawn 2", state = PROTECT_ALLIES, pos = {-2197, 513, 4512}, radius2 = 200} + c.spawns[13] = {name = "Allies Spawn 2", state = PROTECT_ALLIES, pos = {-2209, 193, 4516}, radius2 = 300} + +-- decay_b7 + elseif map == "decay_b7" then + c.spawns[1] = {name = "Forward Flag", state = NO_PROTECT, pos = {-415, 800, 348}, radius2 = 290} + c.spawns[2] = {name = "Axis Garrison", state = PROTECT_AXIS, pos = {2956, 3997, 319}, radius2 = 500} + c.spawns[3] = {name = "Side Entrance", state = NO_PROTECT} + c.spawns[4] = {name = "Allied Camp", state = PROTECT_ALLIES, pos = {3590, -19, 64}, radius2 = 700} + c.spawns[5] = {name = "Allied Camp", state = PROTECT_ALLIES, pos = {3722, -709, 64}, radius2 = 700} + c.spawns[6] = {name = "Allied Camp", state = PROTECT_ALLIES, pos = {3613, 562, 64}, radius2 = 800} + c.spawns[7] = {name = "Locker Room", state = NO_PROTECT, pos = {-383, 2282, 327}, radius2 = 240} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "Allies have permanently secured the"} + c.actions[2] = {spawn = 7, newstate = PROTECT_ALLIES, trigger = "The Allies have destroyed the generator, the vault"} +-- library_b3 + elseif map == "library_b3" then + c.spawns[1] = {name = "Allied First Spawn", state = PROTECT_ALLIES, pos = {-2202, -3267, -15}, radius2 = 500} + c.spawns[2] = {name = "Axis Spawn", state = PROTECT_AXIS, pos = {-582, 3303, -115}, radius2 = 400} + c.spawns[3] = {name = "Library Office Spawn", state = PROTECT_AXIS, pos = {-96, 3971, -75}, radius2 = 260} + +-- ET Ice + elseif map == "et_ice" then + c.spawns[1] = {name = "Axis North Barracks", state = PROTECT_AXIS, radius2 = 360} + c.spawns[2] = {name = "Axis South Barracks", state = PROTECT_AXIS, radius2 = 360} + c.spawns[3] = {name = "Allies North Barracks", state = PROTECT_ALLIES} + c.spawns[4] = {name = "Allies South Barracks", state = PROTECT_ALLIES} --Transmitter +-- Heart of Gold + elseif map == "hog_b12_dt" then + c.spawns[2] = {state = NO_PROTECT} --Gate + c.spawns[3] = {name = "Village", state = PROTECT_AXIS, radius1 = 150, radius2 = 440} + c.spawns[5] = {name = "Village", state = PROTECT_AXIS, pos = {-4, 703, 300}, radius2 = 220} + c.spawns[6] = {name = "Village", state = PROTECT_AXIS, pos = {610, 112, 350}, radius2 = 235} + c.spawns[1] = {name = "Garage", state = PROTECT_ALLIES, pos = {-4943, -77, 0}, radius2 = 780} + c.spawns[4] = {state = NO_PROTECT} --Command Post Spawn +-- ET Beach + elseif map == "et_beach" then + c.spawns[1] = {name = "Axis Side", state = PROTECT_AXIS, pos = {2541, 3217, 1176}, radius2 = 301} +-- c.spawns[1] = {name = "Axis Side", state = PROTECT_AXIS, pos = {2548, 3116, 1176}, radius2 = 360} + c.spawns[2] = {state = NO_PROTECT} -- Axis Side (unten) + c.spawns[3] = {name = "Forward Bunker", state = NO_PROTECT, pos = {1333, 3455, 680}, radius2 = 140} -- Forward Bunker + c.spawns[4] = {name = "Allied Side", state = PROTECT_ALLIES, pos = {-1872, 3504, 97}, radius2 = 600} + c.spawns[5] = {name = "Supply Bunker", state = NO_PROTECT} -- Command Post Spawn Supply Bunker + c.spawns[6] = {name = "Supply Bunker", state = NO_PROTECT} -- Bed Room Spawn + c.spawns[7] = {state = NO_PROTECT} -- Seawall Breach + c.spawns[8] = {name = "Allied Side", state = PROTECT_ALLIES, pos = {-1799, -2651, 296}, radius2 = 300} + c.actions[1] = {spawn = 3, newstate = PROTECT_ALLIES, trigger = "Allies secured the Forward Bunker"} +-- TC Base + elseif map == "tc_base" then + c.spawns[1] = {name = "Allies", state = PROTECT_ALLIES, radius2 = 850, radius2 = 1000} + c.spawns[2] = {name = "Axis", state = PROTECT_AXIS, pos = {3229, 2111, 100}, radius2 = 900} +-- SP Delivery TE 16.11.2008 + elseif map == "sp_delivery_te" then + c.spawns[1] = {name = "Forward Bunker", state = NO_PROTECT, radius2 = 350} -- flag + c.spawns[2] = {name = "The Offices", state = PROTECT_AXIS, radius2 = 850} --axis + c.spawns[3] = {name = "The Train Cars", state = PROTECT_ALLIES, radius2 = 1550} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "secured the forward bunker"} +-- Warbell + elseif map == "warbell" then + c.spawns[1] = {name = "Monastery", state = PROTECT_ALLIES, pos = {2370, -2058, 24}, radius2 = 165} + c.spawns[5] = {name = "Monastery", state = PROTECT_ALLIES, pos = {2623, -2005, 24}, radius2 = 185} + c.spawns[2] = {name = "Axis Start", state = PROTECT_AXIS, radius2 = 1000} --axis + c.spawns[3] = {name = "Command Post", state = NO_PROTECT} + c.spawns[4] = {name = "Guard House", state = NO_PROTECT, radius2 = 350} + c.actions[1] = {spawn = 4, newstate = PROTECT_AXIS, trigger = "secured the Guardhouse Flag"} +-- etl_warbell + elseif map == "etl_warbell" then + c.spawns[1] = {name = "Monastery", state = PROTECT_ALLIES, pos = {2370, -2058, 24}, radius2 = 380} + c.spawns[5] = {name = "Monastery", state = PROTECT_ALLIES, pos = {2623, -2005, 24}, radius2 = 185} + c.spawns[2] = {name = "Axis Spawn", state = PROTECT_AXIS, pos = {960, 2064, 416}, radius2 = 900} + c.spawns[3] = {name = "Command Post", state = NO_PROTECT} + c.spawns[4] = {name = "Guard House", state = NO_PROTECT, pos = {-2742, -148, 512}, radius2 = 350} + c.actions[1] = {spawn = 4, newstate = PROTECT_AXIS, trigger = "have destroyed the Guardhouse Gate"} +-- TroopTrain + elseif map == "trooptrain" then + c.spawns[1] = {state = NO_PROTECT} + c.spawns[2] = {state = NO_PROTECT} + c.spawns[3] = {state = NO_PROTECT} +-- vengeance_te_final + elseif map == "vengeance_te_final" then + c.spawns[6] = {name = "East Spawn", state = PROTECT_AXIS, radius2 = 280} --axis + c.spawns[3] = {name = "West Spawn", state = PROTECT_AXIS, radius2 = 240} --axis + c.spawns[2] = {name = "Allied Spawn", state = PROTECT_ALLIES, radius2 = 300} + c.spawns[1] = {name = "Forward Spawn", state = NO_PROTECT, pos = {973, -704, 128}, radius2 = 185} --Flag Spawn + c.spawns[7] = {name = "Forward Spawn", state = NO_PROTECT, pos = {1245, -704, 128}, radius2 = 185} --Flag Spawn + c.spawns[4] = {name = "Allied CP", state = NO_PROTECT} + c.spawns[5] = {name = "Axis CP", state = NO_PROTECT} + c.actions[1] = {spawn = 1, newstate = PROTECT_AXIS, trigger = "breached the bunker door"} + c.actions[2] = {spawn = 7, newstate = PROTECT_AXIS, trigger = "breached the bunker door"} +-- apennines_b2 + elseif map == "apennines_b2" then + c.spawns[1] = {name = "Desert Cabin", state = NO_PROTECT} + c.spawns[2] = {name = "Research Complex", state = NO_PROTECT} + c.spawns[3] = {name = "Garage Spawn", state = NO_PROTECT} +-- italyfp2 + elseif map == "italyfp2" then + c.spawns[3] = {name = "Axis Spawn", pos = {1018, 3096, 98}, state = PROTECT_AXIS, radius2 = 350} --axis + c.spawns[6] = {name = "Allied CP Spawn", pos = {-1050, -2125, -290}, state = PROTECT_ALLIES, radius2 = 440} +-- italyfp2 + elseif map == "italyfp2" then + c.spawns[3] = {name = "Axis Spawn", pos = {1018, 3096, 98}, state = PROTECT_AXIS, radius2 = 350} --axis + c.spawns[6] = {name = "Allied CP Spawn", pos = {-1050, -2125, -290}, state = PROTECT_ALLIES, radius2 = 440} + +-- v2base_te 17.06.2019 + elseif map == "v2base_te" then + c.spawns[1] = {name = "Axis Spawn", pos = {-2467, 1427, -215}, state = PROTECT_AXIS, radius2 = 295} --axis + c.spawns[2] = {name = "Allies Spawn", pos = {-2047, -1995, 92}, state = PROTECT_ALLIES, radius2 = 200} --allies + c.spawns[3] = {state = NO_PROTECT} + c.spawns[4] = {name = "Allies Spawn", pos = {-2047, -1771, 92}, state = PROTECT_ALLIES, radius2 = 200} --allies + +-- sos_secret_weapon + elseif map == "sos_secret_weapon" then + c.spawns[1] = {state = "Allies Spawn", pos = {2270, -2214, 68}, state = PROTECT_ALLIES, radius2 = 600} + c.spawns[2] = {state = NO_PROTECT} + c.spawns[3] = {state = "Axis Spawn", pos = {-1847, 2307, 68}, state = PROTECT_AXIS, radius2 = 500} + +-- pirates + elseif map == "pirates" then + c.spawns[1] = {state = "Old City", state = NO_PROTECT} + c.spawns[2] = {state = "Seaport", state = PROTECT_AXIS, radius2 = 450} + c.spawns[3] = {name = "Beach Spawn", state = PROTECT_ALLIES, radius2 = 430} + c.spawns[4] = {name = "Courtyard", state = NO_PROTECT} + +-- eagles_2ways_b3 + elseif map == "eagles_2ways_b3" then + c.spawns[1] = {state = "Axis 2", pos = {-4363, -2043, 2208}, state = PROTECT_AXIS, radius2 = 500} + c.spawns[2] = {state = "Allied 3", state = NO_PROTECT, pos = {-3506, -2322, 1776}, radius2 = 450} + c.actions[1] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "Allied 3"} + +-- marketgarden_et_r2 + elseif map == "marketgarden_et_r2" then + c.spawns[1] = {state = "The Bridge", state = NO_PROTECT} + c.spawns[2] = {state = "Command Center", state = NO_PROTECT} + c.spawns[3] = {state = "Banner Room", pos = {-5068, 712, 1112}, state = PROTECT_ALLIES, radius2 = 400} + c.spawns[4] = {state = "South Arch", pos = {2137, -2488, 1104}, state = PROTECT_AXIS, radius2 = 400} + +-- falkenstein_b3 + elseif map == "falkenstein_b3" then + c.spawns[1] = {state = "Station Spawns", pos = {3217, -1241, 112}, state = PROTECT_AXIS, radius2 = 400} + c.spawns[2] = {state = "Base Spawns", pos = {7476, -3911, 352}, state = PROTECT_AXIS, radius2 = 400} + c.spawns[3] = {state = "Allied Spawn One", pos = {2263, -4409, 833}, state = PROTECT_ALLIES, radius2 = 600} + c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "Allies gained access to the base"} + +-- goldendunk_a2 + elseif map == "goldendunk_a2" then + c.spawns[1] = {name = "Axis Spawn1", pos = {-2370, 750, 60}, state = PROTECT_AXIS, radius2 = 250} + c.spawns[2] = {name = "Axis Spawn2", pos = {-2370, -750, 60}, state = PROTECT_AXIS, radius2 = 250} + c.spawns[3] = {name = "Allied Spawn1", pos = {2370, 750, 60}, state = PROTECT_ALLIES, radius2 = 250} + c.spawns[4] = {name = "Allied Spawn2", pos = {2370, -750, 60}, state = PROTECT_ALLIES, radius2 = 250} + + + else hasconfig = false + end + return c +end + + +-------------------------------------------------------------------------------- +-- called when client types a command like "/command" on console +function et_ClientCommand(cno, command) +-------------------------------------------------------------------------------- +-- commands: +-- etwsk : prints mod info and current spawnkill statistics +-- etwsk_spawns : prints list of spawnpoints with current state +-- etwsk_pos : prints current position and distances to protected spawns +-------------------------------------------------------------------------------- + local cmd = string.lower(command) + if cmd == "etwsk_spawns" then + printSpawns(cno) + return 1 + elseif cmd == "etwsk_pos" then + printPos(cno) + return 1 + elseif cmd == "etwsk" then + printStats(cno) + return 1 + elseif cmd == "team" and sinbin and sinbinhash[cno] then -- spam... + if sinbinhash[cno] > et.trap_Milliseconds() then + local team = et.Info_ValueForKey( et.trap_GetConfigstring(et.CS_PLAYERS + cno), "t" ) + local penalty_left = math.ceil( ( sinbinhash[cno] - et.trap_Milliseconds() ) / 1000 ) + et.trap_SendServerCommand( cno, + sinbin_pos .. " \"^3ATTENTION: ^7You may not join a team for another ^1"..penalty_left.." ^7seconds^1!\"\n") + return 1 + else + sinbinhash[cno] = nil --reset + return 0 + end + return 1 + end + return 0 +end + + +-------------------------------------------------------------------------------- +-- calculates the distance +-- note: not true distance as hight is doubled. So the body defined by constant +-- distance is not a sphere, but an ellipsoid +function calcDist(pos1, pos2) +-------------------------------------------------------------------------------- + local dist2 = (pos1[1]-pos2[1])^2 + (pos1[2]-pos2[2])^2 + + ((pos1[3]-pos2[3])*2)^2 + return math.sqrt(dist2) +end + +-------------------------------------------------------------------------------- +-- called at map start +function et_InitGame( levelTime, randomSeed, restart) +-------------------------------------------------------------------------------- + local modname = string.format("%s v%s", module_name, module_version) + et.G_Print(string.format("%s loaded\n", modname)) + et.RegisterModname(modname) + + mapname = et.trap_Cvar_Get("mapname") + c = getConfig(mapname) + + damagegiven = {} + spawnkills = {} + + local checkpoints = {} + -- find capturable flag poles + for i = 64, 1021 do + if et.gentity_get(i, "classname") == "team_WOLF_checkpoint" then + table.insert(checkpoints,i) + end + end + -- complete config with default extracted values + local spawn = 1 + for i = 64, 1021 do + if et.gentity_get(i, "classname") == "team_WOLF_objective" then + local pos = et.gentity_get(i, "origin"); + if c.spawns[spawn] == nil then + c.spawns[spawn] = {} end + if c.spawns[spawn].name == nil then + c.spawns[spawn].name = et.gentity_get(i, "message") end + if c.spawns[spawn].pos == nil then + c.spawns[spawn].pos = et.gentity_get(i, "origin") end + if c.spawns[spawn].state == nil then + local iscapturable = false + for k,v in pairs(checkpoints) do + local cp = et.gentity_get(v, "origin") + if(calcDist(c.spawns[spawn].pos, cp) <= + maxcheckpointdist) then + iscapturable = true + end + end + if iscapturable then + c.spawns[spawn].state = NO_PROTECT + else + c.spawns[spawn].state = et.G_GetSpawnVar(i, "spawnflags") + end + end + if c.spawns[spawn].radius1 == nil then + c.spawns[spawn].radius1 = ETWsk_defaultradius1 end + if c.spawns[spawn].radius2 == nil then + c.spawns[spawn].radius2 = ETWsk_defaultradius2 end + spawn = spawn + 1 + end + end + -- auto complete spawns + for i,spawn in pairs(c.spawns) do + if spawn.radius1 == nil then + spawn.radius1 = ETWsk_defaultradius1 end + if spawn.radius2 == nil then + spawn.radius2 = ETWsk_defaultradius2 end + end + + readPO(ETWsk_pofile) +end + +-------------------------------------------------------------------------------- +-- called when something is printed on server console +function et_Print(text) +-------------------------------------------------------------------------------- + if(c == nil) then return end + for i,action in pairs(c.actions) do + if(string.find(text, action.trigger)) then + local msg + if action.newstate == NO_PROTECT then + msg = "is no longer protected!" + else msg = "is now protected!" + end + c.spawns[action.spawn].state = action.newstate + et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^1The ".. + c.spawns[action.spawn].name.." "..msg.."\n\"") +-- et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^1The ^4".. +-- c.spawns[action.spawn].name.." Spawn ^2"..msg.."\n\"") + + end + end +end + +-------------------------------------------------------------------------------- +-- called when client enters the game +function et_ClientBegin(cno) +-------------------------------------------------------------------------------- + -- reset spawnkills + spawnkills[cno] = nil +end + +-------------------------------------------------------------------------------- +-- called when client spawns +function et_ClientSpawn(cno, revived ) +-------------------------------------------------------------------------------- + if (hasconfig and revived == 0) then + damagegiven[cno] = et.gentity_get(cno, "sess.damage_given") + if(damagegiven[cno] == nil) then damagegiven[cno] = 0 end + end +end + +-------------------------------------------------------------------------------- +function et_ClientDisconnect( cno ) +-------------------------------------------------------------------------------- + if sinbinhash[cno] then + sinbinhash[cno] = nil -- reset + end +end + +-------------------------------------------------------------------------------- +function printSpawns(cno) +-------------------------------------------------------------------------------- + if not hasconfig then + et.trap_SendServerCommand(cno, + "print \"^3ATTENTION:^7 no config for this map!\n\"") + if ETWsk_savemode == 1 then + et.trap_SendServerCommand(cno, + "print \"^3ATTENTION: ^7 protection deactivated (savemode)!\n\"") + end + end + local protect = {} + protect[0] = "NO_PROTECT" + protect[1] = "^1PROTECT_AXIS" + protect[2] = "^4PROTECT_ALLIES" + if cno >= 0 then + et.trap_SendServerCommand(cno, + "print \"^3ATTENTION:^7 Mapname: ^3"..mapname.."\n\"") + end + for i,spawn in pairs(c.spawns) do + if cno == -1 then et.G_Printf( + "ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state]) + else et.trap_SendServerCommand(cno, "print \"^3ATTENTION:^7 Spawn ^3".. + i.."^7 "..spawn.name.." "..protect[spawn.state].."\n\"") + end + end +end + +-------------------------------------------------------------------------------- +function printPos(cno) +-------------------------------------------------------------------------------- + local pos = et.gentity_get(cno, "r.currentOrigin") + local spos = string.format('%.2f, %.2f, %.2f', + table.unpack(pos)) + et.trap_SendServerCommand(cno, + "print \"^3ATTENTION:^7 current pos: "..spos.."\n\"") + local team = et.gentity_get(cno, "sess.sessionTeam") + local protect_normal = "^2protected_normal" + local protect_heavy = "^2protected_heavy_only" + for i,spawn in pairs(c.spawns) do + local protect = "^1not protected" + if spawn.state == team then + local dist = calcDist(pos, spawn.pos) + if dist < spawn.radius1 then + protect = protect_normal + elseif dist < spawn.radius2 then + protect = protect_heavy + end + et.trap_SendServerCommand(cno, string.format( + "print \"^3ATTENTION:^7 spawn ^3%d (%s): %s ^7distance: %.2f \n\"", + i, spawn.name, protect, dist)) + end + end +end + +-------------------------------------------------------------------------------- +function printStats(cno) +-------------------------------------------------------------------------------- + et.trap_SendServerCommand(cno, "print \"^3ATTENTION: ^7v"..module_version .. + " spawnkill protection by ^2[^4ETW^2-^4FZ^2] ^4Mad^2@^4Mat^7.\n\"") + for killer,kills in pairs(spawnkills) do + local killername = + et.Info_ValueForKey(et.trap_GetUserinfo(killer), "name") + et.trap_SendServerCommand(cno, + "print \" "..kills.." SKs: "..killername.."\n\"") + end +end + +-------------------------------------------------------------------------------- +-- called when someone has been killed +function et_Obituary(victim, killer, meansOfDeath) +-------------------------------------------------------------------------------- + -- same team + -- et.trap_SendServerCommand(-1, "print \"SK: "..victim.." "..killer.."\n\"") + -- warmup fix, n00b! benny + if tonumber(et.trap_Cvar_Get("gamestate")) ~= 0 then return end + + local vteam = et.gentity_get(victim, "sess.sessionTeam") + + -- IlDuca - fix: check if the killer is a real player or if it's something else... + if ( et.gentity_get( killer, "s.number" ) < tonumber( et.trap_Cvar_Get( "sv_maxClients" )) ) then + if( vteam == et.gentity_get(killer, "sess.sessionTeam")) then + return + end + else + return + end + + -- protection expired ? + if ETWsk_expires == 1 then + local vdg = 0 + vdg = et.gentity_get(victim, "sess.damage_given") + -- et.G_Printf("vdg = %d, dg = %d\n", vdg, damagegiven[victim]) + if(vdg ~= nil and vdg > damagegiven[victim]) then return end + end + -- was heavyweapon? + local isheavy = false + for k,v in pairs(heavyweapons) do + if (meansOfDeath == v) then isheavy = true end + end + -- protected spawn? + local vpos = et.gentity_get(victim, "r.currentOrigin") + local isprotected = false + local dist2 + local radius2 + for i,spawn in pairs(c.spawns) do + if spawn.state == vteam then + if(isheavy) then + radius2 = spawn.radius2 + else + radius2 = spawn.radius1 + end + dist = calcDist(vpos, spawn.pos) + if(dist < radius2) then + ClientSpawnkill(victim, killer, isheavy) + end + end + end +end + +-------------------------------------------------------------------------------- +-- called when ETWsk has detected a spawnkill +function ClientSpawnkill(victim, killer, isheavy) +-------------------------------------------------------------------------------- + if killer < 0 or (ETWsk_savemode == 1 and not hasconfig) then return end + + local killername = et.Info_ValueForKey(et.trap_GetUserinfo(killer), "name") + + if spawnkills[killer] == nil then spawnkills[killer] = 0 end + + spawnkills[killer] = spawnkills[killer] + 1 + local numsk = spawnkills[killer] + + -- he has been kicked before + if numsk >= ETWsk_POThreshold then + local kicksb4 = isPO(killer) + + if kicksb4 > 0 then + et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick "..(killer + 1).. + " "..(ETWsk_banval * math.pow(1,kicksb4)).." \"temp ban - "..kicksb4.. + " former kicks for spawn killing!\"\n") + et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^7"..killername.. + " ^2has been temp banned - repeated spawn killing!\"\n") + spawnkills[killer] = nil + addPO (killer) + savePO(ETWsk_pofile) + return + end + end + + et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^1WARNING: ^2Spawn kill (#".. + numsk..") by ^7"..killername.."\"\n" ) + et.trap_SendServerCommand(killer, "cp \""..killername.." : ^1DO NOT SPAWN KILL!!! \"\n") + + if(numsk >= ETWsk_putspec and numsk < ETWsk_kick) then + et.trap_SendConsoleCommand(et.EXEC_APPEND, putspec(killer)) + sinbinhash[killer] = et.trap_Milliseconds() + sinbin_duration + et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^7"..killername.. + " ^2was set to Spectators - too many Spawnkills!\"\n") + et.trap_SendServerCommand( killer, + "b 8 \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") + elseif(numsk == ETWsk_kick) then + et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick "..(killer + 1).. + " "..ETWsk_kicklen.." \"too many spawn kills!\"\n") + et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^7"..killername.. + " ^2has been kicked - too many spawn kills!\"\n") + addPO(killer) + savePO(ETWsk_pofile) + elseif(numsk > ETWsk_kick) then + -- do nothing you dumb shit + else + et.gentity_set(killer, "health", -511) + end + +end + +-------------------------------------------------------------------------------- +-- printf wrapper +function et.G_Printf(...) +-------------------------------------------------------------------------------- + et.G_Print(string.format(table.unpack(arg))) +end + +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- persistent offenders stuff +function isPO (cno) + local guid = string.lower(et.Info_ValueForKey(et.trap_GetUserinfo(cno), "cl_guid")) + if pohash[guid] then + return pohash[guid] + end + return 0 +end + +function addPO (cno) -- unreliable shit + local guid = string.lower(et.Info_ValueForKey(et.trap_GetUserinfo(cno), "cl_guid")) + if string.find(guid, "[^%x]") or string.len(guid) ~= 32 then return end + if pohash[guid] then + pohash[guid] = pohash[guid] + 1 + else + pohash[guid] = 1 + end +end + +function readPO (file) + local fd,len = et.trap_FS_FOpenFile( file, et.FS_READ ) + local count = 0 + if len > -1 then + local filestr = et.trap_FS_Read(fd, len) + for guid, kicks in string.gmatch(filestr,"[^%#](%x+)%s(%d+)%;") do + if not string.find(guid, "[^%x]") and string.len(guid) == 32 then + pohash[string.lower(guid)] = tonumber(kicks) + count = count + 1 + end + end + filestr = nil + et.trap_FS_FCloseFile(fd) + else + et.G_LogPrint("ETWsk failed to open " .. file .. "\n") + return + end + et.G_LogPrint("ETWsk loaded "..count.." persistent spawn killers.\n") +end + +function savePO (file) + local count = 0 + local fd, len = et.trap_FS_FOpenFile(file, et.FS_WRITE) + if len == -1 then + et.G_LogPrint("ETWsk failed to open " .. file .. "\n") + return(0) + end + local head = string.format( + "# %s, written %s\n# to reload this file do a 'etwskread' via rcon/screen!\n", + file, os.date() + ) + et.trap_FS_Write(head, string.len(head), fd) + for guid, kicks in pairs(pohash) do + local line = guid.." "..kicks..";\n" + et.trap_FS_Write(line, string.len(line), fd) + count = count + 1 + end + et.trap_FS_FCloseFile(fd) + et.G_LogPrint("ETWsk saved "..count.." persistent spawn killers.\n") +end +-------------------------------------------------------------------------------- + + +-------------------------------------------------------------------------------- +-- et_ShutdownGame +function et_ShutdownGame( restart ) +-------------------------------------------------------------------------------- + savePO(ETWsk_pofile) +end + + + +-------------------------------------------------------------------------------- +-- et_ConsoleCommand +function et_ConsoleCommand() +-------------------------------------------------------------------------------- + if et.trap_Argv(0) == "etwskread" then + pohash = {} + readPO(ETWsk_pofile) + return 1 + end + return 0 +end From 9a94d53c5864b6d71e77ded3d5f3922655492a16 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 13 Dec 2022 17:54:58 +0100 Subject: [PATCH 13/71] Update ETWsk.lua --- ETWsk.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ETWsk.lua b/ETWsk.lua index 7ae61e6..892ee03 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -77,7 +77,7 @@ function putspec(id) end putspec_str = "ref remove %d\n" -heavyweapons = {1, 2, 3, 15, 17, 23, 26, 44, 52} -- heavy weapon indexes +heavyweapons = {1, 2, 3, 15, 17, 23, 26, 44, 52, 62, 63, 64} -- heavy weapon indexes maxcheckpointdist = 800 -- used to detect capturable flag poles -------------------------------------------------------------------------------- From b9d37c18d9e34ff86efddbed57ec5bd83762f7b7 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 13 Dec 2022 21:03:19 +0100 Subject: [PATCH 14/71] Update endstats.lua --- endstats.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/endstats.lua b/endstats.lua index 85ee43f..c3adf1a 100644 --- a/endstats.lua +++ b/endstats.lua @@ -807,17 +807,17 @@ function et_Obituary(victim, killer, mod) topshots[killer][9] = topshots[killer][9] + 1 end -- most panzer kills/deaths - if mod == 15 then + if mod == 15 or mod == 64 then topshots[killer][10] = topshots[killer][10] + 1 topshots[victim][12] = topshots[victim][12] + 1 end -- most mortar kills/deaths - if mod == 52 then + if mod == 52 or mod == 63 then topshots[killer][11] = topshots[killer][11] + 1 topshots[victim][13] = topshots[victim][13] + 1 end -- most mg42 kills/deaths - if mod == 1 or mod == 2 or mod == 3 or mod == 44 then + if mod == 1 or mod == 2 or mod == 3 or mod == 44 or mod == 62 then topshots[killer][18] = topshots[killer][18] + 1 topshots[victim][19] = topshots[victim][19] + 1 end From 10f8454120de27822161d32af6a0190341efb16c Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 14 Dec 2022 00:56:21 +0100 Subject: [PATCH 15/71] Update ETWsk.lua --- ETWsk.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index 892ee03..f13580d 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -801,9 +801,9 @@ function et_Print(text) else msg = "is now protected!" end c.spawns[action.spawn].state = action.newstate - et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^1The ".. + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^1The ".. c.spawns[action.spawn].name.." "..msg.."\n\"") --- et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^1The ^4".. +-- et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^1The ^4".. -- c.spawns[action.spawn].name.." Spawn ^2"..msg.."\n\"") end @@ -977,7 +977,7 @@ function ClientSpawnkill(victim, killer, isheavy) et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick "..(killer + 1).. " "..(ETWsk_banval * math.pow(1,kicksb4)).." \"temp ban - "..kicksb4.. " former kicks for spawn killing!\"\n") - et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^7"..killername.. + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2has been temp banned - repeated spawn killing!\"\n") spawnkills[killer] = nil addPO (killer) @@ -986,21 +986,21 @@ function ClientSpawnkill(victim, killer, isheavy) end end - et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^1WARNING: ^2Spawn kill (#".. + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^1WARNING: ^2Spawn kill (#".. numsk..") by ^7"..killername.."\"\n" ) et.trap_SendServerCommand(killer, "cp \""..killername.." : ^1DO NOT SPAWN KILL!!! \"\n") if(numsk >= ETWsk_putspec and numsk < ETWsk_kick) then et.trap_SendConsoleCommand(et.EXEC_APPEND, putspec(killer)) sinbinhash[killer] = et.trap_Milliseconds() + sinbin_duration - et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^7"..killername.. + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2was set to Spectators - too many Spawnkills!\"\n") et.trap_SendServerCommand( killer, "b 8 \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") elseif(numsk == ETWsk_kick) then et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick "..(killer + 1).. " "..ETWsk_kicklen.." \"too many spawn kills!\"\n") - et.trap_SendServerCommand(-1, "cpm \"^3ATTENTION: ^7"..killername.. + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2has been kicked - too many spawn kills!\"\n") addPO(killer) savePO(ETWsk_pofile) From 64a9a3b1326d030cd140ca4d8d1008124b40dd86 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Thu, 15 Dec 2022 11:55:54 +0100 Subject: [PATCH 16/71] Update endstats.lua --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index c3adf1a..28f0ef0 100644 --- a/endstats.lua +++ b/endstats.lua @@ -791,7 +791,7 @@ function et_Obituary(victim, killer, mod) topshots[killer][5] = topshots[killer][5] + 1 end -- most knife kills - if mod == 5 then + if mod == 5 or mod == 65 then topshots[killer][6] = topshots[killer][6] + 1 end -- most air support kills From 97a5f0f8c64fea1a0179e61e72519c02c28b31c9 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 16 Dec 2022 18:21:33 +0100 Subject: [PATCH 17/71] Update objtrack.lua --- objtrack.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index 33d7e56..9e43232 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -866,12 +866,12 @@ function et_Print(text) et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the ^1Book of Death^7!\"\n") else if third_obj == false then - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the First Sacrifice (Shoe)!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the First Sacrificial Armor piece (Shoe)!\"\n") else if fourth_obj == false then - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Second Sacrifice (Chest)!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Second Sacrificial Armor piece (Chest)!\"\n") else - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Third Sacrifice (Sword)!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the Third Sacrificial Armor piece (Sword)!\"\n") end end end @@ -880,12 +880,12 @@ function et_Print(text) et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the ^1Book of Death^7!\"\n") else if third_obj == false then - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the First Sacrifice (Shoe)!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the First Sacrificial Armor piece (Shoe)!\"\n") else if fourth_obj == false then - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Second Sacrifice (Chest)!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Second Sacrificial Armor piece (Chest)!\"\n") else - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Third Sacrifice (Sword)!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the Third Sacrificial Armor piece (Sword)!\"\n") end end end From ce978593d2ad78e668dcaeba5140ecfc5788168a Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 20 Dec 2022 10:34:35 +0100 Subject: [PATCH 18/71] Update objtrack.lua --- objtrack.lua | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index 9e43232..dd37660 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -830,29 +830,6 @@ function et_Print(text) end end -- end warbell - --if mapname == "etl_warbell" then - --if(string.find(text, "team_CTF_blueflag")) then - --local i, j = string.find(text, "%d+") - --local id = tonumber(string.sub(text, i, j)) - --local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) - --local name = et.gentity_get(id, "pers.netname") - --if team == 1 then - --objcarriers[id] = true - --table.insert(objcarriers_id, id) - --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the ^1Book of Death^7!\"\n") - --elseif team == 2 then - --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the ^1Book of Death^7!\"\n") - --end - --end - --if(string.find(text, "Axis have delivered the Book of Death")) then - --local name = et.gentity_get(objcarriers_id[1], "pers.netname") - --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the ^1Book of Death^7!\"\n") - --objcarriers[objcarriers_id[1]] = nil - --table.remove(objcarriers_id, 1) - --end - --end -- end etl_warbell - - -- etl_warbell alternate script if mapname == "etl_warbell" then if(string.find(text, "team_CTF_blueflag")) then local i, j = string.find(text, "%d+") @@ -918,7 +895,7 @@ function et_Print(text) objcarriers[objcarriers_id[1]] = nil table.remove(objcarriers_id, 1) end - end -- end etl_warbell alternate script + end -- end etl_warbell end function et_Obituary(victim, killer, mod) From 3b02e11ab2107043c85661f7470a34b823383aa5 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 10 Jan 2023 17:45:36 +0100 Subject: [PATCH 19/71] Add files via upload --- ETWsk.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index f13580d..9c6109a 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -974,9 +974,7 @@ function ClientSpawnkill(victim, killer, isheavy) local kicksb4 = isPO(killer) if kicksb4 > 0 then - et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick "..(killer + 1).. - " "..(ETWsk_banval * math.pow(1,kicksb4)).." \"temp ban - "..kicksb4.. - " former kicks for spawn killing!\"\n") + et.trap_DropClient(killer, "temp ban - "..kicksb4.." former kicks for spawn killing!", (ETWsk_banval * math.pow(1,kicksb4))) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2has been temp banned - repeated spawn killing!\"\n") spawnkills[killer] = nil @@ -998,8 +996,7 @@ function ClientSpawnkill(victim, killer, isheavy) et.trap_SendServerCommand( killer, "b 8 \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") elseif(numsk == ETWsk_kick) then - et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick "..(killer + 1).. - " "..ETWsk_kicklen.." \"too many spawn kills!\"\n") + et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2has been kicked - too many spawn kills!\"\n") addPO(killer) From f803d5fb0cb8cf8c825100422e97f0129d9fa498 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Thu, 2 Feb 2023 18:26:08 +0100 Subject: [PATCH 20/71] Add files via upload --- objtrack.lua | 205 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 157 insertions(+), 48 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index dd37660..48faa83 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -426,7 +426,68 @@ function et_Print(text) end end -- end pirates - if mapname == "karsiah_te2" then + --if mapname == "karsiah_te2" then + --if(string.find(text, "team_CTF_redflag")) then + --local i, j = string.find(text, "%d+") + --local id = tonumber(string.sub(text, i, j)) + --local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + --local name = et.gentity_get(id, "pers.netname") + --if team == 2 then + --objcarriers[id] = true + --table.insert(objcarriers_id, id) + --if firstflag == true then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the South Documents!\"\n") + --elseif secondflag == true then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the North Documents!\"\n") + --else + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole a stack of Documents!\"\n") + --end + --elseif team == 1 then + --if firstflag == true then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the South Documents!\"\n") + --elseif secondflag == true then + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the North Documents!\"\n") + --else + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a stack of Documents\"\n") + --end + --end + --end + --if(string.find(text, "Allies have transmitted the North Documents")) then + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers[objcarriers_id[x]] == true then + --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + --if redflag == 0 then + --local name = et.gentity_get(objcarriers_id[x], "pers.netname") + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the North Documents!\"\n") + --objcarriers[objcarriers_id[x]] = nil + --table.remove(objcarriers_id, x) + --end + --end + --x = x + 1 + --end + --firstflag = true + --end + --if(string.find(text, "Allies have transmitted the South Documents")) then + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers[objcarriers_id[x]] == true then + --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + --if redflag == 0 then + --local name = et.gentity_get(objcarriers_id[x], "pers.netname") + --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the South Documents!\"\n") + --objcarriers[objcarriers_id[x]] = nil + --table.remove(objcarriers_id, x) + --end + --end + --x = x + 1 + --end + --secondflag = true + --end + --end -- end karsiah_te2 + + -- karsiah_te2 alternate script (karsiah_te3) + if (string.find(mapname, "karsiah_te2")) then if(string.find(text, "team_CTF_redflag")) then local i, j = string.find(text, "%d+") local id = tonumber(string.sub(text, i, j)) @@ -435,56 +496,70 @@ function et_Print(text) if team == 2 then objcarriers[id] = true table.insert(objcarriers_id, id) - if firstflag == true then - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the South Documents!\"\n") - elseif secondflag == true then + if second_obj == false then et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the North Documents!\"\n") else - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole a stack of Documents!\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the South Documents!\"\n") end elseif team == 1 then - if firstflag == true then + if second_obj == true then et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the South Documents!\"\n") - elseif secondflag == true then - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the North Documents!\"\n") else - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned a stack of Documents\"\n") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the North Documents!\"\n") end end end if(string.find(text, "Allies have transmitted the North Documents")) then - local x = 1 - for index in pairs(objcarriers_id) do - if objcarriers[objcarriers_id[x]] == true then - local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) - if redflag == 0 then - local name = et.gentity_get(objcarriers_id[x], "pers.netname") - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the North Documents!\"\n") - objcarriers[objcarriers_id[x]] = nil - table.remove(objcarriers_id, x) - end - end - x = x + 1 - end - firstflag = true + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the North Documents!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + second_obj = true end if(string.find(text, "Allies have transmitted the South Documents")) then - local x = 1 - for index in pairs(objcarriers_id) do - if objcarriers[objcarriers_id[x]] == true then - local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) - if redflag == 0 then - local name = et.gentity_get(objcarriers_id[x], "pers.netname") - et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the South Documents!\"\n") - objcarriers[objcarriers_id[x]] = nil - table.remove(objcarriers_id, x) - end + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the South Documents!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end karsiah_te2 alternate script (karsiah_te3) + + if (string.find(mapname, "karsiah_te3")) then + if(string.find(text, "team_CTF_redflag")) then + local i, j = string.find(text, "%d+") + local id = tonumber(string.sub(text, i, j)) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + local name = et.gentity_get(id, "pers.netname") + if team == 2 then + objcarriers[id] = true + table.insert(objcarriers_id, id) + if second_obj == false then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the North Documents!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7stole the South Documents!\"\n") + end + elseif team == 1 then + if second_obj == true then + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the South Documents!\"\n") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7returned the North Documents!\"\n") end - x = x + 1 end - secondflag = true end - end -- end karsiah_te2 + if(string.find(text, "Allies have transmitted the North Documents")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the North Documents!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + second_obj = true + end + if(string.find(text, "Allies have transmitted the South Documents")) then + local name = et.gentity_get(objcarriers_id[1], "pers.netname") + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the South Documents!\"\n") + objcarriers[objcarriers_id[1]] = nil + table.remove(objcarriers_id, 1) + end + end -- end karsiah_te3 if mapname == "et_ufo_final" then if(string.find(text, "team_CTF_redflag")) then @@ -987,16 +1062,33 @@ function et_Obituary(victim, killer, mod) x = x + 1 end end + + --if mapname == "karsiah_te2" then + --objcarriers[victim] = nil + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers_id[x] == victim then + --table.remove(objcarriers_id, x) + --end + --x = x + 1 + --end + --end + + -- karsiah_te2 alternate script (karsiah_te3) if mapname == "karsiah_te2" then objcarriers[victim] = nil - local x = 1 - for index in pairs(objcarriers_id) do - if objcarriers_id[x] == victim then - table.remove(objcarriers_id, x) - end - x = x + 1 + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) + end + end + + if mapname == "karsiah_te3" then + objcarriers[victim] = nil + if objcarriers_id[1] == victim then + table.remove(objcarriers_id, 1) end end + if mapname == "et_ufo_final" then doccarriers[victim] = nil if doccarriers_id[1] == victim then @@ -1167,16 +1259,33 @@ function et_ClientDisconnect(i) x = x + 1 end end + + --if mapname == "karsiah_te2" then + --objcarriers[i] = nil + --local x = 1 + --for index in pairs(objcarriers_id) do + --if objcarriers_id[x] == i then + --table.remove(objcarriers_id, x) + --end + --x = x + 1 + --end + --end + + -- karsiah_te2 alternate script (karsiah_te3) if mapname == "karsiah_te2" then objcarriers[i] = nil - local x = 1 - for index in pairs(objcarriers_id) do - if objcarriers_id[x] == i then - table.remove(objcarriers_id, x) - end - x = x + 1 + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) + end + end + + if mapname == "karsiah_te3" then + objcarriers[i] = nil + if objcarriers_id[1] == i then + table.remove(objcarriers_id, 1) end end + if mapname == "et_ufo_final" then doccarriers[i] = nil if doccarriers_id[1] == i then From 5068ee8caf8a64c2b79a21a478d64b0e73649ebe Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sat, 11 Feb 2023 18:05:52 +0100 Subject: [PATCH 21/71] Update endstats.lua --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index 28f0ef0..a49b262 100644 --- a/endstats.lua +++ b/endstats.lua @@ -803,7 +803,7 @@ function et_Obituary(victim, killer, mod) topshots[killer][8] = topshots[killer][8] + 1 end -- most grenade kills - if mod == 16 then + if mod == 16 or mod == 18 then topshots[killer][9] = topshots[killer][9] + 1 end -- most panzer kills/deaths From bc7513c448ac0c4bdf73ba99bf15e703818c69aa Mon Sep 17 00:00:00 2001 From: x0rnn Date: Thu, 2 Mar 2023 10:59:44 +0100 Subject: [PATCH 22/71] Update endstats.lua --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index a49b262..47d3a83 100644 --- a/endstats.lua +++ b/endstats.lua @@ -768,7 +768,7 @@ function et_Obituary(victim, killer, mod) checkDSpreeEnd(killer) -- most lightweapons kills - if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 then + if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 or mod=66 then -- most pistol kills if mod==6 or mod==7 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 then topshots[killer][2] = topshots[killer][2] + 1 From e3c3c1452094c57ba8272f2bc3a7055f54989e57 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 10 Mar 2023 11:55:05 +0100 Subject: [PATCH 23/71] Add files via upload --- ETWsk.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ETWsk.lua b/ETWsk.lua index 9c6109a..a5e9d30 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -994,7 +994,7 @@ function ClientSpawnkill(victim, killer, isheavy) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2was set to Spectators - too many Spawnkills!\"\n") et.trap_SendServerCommand( killer, - "b 8 \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") + "bp \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") elseif(numsk == ETWsk_kick) then et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. From 639fefcea571a638813860c652412a3984508e17 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 13 Mar 2023 10:19:41 +0100 Subject: [PATCH 24/71] Update suddendeath.lua --- suddendeath.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suddendeath.lua b/suddendeath.lua index e5659ba..87eeaff 100644 --- a/suddendeath.lua +++ b/suddendeath.lua @@ -34,7 +34,7 @@ COLOR.PLACE = '^8' COLOR.TEXT = '^w' COLOR.TIME = '^8' -- this constat is changing in the print_message() function -CHAT = "chat" +CHAT = "bp" POPUP = "legacy" timer = {} From 08c601217e674a69fd88379c7165a62db6a83d03 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 14 Mar 2023 11:01:12 +0100 Subject: [PATCH 25/71] Add files via upload --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index 47d3a83..0c3a5aa 100644 --- a/endstats.lua +++ b/endstats.lua @@ -791,7 +791,7 @@ function et_Obituary(victim, killer, mod) topshots[killer][5] = topshots[killer][5] + 1 end -- most knife kills - if mod == 5 or mod == 65 then + if mod == 5 or mod == 61 or mod == 65 then topshots[killer][6] = topshots[killer][6] + 1 end -- most air support kills From 030b0d4c1753b7e6ff2df5483c64d7cbddfc091f Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 9 Apr 2023 14:37:34 +0200 Subject: [PATCH 26/71] Update endstats.lua --- endstats.lua | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/endstats.lua b/endstats.lua index 0c3a5aa..c3d2e9b 100644 --- a/endstats.lua +++ b/endstats.lua @@ -39,21 +39,17 @@ function et_InitGame(levelTime, randomSeed, restart) death_sprees[i] = 0 kmulti[i] = { [1]=0, [2]=0, } topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0 } + vsstats[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_kills[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_deaths[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + worst_enemy[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + easiest_prey[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} mkps[i] = { [1]=0, [2]=0, [3]=0 } axis_time[i] = 0 allies_time[i] = 0 kills[i] = 0 deaths[i] = 0 end - - local j = 0 - for j=0,sv_maxclients-1 do - vsstats[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - vsstats_kills[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - vsstats_deaths[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - worst_enemy[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - easiest_prey[j]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - end end function n2b(number) -- thanks to adawolfa From 2ba71fe08f57909794e9226a7f1ef0ad6d166d7f Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 9 Apr 2023 16:17:58 +0200 Subject: [PATCH 27/71] Update ETWsk.lua --- ETWsk.lua | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index a5e9d30..b1f9633 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -852,14 +852,11 @@ function printSpawns(cno) protect[1] = "^1PROTECT_AXIS" protect[2] = "^4PROTECT_ALLIES" if cno >= 0 then - et.trap_SendServerCommand(cno, - "print \"^3ATTENTION:^7 Mapname: ^3"..mapname.."\n\"") + et.trap_SendServerCommand(cno,"chat \"^3ATTENTION:^7 Mapname: ^3"..mapname.."\n\"") end for i,spawn in pairs(c.spawns) do - if cno == -1 then et.G_Printf( - "ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state]) - else et.trap_SendServerCommand(cno, "print \"^3ATTENTION:^7 Spawn ^3".. - i.."^7 "..spawn.name.." "..protect[spawn.state].."\n\"") + if cno == -1 then et.G_Print("ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state]) + else et.trap_SendServerCommand(cno, "chat \"^3ATTENTION:^7 Spawn ^3"..i.."^7 "..spawn.name.." "..protect[spawn.state].."\n\"") end end end @@ -1009,13 +1006,6 @@ function ClientSpawnkill(victim, killer, isheavy) end --------------------------------------------------------------------------------- --- printf wrapper -function et.G_Printf(...) --------------------------------------------------------------------------------- - et.G_Print(string.format(table.unpack(arg))) -end - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- From 3456739efff0e3cb63303856fb8afdebad733291 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 9 Apr 2023 18:12:17 +0200 Subject: [PATCH 28/71] Add files via upload --- endstats.lua | 362 +++++++++++++++++++++++++++++++----------------- killassists.lua | 240 ++++++++++++++++++++++++++++++++ 2 files changed, 474 insertions(+), 128 deletions(-) create mode 100644 killassists.lua diff --git a/endstats.lua b/endstats.lua index c3d2e9b..6d6cad5 100644 --- a/endstats.lua +++ b/endstats.lua @@ -1,4 +1,5 @@ -- endstats.lua by x0rnn, shows some interesting game statistics at the end of a round (highest light weapon acc, highest hs acc, most dynamites planted, most pistol kills, kill/death stats vs. all opponents, etc.) +-- shows kill assist information upon death (who all shot you, how much HP they took and how many HS they made) killing_sprees = {} death_sprees = {} @@ -25,8 +26,17 @@ easiest_prey = {} vsstats = {} vsstats_kills = {} vsstats_deaths = {} +hitters = {} +assist_weapons = {1,2,3,6,7,8,9,10,11,12,13,14,17,37,38,44,45,46,50,51,53,54,55,56,62,66} +HR_HEAD = 0 +HR_ARMS = 1 +HR_BODY = 2 +HR_LEGS = 3 +HR_NONE = -1 +HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} +hitRegionsData = {} -topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned" } +topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals"} function et_InitGame(levelTime, randomSeed, restart) @@ -38,39 +48,21 @@ function et_InitGame(levelTime, randomSeed, restart) killing_sprees[i] = 0 death_sprees[i] = 0 kmulti[i] = { [1]=0, [2]=0, } - topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0 } - vsstats[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - vsstats_kills[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - vsstats_deaths[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - worst_enemy[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} - easiest_prey[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0} + vsstats[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_kills[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + vsstats_deaths[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + worst_enemy[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} + easiest_prey[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} mkps[i] = { [1]=0, [2]=0, [3]=0 } axis_time[i] = 0 allies_time[i] = 0 kills[i] = 0 deaths[i] = 0 + hitters[i] = {nil, nil, nil, nil} end end -function n2b(number) -- thanks to adawolfa - local bits = {} - - local i = 1 - while 2 ^ (i + 1) < number do - i = i + 1 - end - - while i >= 0 do - if 2 ^ i <= number then - table.insert(bits, 2 ^ i) - number = number - 2 ^ i - end - i = i - 1 - end - - return bits, #bits -end - local function roundNum(num, n) local mult = 10^(n or 0) return math.floor(num * mult + 0.5) / mult @@ -89,9 +81,55 @@ function getKeysSortedByValue(tbl, sortFunction) return keys end +function has_value (tab, val) + for index, value in ipairs(tab) do + if value == val then + return true + end + end + return false +end + +function getAllHitRegions(clientNum) + local regions = {} + for index, hitType in ipairs(HR_TYPES) do + regions[hitType] = et.gentity_get(clientNum, "pers.playerStats.hitRegions", hitType) + end + return regions +end + +function hitType(clientNum) + local playerHitRegions = getAllHitRegions(clientNum) + if hitRegionsData[clientNum] == nil then + hitRegionsData[clientNum] = playerHitRegions + return 2 + end + for index, hitType in ipairs(HR_TYPES) do + if playerHitRegions[hitType] > hitRegionsData[clientNum][hitType] then + hitRegionsData[clientNum] = playerHitRegions + return hitType + end + end + hitRegionsData[clientNum] = playerHitRegions + return -1 +end + +function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then + if has_value(assist_weapons, meansOfDeath) then + local hitType = hitType(attacker) + if hitType == HR_HEAD then + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=1} + else + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=0} + end + end + end +end + function topshots_f(id) - local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} local i = 0 for i=0, sv_maxclients-1 do local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) @@ -104,6 +142,7 @@ function topshots_f(id) local sk = tonumber(et.gentity_get(i, "sess.self_kills")) local d = tonumber(et.gentity_get(i, "sess.deaths")) local k = tonumber(et.gentity_get(i, "sess.kills")) + local gibs = tonumber(et.gentity_get(i, "sess.gibs")) local kd = 0 if d ~= 0 then kd = k/d @@ -318,6 +357,21 @@ function topshots_f(id) max[37] = topshots[i][28] max_id[37] = i end + -- most gibs + if gibs > max[38] then + max[38] = gibs + max_id[38] = i + end + --most kill assists + if topshots[i][29] > max[39] then + max[39] = topshots[i][29] + max_id[39] = i + end + --most killsteals + if topshots[i][30] > max[40] then + max[40] = topshots[i][30] + max_id[40] = i + end end end if id == -2 then @@ -354,7 +408,7 @@ function topshots_f(id) end local j = 1 local players = {} - for j=1, 37 do + for j=1, 40 do if max[j] > 1 then if j ~= 10 and j ~= 25 and j ~= 33 then if j == 8 then @@ -560,82 +614,27 @@ function et_Print(text) if kendofmap and string.find(text, "^WeaponStats: ") == 1 then if endplayerscnt < tblcount then - for id, m, bla in string.gmatch(text, "WeaponStats: ([%d]+) [%d]+ ([%d]+) ([^\n]+)") do + for id in string.gmatch(text, "WeaponStats: ([%d]+)[^\n]+") do if endplayers[tonumber(id)] then if weaponstats[tonumber(id)] == nil then endplayerscnt = endplayerscnt + 1 - if tonumber(m)~=0 and tonumber(m)~=1 and tonumber(m)~=2 and tonumber(m)~=4 and tonumber(m)~=8 and tonumber(m)~=16 and tonumber(m)~=32 and tonumber(m)~=64 and tonumber(m)~=128 and tonumber(m)~=256 and tonumber(m)~=512 and tonumber(m)~=1024 and tonumber(m)~=2048 and tonumber(m)~=4096 and tonumber(m)~=8192 and tonumber(m)~=16384 and tonumber(m)~=32768 and tonumber(m)~=65536 and tonumber(m)~=131072 and tonumber(m)~=262144 and tonumber(m)~=524288 and tonumber(m)~=1048576 and tonumber(m)~=2097152 then - bits, bits_len = n2b(tonumber(m)) - local j = 1 - local knife = false - local w = 0 - for j = 1,bits_len do - if bits[j] == 1 or bits[j] == 2 or bits[j] == 4 or bits[j] == 8 or bits[j] == 16 or bits[j] == 32 then - if bits[j] == 1 then - knife = true - else - w = w + 1 - end - end - end - if w ~= 0 then - if knife == true then - if w == 1 then - for hits, shots, hs in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits), [2]=tonumber(shots), [3]=tonumber(hs) } - end - elseif w == 2 then - for hits1,shots1,hs1,hits2,shots2,hs2 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2), [2]=tonumber(shots1)+tonumber(shots2), [3]=tonumber(hs1)+tonumber(hs2) } - end - elseif w == 3 then - for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3) } - end - elseif w == 4 then - for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4) } - end - elseif w == 5 then - for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4,hits5,shots5,hs5 in string.gmatch(bla, "[%d]+ [%d]+ [%d]+ [%d]+ [%d]+ ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4)+tonumber(hits5), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4)+tonumber(shots5), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4)+tonumber(hs5) } - end - end - else - if w == 1 then - for hits, shots, hs in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits), [2]=tonumber(shots), [3]=tonumber(hs) } - end - elseif w == 2 then - for hits1,shots1,hs1,hits2,shots2,hs2 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2), [2]=tonumber(shots1)+tonumber(shots2), [3]=tonumber(hs1)+tonumber(hs2) } - end - elseif w == 3 then - for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3) } - end - elseif w == 4 then - for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4) } - end - elseif w == 5 then - for hits1,shots1,hs1,hits2,shots2,hs2,hits3,shots3,hs3,hits4,shots4,hs4,hits5,shots5,hs5 in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) ([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits1)+tonumber(hits2)+tonumber(hits3)+tonumber(hits4)+tonumber(hits5), [2]=tonumber(shots1)+tonumber(shots2)+tonumber(shots3)+tonumber(shots4)+tonumber(shots5), [3]=tonumber(hs1)+tonumber(hs2)+tonumber(hs3)+tonumber(hs4)+tonumber(hs5) } - end - end - end - else - weaponstats[tonumber(id)] = { [1]=0, [2]=0, [3]=0 } - end - else - if tonumber(m) == 2 or tonumber(m) == 4 or tonumber(m) == 8 or tonumber(m) == 16 or tonumber(m) == 32 then - for hits, shots, hs in string.gmatch(bla, "([%d]+) ([%d]+) [%d]+ [%d]+ ([%d]+) [^\n]+") do - weaponstats[tonumber(id)] = { [1]=tonumber(hits), [2]=tonumber(shots), [3]=tonumber(hs) } - end - else - weaponstats[tonumber(id)] = { [1]=0, [2]=0, [3]=0 } + local ws + local hits = 0 + local shots = 0 + local hs = 0 + for j = 2, 6 do + ws = et.gentity_get(tonumber(id), "sess.aWeaponStats", j) + hits = hits + ws[4] + shots = shots + ws[1] + hs = hs + ws[3] + if j == 6 then + ws = et.gentity_get(tonumber(id), "sess.aWeaponStats", 26) + hits = hits + ws[4] + shots = shots + ws[1] + hs = hs + ws[3] end end + weaponstats[tonumber(id)] = { [1]=hits, [2]=shots, [3]=hs } end end end @@ -723,6 +722,7 @@ function et_Obituary(victim, killer, mod) if gamestate == 0 then local v_teamid = et.gentity_get(victim, "sess.sessionTeam") local k_teamid = et.gentity_get(killer, "sess.sessionTeam") + if (victim == killer) then -- suicide if mod == 33 or mod == 59 then @@ -737,31 +737,32 @@ function et_Obituary(victim, killer, mod) deaths[victim] = deaths[victim] + 1 end - elseif (v_teamid == k_teamid) then -- team kill + else + if (v_teamid == k_teamid) then -- team kill - checkKSpreeEnd(victim) - killing_sprees[victim] = 0 - --death_sprees[victim] = death_sprees[victim] + 1 + checkKSpreeEnd(victim) + killing_sprees[victim] = 0 + --death_sprees[victim] = death_sprees[victim] + 1 - else -- nomal kill - if killer ~= 1022 and killer ~= 1023 then -- no world / unknown kills + else -- nomal kill + if killer ~= 1022 and killer ~= 1023 then -- no world / unknown kills - killing_sprees[killer] = killing_sprees[killer] + 1 - death_sprees[victim] = death_sprees[victim] + 1 + killing_sprees[killer] = killing_sprees[killer] + 1 + death_sprees[victim] = death_sprees[victim] + 1 - vsstats[killer][victim] = vsstats[killer][victim] + 1 - kills[killer] = kills[killer] + 1 - deaths[victim] = deaths[victim] + 1 - worst_enemy[victim][killer] = worst_enemy[victim][killer] + 1 - easiest_prey[killer][victim] = easiest_prey[killer][victim] + 1 - local posk = et.gentity_get(victim, "ps.origin") - local posv = et.gentity_get(killer, "ps.origin") - local killdist = dist(posk, posv) + vsstats[killer][victim] = vsstats[killer][victim] + 1 + kills[killer] = kills[killer] + 1 + deaths[victim] = deaths[victim] + 1 + worst_enemy[victim][killer] = worst_enemy[victim][killer] + 1 + easiest_prey[killer][victim] = easiest_prey[killer][victim] + 1 + local posk = et.gentity_get(victim, "ps.origin") + local posv = et.gentity_get(killer, "ps.origin") + local killdist = dist(posk, posv) - checkMultiKill(killer, mod) + checkMultiKill(killer, mod) - checkKSpreeEnd(victim) - checkDSpreeEnd(killer) + checkKSpreeEnd(victim) + checkDSpreeEnd(killer) -- most lightweapons kills if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 or mod=66 then @@ -817,14 +818,116 @@ function et_Obituary(victim, killer, mod) topshots[killer][18] = topshots[killer][18] + 1 topshots[victim][19] = topshots[victim][19] + 1 end - else - checkKSpreeEnd(victim) - if killer ~= 1022 then - death_sprees[victim] = death_sprees[victim] + 1 - end - end - killing_sprees[victim] = 0 - death_sprees[killer] = 0 + else + checkKSpreeEnd(victim) + if killer ~= 1022 then + death_sprees[victim] = death_sprees[victim] + 1 + end + end + killing_sprees[victim] = 0 + death_sprees[killer] = 0 + end + + if has_value(assist_weapons, mod) then + local names = "" + local killer_dmg = 0 + local killer_hs = 0 + local assist_dmg = {} + local assist_hs = {} + local ms = et.trap_Milliseconds() + for m=ms, ms-15000, -1 do + if hitters[victim][m] then + if hitters[victim][m][1] == killer then + killer_dmg = killer_dmg + hitters[victim][m][2] + killer_hs = killer_hs + hitters[victim][m][3] + else + if assist_dmg[hitters[victim][m][1]] == nil then + assist_dmg[hitters[victim][m][1]] = hitters[victim][m][2] + else + assist_dmg[hitters[victim][m][1]] = assist_dmg[hitters[victim][m][1]] + hitters[victim][m][2] + end + if assist_hs[hitters[victim][m][1]] == nil then + assist_hs[hitters[victim][m][1]] = hitters[victim][m][3] + else + assist_hs[hitters[victim][m][1]] = assist_hs[hitters[victim][m][1]] + hitters[victim][m][3] + end + end + end + end + local keyset={} + local n=0 + for k,v in pairs(assist_dmg) do + n=n+1 + keyset[n]=k + end + local max = 0 + local max_id = 0 + for j=1,#keyset do + if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") then + topshots[keyset[j]][29] = topshots[keyset[j]][29] + 1 + end + if assist_dmg[keyset[j]] > killer_dmg then + if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then + topshots[killer][30] = topshots[killer][30] + 1 + end + if assist_dmg[keyset[j]] > max then + max = assist_dmg[keyset[j]] + max_id = keyset[j] + end + end + local C + if et.gentity_get(keyset[j], "sess.sessionTeam") == 1 then + C = 1 + else + C = 4 + end + if names == "" then + if assist_hs[keyset[j]] == 0 then + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + end + else + if assist_hs[keyset[j]] == 0 then + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + end + end + end + if max > 0 then + if v_teamid ~= et.gentity_get(max_id, "sess.sessionTeam") and v_teamid ~= k_teamid then + et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") + et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") + end + end + local C + if k_teamid == 1 then + C = 1 + else + C = 4 + end + if v_teamid ~= k_teamid then + if names == "" then + if killer_hs == 0 then + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") + else + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + end + else + if killer_hs == 0 then + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + else + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS), " .. names .. "\";") + end + end + end + end + end end -- gamestate end @@ -879,12 +982,14 @@ function et_ClientSpawn(id, revived) allies_time[id] = 0 end end + hitters[id] = {nil, nil, nil, nil} + hitRegionsData[id] = getAllHitRegions(id) end function et_ClientDisconnect(id) killing_sprees[id] = 0 death_sprees[id] = 0 - topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0 } + topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0} axis_time[id] = 0 allies_time[id] = 0 mkps[id] = { [1]=0, [2]=0, [3]=0 } @@ -903,6 +1008,7 @@ function et_ClientDisconnect(id) vsstats_kills[j][id] = 0 vsstats_deaths[j][id] = 0 end + hitters[id] = {nil, nil, nil, nil} end --- Sends a nice table to a client. diff --git a/killassists.lua b/killassists.lua new file mode 100644 index 0000000..a3bc847 --- /dev/null +++ b/killassists.lua @@ -0,0 +1,240 @@ +hp_announce = true -- announce HP and distance of killer upon dying +hitters = {} +assists = {} +killsteals = {} +assist_weapons = {1,2,3,6,7,8,9,10,11,12,13,14,17,37,38,44,45,46,50,51,53,54,55,56,62,66} +HR_HEAD = 0 +HR_ARMS = 1 +HR_BODY = 2 +HR_LEGS = 3 +HR_NONE = -1 +HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} +hitRegionsData = {} + +function has_value (tab, val) + for index, value in ipairs(tab) do + if value == val then + return true + end + end + return false +end + +function et_InitGame(levelTime, randomSeed, restart) + et.RegisterModname("killassists.lua "..et.FindSelf()) + sv_maxclients = tonumber(et.trap_Cvar_Get("sv_maxclients")) + local j = 0 + for j=0,sv_maxclients-1 do + hitters[j] = {nil, nil, nil, nil} + assists[j] = 0 + killsteals[j] = 0 + end +end + +function getAllHitRegions(clientNum) + local regions = {} + for index, hitType in ipairs(HR_TYPES) do + regions[hitType] = et.gentity_get(clientNum, "pers.playerStats.hitRegions", hitType) + end + return regions +end + +function hitType(clientNum) + local playerHitRegions = getAllHitRegions(clientNum) + if hitRegionsData[clientNum] == nil then + hitRegionsData[clientNum] = playerHitRegions + return 2 + end + for index, hitType in ipairs(HR_TYPES) do + if playerHitRegions[hitType] > hitRegionsData[clientNum][hitType] then + hitRegionsData[clientNum] = playerHitRegions + return hitType + end + end + hitRegionsData[clientNum] = playerHitRegions + return -1 +end + +function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then + if has_value(assist_weapons, meansOfDeath) then + local hitType = hitType(attacker) + if hitType == HR_HEAD then + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=1} + else + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=0} + end + end + end +end + +function dist(a, b) + ax, ay, az = a[1], a[2], a[3] + bx, by, bz = b[1], b[2], b[3] + dx = math.abs(bx - ax) + dy = math.abs(by - ay) + dz = math.abs(bz - az) + d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) + return math.floor(d) / 39.37 +end + +function roundNum(num, n) + local mult = 10^(n or 0) + return math.floor(num * mult + 0.5) / mult +end + +function et_Obituary(victim, killer, mod) + if victim ~= killer and killer ~= 1022 and killer ~= 1023 then + if has_value(assist_weapons, mod) then + local names = "" + local killer_dmg = 0 + local killer_hs = 0 + local assist_dmg = {} + local assist_hs = {} + local ms = et.trap_Milliseconds() + for m=ms, ms-1500, -1 do + if hitters[victim][m] then + if hitters[victim][m][1] == killer then + killer_dmg = killer_dmg + hitters[victim][m][2] + killer_hs = killer_hs + hitters[victim][m][3] + else + if assist_dmg[hitters[victim][m][1]] == nil then + assist_dmg[hitters[victim][m][1]] = hitters[victim][m][2] + else + assist_dmg[hitters[victim][m][1]] = assist_dmg[hitters[victim][m][1]] + hitters[victim][m][2] + end + if assist_hs[hitters[victim][m][1]] == nil then + assist_hs[hitters[victim][m][1]] = hitters[victim][m][3] + else + assist_hs[hitters[victim][m][1]] = assist_hs[hitters[victim][m][1]] + hitters[victim][m][3] + end + end + end + end + local keyset={} + local n=0 + for k,v in pairs(assist_dmg) do + n=n+1 + keyset[n]=k + end + local max = 0 + local max_id = 0 + for j=1,#keyset do + if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") then + assists[keyset[j]] = assists[keyset[j]] + 1 + end + if assist_dmg[keyset[j]] > killer_dmg then + if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then + killsteals[killer] = killsteals[killer] + 1 + end + if assist_dmg[keyset[j]] > max then + max = assist_dmg[keyset[j]] + max_id = keyset[j] + end + end + local C + if et.gentity_get(keyset[j], "sess.sessionTeam") == 1 then + C = 1 + else + C = 4 + end + if names == "" then + if assist_hs[keyset[j]] == 0 then + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + end + else + if assist_hs[keyset[j]] == 0 then + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + end + end + end + if max > 0 then + if v_teamid ~= et.gentity_get(max_id, "sess.sessionTeam") and v_teamid ~= k_teamid then + et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") + et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") + end + end + local C + if k_teamid == 1 then + C = 1 + else + C = 4 + end + if v_teamid ~= k_teamid then + if announce_hp == true then + local posk = et.gentity_get(victim, "ps.origin") + local posv = et.gentity_get(killer, "ps.origin") + local killdist = dist(posk, posv) + local killerhp = et.gentity_get(killer, "health") + local C2 = 2 + if killerhp <= 50 then + C2 = 3 + end + if killerhp <= 20 then + C2 = 1 + end + if killerhp <= 0 then + if names == "" then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nDamage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Damage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") + else + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + end + else + if names == "" then + if killer_hs == 0 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") + else + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + end + else + if killer_hs == 0 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + else + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS), " .. names .. "\";") + end + end + end + else + if names == "" then + if killer_hs == 0 then + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") + else + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + end + else + if killer_hs == 0 then + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + else + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS), " .. names .. "\";") + end + end + end + end + end + end +end + +function et_ClientSpawn(clientNum, revived, teamChange, restoreHealth) + hitters[clientNum] = {nil, nil, nil, nil} + hitRegionsData[clientNum] = getAllHitRegions(clientNum) +end + +function et_ClientDisconnect(clientNum) + hitters[clientNum] = {nil, nil, nil, nil} + assists[clientNum] = 0 + killsteals[clientNum] = 0 +end \ No newline at end of file From 4abb426f05d02a27e3473b1939afe425897d1a72 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 10 Apr 2023 10:24:01 +0200 Subject: [PATCH 29/71] Update killassists.lua --- killassists.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/killassists.lua b/killassists.lua index a3bc847..020ad68 100644 --- a/killassists.lua +++ b/killassists.lua @@ -84,6 +84,8 @@ function roundNum(num, n) end function et_Obituary(victim, killer, mod) + local v_teamid = et.gentity_get(victim, "sess.sessionTeam") + local k_teamid = et.gentity_get(killer, "sess.sessionTeam") if victim ~= killer and killer ~= 1022 and killer ~= 1023 then if has_value(assist_weapons, mod) then local names = "" @@ -237,4 +239,4 @@ function et_ClientDisconnect(clientNum) hitters[clientNum] = {nil, nil, nil, nil} assists[clientNum] = 0 killsteals[clientNum] = 0 -end \ No newline at end of file +end From 7599af9e25e980df1241c72644dd60fbda7b9c0c Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 10 Apr 2023 21:07:37 +0200 Subject: [PATCH 30/71] Add files via upload --- killassists.lua | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/killassists.lua b/killassists.lua index 020ad68..4b470ba 100644 --- a/killassists.lua +++ b/killassists.lua @@ -1,3 +1,5 @@ +-- killassists.lua by x0rnn, shows kill assist information upon death (who all shot you, how much HP they took and how many HS they made) + hp_announce = true -- announce HP and distance of killer upon dying hitters = {} assists = {} @@ -85,10 +87,11 @@ end function et_Obituary(victim, killer, mod) local v_teamid = et.gentity_get(victim, "sess.sessionTeam") - local k_teamid = et.gentity_get(killer, "sess.sessionTeam") + local k_teamid = et.gentity_get(killer, "sess.sessionTeam") if victim ~= killer and killer ~= 1022 and killer ~= 1023 then if has_value(assist_weapons, mod) then local names = "" + local names_cens = "" local killer_dmg = 0 local killer_hs = 0 local assist_dmg = {} @@ -143,14 +146,34 @@ function et_Obituary(victim, killer, mod) if names == "" then if assist_hs[keyset[j]] == 0 then names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names + end else names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + else + names_cens = names + end end else if assist_hs[keyset[j]] == 0 then names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + end else names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + end end end end @@ -159,6 +182,12 @@ function et_Obituary(victim, killer, mod) et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") end + else + if names ~= "" then + if v_teamid ~= k_teamid then + et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") + end + end end local C if k_teamid == 1 then @@ -239,4 +268,4 @@ function et_ClientDisconnect(clientNum) hitters[clientNum] = {nil, nil, nil, nil} assists[clientNum] = 0 killsteals[clientNum] = 0 -end +end \ No newline at end of file From 3ddd040aba428a1538c8c1a82cb3087e1d3a42dc Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 11 Apr 2023 15:04:33 +0200 Subject: [PATCH 31/71] Add files via upload --- endstats.lua | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index 6d6cad5..95f9bc0 100644 --- a/endstats.lua +++ b/endstats.lua @@ -830,12 +830,13 @@ function et_Obituary(victim, killer, mod) if has_value(assist_weapons, mod) then local names = "" + local names_cens = "" local killer_dmg = 0 local killer_hs = 0 local assist_dmg = {} local assist_hs = {} local ms = et.trap_Milliseconds() - for m=ms, ms-15000, -1 do + for m=ms, ms-1500, -1 do if hitters[victim][m] then if hitters[victim][m][1] == killer then killer_dmg = killer_dmg + hitters[victim][m][2] @@ -884,14 +885,34 @@ function et_Obituary(victim, killer, mod) if names == "" then if assist_hs[keyset[j]] == 0 then names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names + end else names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + else + names_cens = names + end end else if assist_hs[keyset[j]] == 0 then names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + end else names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + end end end end @@ -900,6 +921,12 @@ function et_Obituary(victim, killer, mod) et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") end + else + if names ~= "" then + if v_teamid ~= k_teamid then + et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") + end + end end local C if k_teamid == 1 then From 7f76e966072ce11b5f0c8e8d58a87ae3298ea0db Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 14 Apr 2023 08:51:08 +0200 Subject: [PATCH 32/71] Add files via upload --- suddendeath.lua | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/suddendeath.lua b/suddendeath.lua index 87eeaff..9b06551 100644 --- a/suddendeath.lua +++ b/suddendeath.lua @@ -26,7 +26,7 @@ stuck_time = 0 intervals = {[1]=0, [2]=0} sudden_death = false first_obj = false -sw_flag = false +sw_sd_disabled = false -- Constans COLOR = {} @@ -39,14 +39,22 @@ POPUP = "legacy" timer = {} -OLD = os.time() - function et_InitGame(levelTime, randomSeed, restart) et.RegisterModname("suddendeath.lua" .. et.FindSelf()) mapname = string.lower(et.trap_Cvar_Get("mapname")) gametype = tonumber(et.trap_Cvar_Get("g_gametype")) + local alliedwins = tonumber(et.trap_Cvar_Get("g_alliedWins")) + local maptime = et.trap_Cvar_Get("timelimit") if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then - sw_flag = true + if alliedwins == 1 then + sw_sd_disabled = true + else + if maptime > et.trap_Cvar_Get("sd_defaulttime") + sw_sd_disabled = true + end + end + else + et.trap_Cvar_Set("sd_defaulttime", maptime) end end @@ -179,7 +187,7 @@ function et_Print( text ) print_message(-1, -1, timer[index]["place"]) --et.G_LogPrint("dynamite set: " .. index .. "\n") - if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... @@ -242,7 +250,7 @@ function et_Print( text ) if team == "axis" then team = 1 else team = 2 end - if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then if sudden_death == true then @@ -292,7 +300,7 @@ function et_Print( text ) if start2 and stop2 then start2,stop2,plant = string.find(text, POPUP .. " announce: \"([^%\"]*)\"") if start2 and stop2 then -- dynamite planted - if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then if mapname == "oasis" or mapname == "sw_oasis_b3" then if plant == "Allied team has destroyed the South Anti-Tank Gun!" or plant == "Allied team has destroyed the North Anti-Tank Gun!" then if first_obj == false then From b8e5b0806d6f58c7dd4a76e42b6e2c067781e414 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 23 Apr 2023 13:34:36 +0200 Subject: [PATCH 33/71] Update killassists.lua --- killassists.lua | 279 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 225 insertions(+), 54 deletions(-) diff --git a/killassists.lua b/killassists.lua index 4b470ba..d3c7aa8 100644 --- a/killassists.lua +++ b/killassists.lua @@ -4,7 +4,8 @@ hp_announce = true -- announce HP and distance of killer upon dying hitters = {} assists = {} killsteals = {} -assist_weapons = {1,2,3,6,7,8,9,10,11,12,13,14,17,37,38,44,45,46,50,51,53,54,55,56,62,66} +light_weapons = {1,2,3,5,6,7,8,9,10,11,12,13,14,17,37,38,44,45,46,50,51,53,54,55,56,61,62,66} +explosives = {15,16,18,19,20,22,23,26,39,40,41,42,52,63,64} HR_HEAD = 0 HR_ARMS = 1 HR_BODY = 2 @@ -13,6 +14,52 @@ HR_NONE = -1 HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} hitRegionsData = {} +mod_weapons = { +[1]= "MG", +[2]= "Browning", +[3]= "MG42", +[5]= "Knife", +[6]= "Luger", +[7]= "Colt", +[8]= "MP40", +[9]= "Thompson", +[10]= "Sten", +[11]= "Garand", +[12]= "Luger", +[13]= "FG42", +[14]= "Scoped FG42", +[15]= "Panzerfaust", +[16]= "Grenade", +[17]= "Flamethrower", +[18]= "Grenade", +[19]= "Mortar", +[20]= "Mortar", +[22]= "Dynamite", +[23]= "Airstrike", +[26]= "Arty", +[37]= "Rifle", +[38]= "Rifle", +[39]= "Riflenade", +[40]= "Riflenade", +[41]= "Mine", +[42]= "Satchel", +[44]= "MG42", +[45]= "Colt", +[46]= "Scoped Garand", +[50]= "K43", +[51]= "Scoped K43", +[52]= "Mortar", +[53]= "Akimbo Colt", +[54]= "Akimbo Luger", +[55]= "Akimbo Colt", +[56]= "Akimbo Luger", +[61]= "Knife", +[62]= "Browning", +[63]= "Mortar", +[64]= "Bazooka", +[66]= "MP34", +} + function has_value (tab, val) for index, value in ipairs(tab) do if value == val then @@ -27,7 +74,7 @@ function et_InitGame(levelTime, randomSeed, restart) sv_maxclients = tonumber(et.trap_Cvar_Get("sv_maxclients")) local j = 0 for j=0,sv_maxclients-1 do - hitters[j] = {nil, nil, nil, nil} + hitters[j] = {nil, nil, nil, nil, nil} assists[j] = 0 killsteals[j] = 0 end @@ -37,9 +84,9 @@ function getAllHitRegions(clientNum) local regions = {} for index, hitType in ipairs(HR_TYPES) do regions[hitType] = et.gentity_get(clientNum, "pers.playerStats.hitRegions", hitType) - end + end return regions -end +end function hitType(clientNum) local playerHitRegions = getAllHitRegions(clientNum) @@ -59,12 +106,14 @@ end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then - if has_value(assist_weapons, meansOfDeath) then + if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then local hitType = hitType(attacker) if hitType == HR_HEAD then - hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=1} + if not has_value(explosives, meansOfDeath) then + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=1, [4]=meansOfDeath} + end else - hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=0} + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=0, [4]=meansOfDeath} end end end @@ -89,19 +138,31 @@ function et_Obituary(victim, killer, mod) local v_teamid = et.gentity_get(victim, "sess.sessionTeam") local k_teamid = et.gentity_get(killer, "sess.sessionTeam") if victim ~= killer and killer ~= 1022 and killer ~= 1023 then - if has_value(assist_weapons, mod) then + if has_value(light_weapons, mod) or has_value(explosives, mod) then local names = "" local names_cens = "" local killer_dmg = 0 local killer_hs = 0 + local killer_wpn = "" + local killer_wpns = {} local assist_dmg = {} local assist_hs = {} + local assist_wpn = {} + local assist_wpns = {} local ms = et.trap_Milliseconds() - for m=ms, ms-1500, -1 do + for m=ms, ms-15000, -1 do if hitters[victim][m] then if hitters[victim][m][1] == killer then killer_dmg = killer_dmg + hitters[victim][m][2] killer_hs = killer_hs + hitters[victim][m][3] + killer_wpn = mod_weapons[hitters[victim][m][4]] + if #killer_wpns == 0 then + table.insert(killer_wpns, killer_wpn) + else + if not has_value(killer_wpns, killer_wpn) then + table.insert(killer_wpns, killer_wpn) + end + end else if assist_dmg[hitters[victim][m][1]] == nil then assist_dmg[hitters[victim][m][1]] = hitters[victim][m][2] @@ -113,6 +174,13 @@ function et_Obituary(victim, killer, mod) else assist_hs[hitters[victim][m][1]] = assist_hs[hitters[victim][m][1]] + hitters[victim][m][3] end + assist_wpn[hitters[victim][m][1]] = mod_weapons[hitters[victim][m][4]] + if not assist_wpns[hitters[victim][m][1]] then + assist_wpns[hitters[victim][m][1]] = {} + end + if not has_value(assist_wpns[hitters[victim][m][1]], assist_wpn[hitters[victim][m][1]]) then + table.insert(assist_wpns[hitters[victim][m][1]], assist_wpn[hitters[victim][m][1]]) + end end end end @@ -129,12 +197,14 @@ function et_Obituary(victim, killer, mod) assists[keyset[j]] = assists[keyset[j]] + 1 end if assist_dmg[keyset[j]] > killer_dmg then - if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then - killsteals[killer] = killsteals[killer] + 1 - end - if assist_dmg[keyset[j]] > max then - max = assist_dmg[keyset[j]] - max_id = keyset[j] + if not has_value(explosives, mod) and not has_value(explosives, assist_wpn[keyset[j]]) then + if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then + killsteals[killer] = killsteals[killer] + 1 + end + if assist_dmg[keyset[j]] > max then + max = assist_dmg[keyset[j]] + max_id = keyset[j] + end end end local C @@ -145,34 +215,74 @@ function et_Obituary(victim, killer, mod) end if names == "" then if assist_hs[keyset[j]] == 0 then - names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if #assist_wpns[keyset[j]] == 1 then + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names + end else - names_cens = names + local wpns = table.concat(assist_wpns[keyset[j]], "^z, ^" .. C) + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names + end end else - names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if #assist_wpns[keyset[j]] == 1 then + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + else + names_cens = names + end else - names_cens = names + local wpns = table.concat(assist_wpns[keyset[j]], "^z, ^" .. C) + names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + else + names_cens = names + end end end else if assist_hs[keyset[j]] == 0 then - names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if #assist_wpns[keyset[j]] == 1 then + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + end else - names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" + local wpns = table.concat(assist_wpns[keyset[j]], "^z, ^" .. C) + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z)" + end end else - names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if #assist_wpns[keyset[j]] == 1 then + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_wpn[keyset[j]] .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + end else - names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + local wpns = table.concat(assist_wpns[keyset[j]], "^z, ^" .. C) + names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then + names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + else + names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. "^zHS)" + end end end end @@ -181,6 +291,7 @@ function et_Obituary(victim, killer, mod) if v_teamid ~= et.gentity_get(max_id, "sess.sessionTeam") and v_teamid ~= k_teamid then et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") + et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") end else if names ~= "" then @@ -210,47 +321,107 @@ function et_Obituary(victim, killer, mod) end if killerhp <= 0 then if names == "" then - et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nDamage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") - et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Damage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nDamage received last 1.5s: (^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Damage received last 1.5s: (^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nDamage received last 1.5s: (^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Damage received last 1.5s: (^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + end else - et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead.\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zwas dead. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + end end else if names == "" then if killer_hs == 0 then - et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") - et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. killer_dmg .. "^z)\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + end else - et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") - et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nDamage received last 1.5s: (^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Damage received last 1.5s: (^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + end end else if killer_hs == 0 then - et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + end else - et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS), " .. names .. "\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS), " .. names .. "\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm\nKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"" .. et.gentity_get(killer, "pers.netname") .. " ^zhad ^" .. C2 .. killerhp .. " ^zHP left. Distance was ^3" .. math.floor(roundNum(killdist)) .. " ^zm. Kill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS), " .. names .. "\";") + end end end end else if names == "" then if killer_hs == 0 then - et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") - et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\";") + end else - et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") - et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\";") + end end else if killer_hs == 0 then - et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z), " .. names .. "\";") + end else - et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS), " .. names .. "\";") + if #killer_wpns == 1 then + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_wpn .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS), " .. names .. "\";") + else + local wpns = table.concat(killer_wpns, "^z, ^" .. C) + et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS)\n" .. names .. "\";") + et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. wpns .. "^z; ^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. "^zHS), " .. names .. "\";") + end end end end @@ -260,12 +431,12 @@ function et_Obituary(victim, killer, mod) end function et_ClientSpawn(clientNum, revived, teamChange, restoreHealth) - hitters[clientNum] = {nil, nil, nil, nil} + hitters[clientNum] = {nil, nil, nil, nil, nil} hitRegionsData[clientNum] = getAllHitRegions(clientNum) end function et_ClientDisconnect(clientNum) - hitters[clientNum] = {nil, nil, nil, nil} + hitters[clientNum] = {nil, nil, nil, nil, nil} assists[clientNum] = 0 killsteals[clientNum] = 0 -end \ No newline at end of file +end From 2a4ca91b0452a907eab0171fdcbd21fa32ddcfd1 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 23 Apr 2023 13:41:31 +0200 Subject: [PATCH 34/71] Update killassists.lua --- killassists.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/killassists.lua b/killassists.lua index d3c7aa8..85954a3 100644 --- a/killassists.lua +++ b/killassists.lua @@ -150,7 +150,7 @@ function et_Obituary(victim, killer, mod) local assist_wpn = {} local assist_wpns = {} local ms = et.trap_Milliseconds() - for m=ms, ms-15000, -1 do + for m=ms, ms-1500, -1 do if hitters[victim][m] then if hitters[victim][m][1] == killer then killer_dmg = killer_dmg + hitters[victim][m][2] From 3e2b0cc1451f5ade3facaafd408b4fe7639055e1 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 23 Apr 2023 16:36:14 +0200 Subject: [PATCH 35/71] Update killassists.lua --- killassists.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/killassists.lua b/killassists.lua index 85954a3..dc52043 100644 --- a/killassists.lua +++ b/killassists.lua @@ -1,6 +1,6 @@ -- killassists.lua by x0rnn, shows kill assist information upon death (who all shot you, how much HP they took and how many HS they made) -hp_announce = true -- announce HP and distance of killer upon dying +announce_hp = true -- announce HP and distance of killer upon dying hitters = {} assists = {} killsteals = {} From aae9dcc8d9ea2f7ab265bedd90c519e0fd952b79 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 23 Apr 2023 17:28:37 +0200 Subject: [PATCH 36/71] Add files via upload --- killassists.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/killassists.lua b/killassists.lua index dc52043..4c196dc 100644 --- a/killassists.lua +++ b/killassists.lua @@ -1,6 +1,7 @@ -- killassists.lua by x0rnn, shows kill assist information upon death (who all shot you, how much HP they took and how many HS they made) announce_hp = true -- announce HP and distance of killer upon dying +announce_killer = true -- announce kill assists to the killer hitters = {} assists = {} killsteals = {} @@ -291,12 +292,16 @@ function et_Obituary(victim, killer, mod) if v_teamid ~= et.gentity_get(max_id, "sess.sessionTeam") and v_teamid ~= k_teamid then et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") - et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") + if announce_killer == true then + et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") + end end else if names ~= "" then if v_teamid ~= k_teamid then - et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") + if announce_killer == true then + et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") + end end end end @@ -439,4 +444,4 @@ function et_ClientDisconnect(clientNum) hitters[clientNum] = {nil, nil, nil, nil, nil} assists[clientNum] = 0 killsteals[clientNum] = 0 -end +end \ No newline at end of file From 234e3a44daadfdc24537f8cea8af755ad25e71c0 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 8 May 2023 20:47:03 +0200 Subject: [PATCH 37/71] Add files via upload --- endstats.lua | 133 +++++++++--------------------------------------- killassists.lua | 19 +++++-- 2 files changed, 41 insertions(+), 111 deletions(-) diff --git a/endstats.lua b/endstats.lua index 95f9bc0..d16fad5 100644 --- a/endstats.lua +++ b/endstats.lua @@ -1,5 +1,4 @@ --- endstats.lua by x0rnn, shows some interesting game statistics at the end of a round (highest light weapon acc, highest hs acc, most dynamites planted, most pistol kills, kill/death stats vs. all opponents, etc.) --- shows kill assist information upon death (who all shot you, how much HP they took and how many HS they made) +-- endstats.lua by x0rnn, shows some interesting game statistics at the end of a round (most kill assists, most kill steals, highest light weapon acc, highest hs acc, most dynamites planted, most pistol kills, kill/death stats vs. all opponents, etc.) killing_sprees = {} death_sprees = {} @@ -27,7 +26,8 @@ vsstats = {} vsstats_kills = {} vsstats_deaths = {} hitters = {} -assist_weapons = {1,2,3,6,7,8,9,10,11,12,13,14,17,37,38,44,45,46,50,51,53,54,55,56,62,66} +light_weapons = {1,2,3,5,6,7,8,9,10,11,12,13,14,17,37,38,44,45,46,50,51,53,54,55,56,61,62,66} +explosives = {15,16,18,19,20,22,23,26,39,40,41,42,52,63,64} HR_HEAD = 0 HR_ARMS = 1 HR_BODY = 2 @@ -116,20 +116,22 @@ end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then - if has_value(assist_weapons, meansOfDeath) then + if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then local hitType = hitType(attacker) if hitType == HR_HEAD then - hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=1} + if not has_value(explosives, meansOfDeath) then + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} + end else - hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=0} + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} end end end end function topshots_f(id) - local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} local i = 0 for i=0, sv_maxclients-1 do local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) @@ -371,6 +373,8 @@ function topshots_f(id) if topshots[i][30] > max[40] then max[40] = topshots[i][30] max_id[40] = i + et.trap_SendServerCommand(-1,"chat \"^3fdsfdfsdfdsa\n\"") + end end end @@ -729,13 +733,11 @@ function et_Obituary(victim, killer, mod) checkKSpreeEnd(victim) if mod == 33 then death_sprees[victim] = death_sprees[victim] + 1 + deaths[victim] = deaths[victim] + 1 end end killing_sprees[victim] = 0 - if mod == 33 then - deaths[victim] = deaths[victim] + 1 - end else if (v_teamid == k_teamid) then -- team kill @@ -765,7 +767,7 @@ function et_Obituary(victim, killer, mod) checkDSpreeEnd(killer) -- most lightweapons kills - if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 or mod=66 then + if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 or mod==66 then -- most pistol kills if mod==6 or mod==7 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 then topshots[killer][2] = topshots[killer][2] + 1 @@ -828,29 +830,23 @@ function et_Obituary(victim, killer, mod) death_sprees[killer] = 0 end - if has_value(assist_weapons, mod) then - local names = "" - local names_cens = "" + if has_value(light_weapons, mod) or has_value(explosives, mod) then local killer_dmg = 0 - local killer_hs = 0 local assist_dmg = {} - local assist_hs = {} + local last_assist_wpn = {} local ms = et.trap_Milliseconds() - for m=ms, ms-1500, -1 do + for m=ms, ms-15000, -1 do if hitters[victim][m] then if hitters[victim][m][1] == killer then killer_dmg = killer_dmg + hitters[victim][m][2] - killer_hs = killer_hs + hitters[victim][m][3] else if assist_dmg[hitters[victim][m][1]] == nil then assist_dmg[hitters[victim][m][1]] = hitters[victim][m][2] else assist_dmg[hitters[victim][m][1]] = assist_dmg[hitters[victim][m][1]] + hitters[victim][m][2] end - if assist_hs[hitters[victim][m][1]] == nil then - assist_hs[hitters[victim][m][1]] = hitters[victim][m][3] - else - assist_hs[hitters[victim][m][1]] = assist_hs[hitters[victim][m][1]] + hitters[victim][m][3] + if not last_assist_wpn[hitters[victim][m][1]] then + last_assist_wpn[hitters[victim][m][1]] = hitters[victim][m][3] end end end @@ -861,101 +857,21 @@ function et_Obituary(victim, killer, mod) n=n+1 keyset[n]=k end - local max = 0 - local max_id = 0 for j=1,#keyset do if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") then topshots[keyset[j]][29] = topshots[keyset[j]][29] + 1 end if assist_dmg[keyset[j]] > killer_dmg then - if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then - topshots[killer][30] = topshots[killer][30] + 1 - end - if assist_dmg[keyset[j]] > max then - max = assist_dmg[keyset[j]] - max_id = keyset[j] - end - end - local C - if et.gentity_get(keyset[j], "sess.sessionTeam") == 1 then - C = 1 - else - C = 4 - end - if names == "" then - if assist_hs[keyset[j]] == 0 then - names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - else - names_cens = names - end - else - names = et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = "^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" - else - names_cens = names - end - end - else - if assist_hs[keyset[j]] == 0 then - names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - else - names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z)" - end - else - names = names .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" - if et.gentity_get(keyset[j], "sess.sessionTeam") ~= k_teamid then - names_cens = names_cens .. ", ^" .. C .. "TEAMMATE ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" - else - names_cens = names_cens .. ", " .. et.gentity_get(keyset[j], "pers.netname") .. " ^z(^" .. C .. assist_dmg[keyset[j]] .. "^z, ^" .. C .. assist_hs[keyset[j]] .. " ^zHS)" + if not has_value(explosives, mod) and not has_value(explosives, last_assist_wpn[keyset[j]]) then + if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then + topshots[killer][30] = topshots[killer][30] + 1 end end end end - if max > 0 then - if v_teamid ~= et.gentity_get(max_id, "sess.sessionTeam") and v_teamid ~= k_teamid then - et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") - et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") - end - else - if names ~= "" then - if v_teamid ~= k_teamid then - et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") - end - end - end - local C - if k_teamid == 1 then - C = 1 - else - C = 4 - end - if v_teamid ~= k_teamid then - if names == "" then - if killer_hs == 0 then - et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") - et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z)\";") - else - et.trap_SendServerCommand(victim, "cp \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") - et.trap_SendServerCommand(victim, "chat \"^zDamage received last 1.5s: " .. et.gentity_get(killer, "pers.netname") .. "^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\";") - end - else - if killer_hs == 0 then - et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z), " .. names .. "\";") - else - et.trap_SendServerCommand(victim, "cp \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS)\n" .. names .. "\";") - et.trap_SendServerCommand(victim, "chat \"^zKill Assists: " .. et.gentity_get(killer, "pers.netname") .. " ^z(^" .. C .. killer_dmg .. "^z, ^" .. C .. killer_hs .. " ^zHS), " .. names .. "\";") - end - end - end - end - end + end + end -- gamestate end @@ -985,6 +901,7 @@ function et_RunFrame(levelTime) topshots_f(-2) end end + gamestate = tonumber(et.trap_Cvar_Get("gamestate")) end function et_ClientBegin(id) diff --git a/killassists.lua b/killassists.lua index 4c196dc..d2ae86d 100644 --- a/killassists.lua +++ b/killassists.lua @@ -1,7 +1,7 @@ -- killassists.lua by x0rnn, shows kill assist information upon death (who all shot you, how much HP they took and how many HS they made) -announce_hp = true -- announce HP and distance of killer upon dying -announce_killer = true -- announce kill assists to the killer +announce_hp = false -- announce HP and distance of killer upon dying +announce_killer = false -- announce kill assists to the killer also hitters = {} assists = {} killsteals = {} @@ -14,6 +14,7 @@ HR_LEGS = 3 HR_NONE = -1 HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} hitRegionsData = {} +gamestate = -1 mod_weapons = { [1]= "MG", @@ -135,7 +136,14 @@ function roundNum(num, n) return math.floor(num * mult + 0.5) / mult end +function et_RunFrame(levelTime) + if math.fmod(levelTime, 1000) ~= 0 then return end + + gamestate = tonumber(et.trap_Cvar_Get("gamestate")) +end + function et_Obituary(victim, killer, mod) + if gamestate == 0 then local v_teamid = et.gentity_get(victim, "sess.sessionTeam") local k_teamid = et.gentity_get(killer, "sess.sessionTeam") if victim ~= killer and killer ~= 1022 and killer ~= 1023 then @@ -150,6 +158,7 @@ function et_Obituary(victim, killer, mod) local assist_hs = {} local assist_wpn = {} local assist_wpns = {} + local last_assist_wpn = {} local ms = et.trap_Milliseconds() for m=ms, ms-1500, -1 do if hitters[victim][m] then @@ -179,6 +188,9 @@ function et_Obituary(victim, killer, mod) if not assist_wpns[hitters[victim][m][1]] then assist_wpns[hitters[victim][m][1]] = {} end + if not last_assist_wpn[hitters[victim][m][1]] then + last_assist_wpn[hitters[victim][m][1]] = hitters[victim][m][4] + end if not has_value(assist_wpns[hitters[victim][m][1]], assist_wpn[hitters[victim][m][1]]) then table.insert(assist_wpns[hitters[victim][m][1]], assist_wpn[hitters[victim][m][1]]) end @@ -198,7 +210,7 @@ function et_Obituary(victim, killer, mod) assists[keyset[j]] = assists[keyset[j]] + 1 end if assist_dmg[keyset[j]] > killer_dmg then - if not has_value(explosives, mod) and not has_value(explosives, assist_wpn[keyset[j]]) then + if not has_value(explosives, mod) and not has_value(explosives, last_assist_wpn[keyset[j]]) then if v_teamid ~= et.gentity_get(keyset[j], "sess.sessionTeam") and v_teamid ~= k_teamid then killsteals[killer] = killsteals[killer] + 1 end @@ -433,6 +445,7 @@ function et_Obituary(victim, killer, mod) end end end + end end function et_ClientSpawn(clientNum, revived, teamChange, restoreHealth) From 299c45d2793541804f4901af4f613a45452d2387 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 8 May 2023 20:49:29 +0200 Subject: [PATCH 38/71] Add files via upload --- endstats.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/endstats.lua b/endstats.lua index d16fad5..3ba19db 100644 --- a/endstats.lua +++ b/endstats.lua @@ -373,8 +373,6 @@ function topshots_f(id) if topshots[i][30] > max[40] then max[40] = topshots[i][30] max_id[40] = i - et.trap_SendServerCommand(-1,"chat \"^3fdsfdfsdfdsa\n\"") - end end end @@ -835,7 +833,7 @@ function et_Obituary(victim, killer, mod) local assist_dmg = {} local last_assist_wpn = {} local ms = et.trap_Milliseconds() - for m=ms, ms-15000, -1 do + for m=ms, ms-1500, -1 do if hitters[victim][m] then if hitters[victim][m][1] == killer then killer_dmg = killer_dmg + hitters[victim][m][2] From f267c1a354f91eb3069912e26cd40f62e9e248bf Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 9 May 2023 16:30:56 +0200 Subject: [PATCH 39/71] Add files via upload --- killassists.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/killassists.lua b/killassists.lua index d2ae86d..22dfa9e 100644 --- a/killassists.lua +++ b/killassists.lua @@ -2,6 +2,7 @@ announce_hp = false -- announce HP and distance of killer upon dying announce_killer = false -- announce kill assists to the killer also +announce_steal = true -- announce "kill stolen from/by" to the killer and to the player stolen from hitters = {} assists = {} killsteals = {} @@ -302,8 +303,10 @@ function et_Obituary(victim, killer, mod) end if max > 0 then if v_teamid ~= et.gentity_get(max_id, "sess.sessionTeam") and v_teamid ~= k_teamid then - et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") - et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") + if announce_steal == true then + et.trap_SendServerCommand(killer, "bp \"^zKill stolen from: " .. et.gentity_get(max_id, "pers.netname") .. "\";") + et.trap_SendServerCommand(max_id, "bp \"^zKill stolen by: " .. et.gentity_get(killer, "pers.netname") .. "\";") + end if announce_killer == true then et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") end From f611b43876d54bee11f7dffb9f4ad54c581a2d90 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 14 May 2023 21:28:57 +0200 Subject: [PATCH 40/71] Add files via upload --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index 3ba19db..0b15ab5 100644 --- a/endstats.lua +++ b/endstats.lua @@ -673,7 +673,7 @@ function checkMultiKill (id, mod) local lvltime = et.trap_Milliseconds() if (lvltime - kmulti[id][1]) < 3000 then kmulti[id][2] = kmulti[id][2] + 1 - if mod==7 or mod==8 or mod==9 or mod==10 or mod==58 or mod==59 then + if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 or mod==66 then mkps[id][1] = mkps[id][1] + 1 if mkps[id][2] == 0 then mkps[id][2] = lvltime From 70fbfe43f72fc751f1b10f7e1d4aa88450faa641 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 21 May 2023 11:12:13 +0200 Subject: [PATCH 41/71] Update endstats.lua --- endstats.lua | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/endstats.lua b/endstats.lua index 0b15ab5..7b43994 100644 --- a/endstats.lua +++ b/endstats.lua @@ -1,4 +1,4 @@ --- endstats.lua by x0rnn, shows some interesting game statistics at the end of a round (most kill assists, most kill steals, highest light weapon acc, highest hs acc, most dynamites planted, most pistol kills, kill/death stats vs. all opponents, etc.) +-- endstats.lua by x0rnn, shows some interesting game statistics at the end of a round (most kill assists, most kill steals, most headshot kills, highest light weapon acc, highest hs acc, most dynamites planted, most pistol kills, kill/death stats vs. all opponents, etc.) killing_sprees = {} death_sprees = {} @@ -36,7 +36,7 @@ HR_NONE = -1 HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} hitRegionsData = {} -topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals"} +topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals", [41]="Most headshot kills"} function et_InitGame(levelTime, randomSeed, restart) @@ -48,7 +48,7 @@ function et_InitGame(levelTime, randomSeed, restart) killing_sprees[i] = 0 death_sprees[i] = 0 kmulti[i] = { [1]=0, [2]=0, } - topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0} + topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0} vsstats[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_kills[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_deaths[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} @@ -117,10 +117,18 @@ end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then + local v_team = et.gentity_get(target, "sess.sessionTeam") + local k_team = et.gentity_get(attacker, "sess.sessionTeam") + local v_health = et.gentity_get(target, "health") local hitType = hitType(attacker) if hitType == HR_HEAD then if not has_value(explosives, meansOfDeath) then hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} + if v_team ~= k_team then + if damage >= v_health then + topshots[attacker][31] = topshots[attacker][31] + 1 + end + end end else hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} @@ -130,8 +138,8 @@ function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) end function topshots_f(id) - local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} local i = 0 for i=0, sv_maxclients-1 do local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) @@ -374,6 +382,11 @@ function topshots_f(id) max[40] = topshots[i][30] max_id[40] = i end + --most headshot kills + if topshots[i][31] > max[41] then + max[41] = topshots[i][31] + max_id[41] = i + end end end if id == -2 then @@ -410,7 +423,7 @@ function topshots_f(id) end local j = 1 local players = {} - for j=1, 40 do + for j=1, 41 do if max[j] > 1 then if j ~= 10 and j ~= 25 and j ~= 33 then if j == 8 then @@ -931,7 +944,7 @@ end function et_ClientDisconnect(id) killing_sprees[id] = 0 death_sprees[id] = 0 - topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0} + topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0} axis_time[id] = 0 allies_time[id] = 0 mkps[id] = { [1]=0, [2]=0, [3]=0 } From 97630fcdd48c032278dcd9423352419fef06dd0c Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 21 May 2023 16:06:08 +0200 Subject: [PATCH 42/71] Update endstats.lua --- endstats.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/endstats.lua b/endstats.lua index 7b43994..1de8ee6 100644 --- a/endstats.lua +++ b/endstats.lua @@ -740,14 +740,11 @@ function et_Obituary(victim, killer, mod) if (victim == killer) then -- suicide - if mod == 33 or mod == 59 then - checkKSpreeEnd(victim) - if mod == 33 then - death_sprees[victim] = death_sprees[victim] + 1 - deaths[victim] = deaths[victim] + 1 - end - end - + if mod ~= 59 then + death_sprees[victim] = death_sprees[victim] + 1 + end + checkKSpreeEnd(victim) + death_sprees[victim] = death_sprees[victim] + 1 killing_sprees[victim] = 0 else From 8c7656c72df439457c0e7c94a12d0bf7b8c2d76b Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 21 May 2023 16:34:05 +0200 Subject: [PATCH 43/71] Update endstats.lua --- endstats.lua | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/endstats.lua b/endstats.lua index 1de8ee6..1fb288c 100644 --- a/endstats.lua +++ b/endstats.lua @@ -757,22 +757,19 @@ function et_Obituary(victim, killer, mod) else -- nomal kill if killer ~= 1022 and killer ~= 1023 then -- no world / unknown kills - killing_sprees[killer] = killing_sprees[killer] + 1 - death_sprees[victim] = death_sprees[victim] + 1 + killing_sprees[killer] = killing_sprees[killer] + 1 + vsstats[killer][victim] = vsstats[killer][victim] + 1 + kills[killer] = kills[killer] + 1 + deaths[victim] = deaths[victim] + 1 + worst_enemy[victim][killer] = worst_enemy[victim][killer] + 1 + easiest_prey[killer][victim] = easiest_prey[killer][victim] + 1 + local posk = et.gentity_get(victim, "ps.origin") + local posv = et.gentity_get(killer, "ps.origin") + local killdist = dist(posk, posv) - vsstats[killer][victim] = vsstats[killer][victim] + 1 - kills[killer] = kills[killer] + 1 - deaths[victim] = deaths[victim] + 1 - worst_enemy[victim][killer] = worst_enemy[victim][killer] + 1 - easiest_prey[killer][victim] = easiest_prey[killer][victim] + 1 - local posk = et.gentity_get(victim, "ps.origin") - local posv = et.gentity_get(killer, "ps.origin") - local killdist = dist(posk, posv) - - checkMultiKill(killer, mod) - - checkKSpreeEnd(victim) - checkDSpreeEnd(killer) + checkMultiKill(killer, mod) + checkKSpreeEnd(victim) + checkDSpreeEnd(killer) -- most lightweapons kills if mod==6 or mod==7 or mod==8 or mod==9 or mod==10 or mod==12 or mod==45 or mod==53 or mod==54 or mod==55 or mod==56 or mod==66 then @@ -830,10 +827,8 @@ function et_Obituary(victim, killer, mod) end else checkKSpreeEnd(victim) - if killer ~= 1022 then - death_sprees[victim] = death_sprees[victim] + 1 - end end + death_sprees[victim] = death_sprees[victim] + 1 killing_sprees[victim] = 0 death_sprees[killer] = 0 end From 72d42fb35a4da4d37ebeaa369202a05894577f85 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 21 May 2023 16:37:11 +0200 Subject: [PATCH 44/71] Update endstats.lua --- endstats.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/endstats.lua b/endstats.lua index 1fb288c..ad4ac6e 100644 --- a/endstats.lua +++ b/endstats.lua @@ -826,6 +826,7 @@ function et_Obituary(victim, killer, mod) topshots[victim][19] = topshots[victim][19] + 1 end else + deaths[victim] = deaths[victim] + 1 checkKSpreeEnd(victim) end death_sprees[victim] = death_sprees[victim] + 1 From fc95b5ed1bf9e06b95e6448be941b1109258ace1 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 23 Jul 2023 11:00:36 +0200 Subject: [PATCH 45/71] Update killassists.lua --- killassists.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/killassists.lua b/killassists.lua index 22dfa9e..43274e8 100644 --- a/killassists.lua +++ b/killassists.lua @@ -146,7 +146,10 @@ end function et_Obituary(victim, killer, mod) if gamestate == 0 then local v_teamid = et.gentity_get(victim, "sess.sessionTeam") - local k_teamid = et.gentity_get(killer, "sess.sessionTeam") + local k_teamid + if killer ~= 1022 and killer ~= 1023 then + k_teamid = et.gentity_get(killer, "sess.sessionTeam") + end if victim ~= killer and killer ~= 1022 and killer ~= 1023 then if has_value(light_weapons, mod) or has_value(explosives, mod) then local names = "" @@ -460,4 +463,4 @@ function et_ClientDisconnect(clientNum) hitters[clientNum] = {nil, nil, nil, nil, nil} assists[clientNum] = 0 killsteals[clientNum] = 0 -end \ No newline at end of file +end From 4c77aff66103c5182fe5141edb353816b027d156 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 23 Jul 2023 11:17:28 +0200 Subject: [PATCH 46/71] Add files via upload --- endstats.lua | 66 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/endstats.lua b/endstats.lua index ad4ac6e..3f56707 100644 --- a/endstats.lua +++ b/endstats.lua @@ -35,8 +35,10 @@ HR_LEGS = 3 HR_NONE = -1 HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} hitRegionsData = {} +death_time = {} +death_time_total = {} -topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals", [41]="Most headshot kills"} +topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals", [41]="Most headshot kills", [42]="Full respawn king", [43]="Least time dead (What spawn?)"} function et_InitGame(levelTime, randomSeed, restart) @@ -48,7 +50,7 @@ function et_InitGame(levelTime, randomSeed, restart) killing_sprees[i] = 0 death_sprees[i] = 0 kmulti[i] = { [1]=0, [2]=0, } - topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0} + topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0, [32]=0, [33]=0} vsstats[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_kills[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_deaths[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} @@ -60,6 +62,8 @@ function et_InitGame(levelTime, randomSeed, restart) kills[i] = 0 deaths[i] = 0 hitters[i] = {nil, nil, nil, nil} + death_time[i] = 0 + death_time_total[i] = 0 end end @@ -138,8 +142,8 @@ function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) end function topshots_f(id) - local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 100} + local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} local i = 0 for i=0, sv_maxclients-1 do local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) @@ -154,6 +158,12 @@ function topshots_f(id) local k = tonumber(et.gentity_get(i, "sess.kills")) local gibs = tonumber(et.gentity_get(i, "sess.gibs")) local kd = 0 + local timeplayed = tonumber(et.gentity_get(i, "sess.time_axis")) + tonumber(et.gentity_get(i, "sess.time_allies")) + if death_time[i] ~= 0 then + local diff = et.trap_Milliseconds() - death_time[i] + death_time_total[i] = death_time_total[i] + diff + end + if d ~= 0 then kd = k/d else @@ -387,6 +397,22 @@ function topshots_f(id) max[41] = topshots[i][31] max_id[41] = i end + -- most time dead + if timeplayed > 600000 or timeplayed == et.trap_Cvar_Get("timelimit") * 60 * 1000 then + if (death_time_total[i] / timeplayed) * 100 > max[42] then + max[42] = (death_time_total[i] / timeplayed) * 100 + max_id[42] = i + max[44] = death_time_total[i] + end + end + -- least time dead + if timeplayed > 600000 or timeplayed == et.trap_Cvar_Get("timelimit") * 60 * 1000 then + if (death_time_total[i] / timeplayed) * 100 < max[43] then + max[43] = (death_time_total[i] / timeplayed) * 100 + max_id[43] = i + max[45] = death_time_total[i] + end + end end end if id == -2 then @@ -423,8 +449,8 @@ function topshots_f(id) end local j = 1 local players = {} - for j=1, 41 do - if max[j] > 1 then + for j=1, 43 do + if max[j] > 1 or (j == 43 and max[j] == 0) then if j ~= 10 and j ~= 25 and j ~= 33 then if j == 8 then --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. "\"\n") @@ -462,6 +488,13 @@ function topshots_f(id) et.gentity_get(max_id[j], "pers.netname"), roundNum(max[j], 2) .. " ^7m" }) + elseif j == 42 or j == 43 then + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. " ^zpercent, ^1" .. roundNum((max[j+2] / 60000), 2) .. " ^zmin\"\n") + table.insert(players, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + roundNum(max[j], 2) .. " ^7percent, " .. roundNum((max[j+2] / 60000), 2) .. " ^7min" + }) else --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. max[j] .. "\"\n") table.insert(players, { @@ -736,18 +769,22 @@ end function et_Obituary(victim, killer, mod) if gamestate == 0 then local v_teamid = et.gentity_get(victim, "sess.sessionTeam") - local k_teamid = et.gentity_get(killer, "sess.sessionTeam") + local k_teamid + if killer ~= 1022 and killer ~= 1023 then + k_teamid = et.gentity_get(killer, "sess.sessionTeam") + end if (victim == killer) then -- suicide if mod ~= 59 then death_sprees[victim] = death_sprees[victim] + 1 + death_time[victim] = et.trap_Milliseconds() end checkKSpreeEnd(victim) - death_sprees[victim] = death_sprees[victim] + 1 killing_sprees[victim] = 0 else + death_time[victim] = et.trap_Milliseconds() if (v_teamid == k_teamid) then -- team kill checkKSpreeEnd(victim) @@ -919,8 +956,8 @@ end function et_ClientSpawn(id, revived) killing_sprees[id] = 0 + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) if revived ~= 1 then - local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) if team == 1 and axis_time[id] == 0 then axis_time[id] = et.trap_Milliseconds() elseif team == 2 and allies_time[id] == 0 then @@ -932,12 +969,19 @@ function et_ClientSpawn(id, revived) end hitters[id] = {nil, nil, nil, nil} hitRegionsData[id] = getAllHitRegions(id) + if team == 2 or team == 3 then + if death_time[id] ~= 0 then + local diff = et.trap_Milliseconds() - death_time[id] + death_time_total[id] = death_time_total[id] + diff + end + end + death_time[id] = 0 end function et_ClientDisconnect(id) killing_sprees[id] = 0 death_sprees[id] = 0 - topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0} + topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0, [32]=0, [33]=0} axis_time[id] = 0 allies_time[id] = 0 mkps[id] = { [1]=0, [2]=0, [3]=0 } @@ -957,6 +1001,8 @@ function et_ClientDisconnect(id) vsstats_deaths[j][id] = 0 end hitters[id] = {nil, nil, nil, nil} + death_time[id] = 0 + death_time_total[id] = 0 end --- Sends a nice table to a client. From ea6a5237ef12ae5be94cf01a7c785efc2812b2d4 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 4 Sep 2023 11:49:01 +0200 Subject: [PATCH 47/71] Add files via upload --- ETWsk.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index b1f9633..cc33fda 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -45,12 +45,12 @@ Author = "[ETW-FZ] Mad@Mat" ETWsk_putspec = 1 -- number of sk's needed for setting a client -- to spectators ETWsk_kick = 99 -- number of sk's needed for kicking a client -ETWsk_kicklen = 20 -- duration of kick +ETWsk_kicklen = 20*60 -- duration of kick -- benny ----------------------------------------------------------------------- ETWsk_persistentoffender = 1 -- enable punishment 4 persistent spawn killers ETWsk_POThreshold = 2 -- if players has been kicked before, he will -- be temp banned with his XX spawn kill -ETWsk_banval = 30 -- (ETWsk_banval * 4 ^ kicksb4) = ban +ETWsk_banval = 30*60 -- (ETWsk_banval * 4 ^ kicksb4) = ban -- If ETWsk_banval = 30, he'll be kicked 4 -- 120 minutes, next is 480, 1920, 7680, ... ETWsk_pofile = "ETWsk_PO.txt" -- save to /etpro/ETWsk_PO.txt From 0403be370d54f61798f21cae027b3b7d19ffb401 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 24 Dec 2023 12:10:45 +0100 Subject: [PATCH 48/71] Add files via upload --- endstats.lua | 288 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 221 insertions(+), 67 deletions(-) diff --git a/endstats.lua b/endstats.lua index 3f56707..3e314c8 100644 --- a/endstats.lua +++ b/endstats.lua @@ -8,8 +8,6 @@ eomap_done = false eomaptime = 0 gamestate = -1 topshots = {} -axis_time = {} -allies_time = {} mkps = {} weaponstats = {} endplayers = {} @@ -37,8 +35,23 @@ HR_TYPES = {HR_HEAD, HR_ARMS, HR_BODY, HR_LEGS} hitRegionsData = {} death_time = {} death_time_total = {} +players = {} +ltm2 = 0 +redspawn = 0 +bluespawn = 0 +redspawn2 = 0 +bluespawn2 = 0 +spawns = {} +redflag = false +blueflag = false +redlimbo1 = 0 +bluelimbo1 = 0 +redlimbo2 = 0 +bluelimbo2 = 0 +changedred = false +changedblue = false -topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals", [41]="Most headshot kills", [42]="Full respawn king", [43]="Least time dead (What spawn?)"} +topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals", [41]="Most headshot kills", [42]="Most damage per minute", [43]="Tank/Meatshield (Refuses to die)", [44]="Most useful kills (>Half respawn time left)", [45]="Full respawn king", [46]="Least time dead (What spawn?)"} function et_InitGame(levelTime, randomSeed, restart) @@ -50,20 +63,20 @@ function et_InitGame(levelTime, randomSeed, restart) killing_sprees[i] = 0 death_sprees[i] = 0 kmulti[i] = { [1]=0, [2]=0, } - topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0, [32]=0, [33]=0} + topshots[i] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0, [32]=0, [33]=0, [34]=0} vsstats[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_kills[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_deaths[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} worst_enemy[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} easiest_prey[i]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} mkps[i] = { [1]=0, [2]=0, [3]=0 } - axis_time[i] = 0 - allies_time[i] = 0 kills[i] = 0 deaths[i] = 0 hitters[i] = {nil, nil, nil, nil} death_time[i] = 0 death_time_total[i] = 0 + players[i] = nil + spawns[i] = nil end end @@ -142,22 +155,23 @@ function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) end function topshots_f(id) - local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 100} - local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + local max = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 100} + local max_id = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} local i = 0 for i=0, sv_maxclients-1 do local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) if team == 1 or team == 2 then local dg = tonumber(et.gentity_get(i, "sess.damage_given")) local dr = tonumber(et.gentity_get(i, "sess.damage_received")) - local tdg = tonumber(et.gentity_get(i, "sess.team_damage_given")) - local tdr = tonumber(et.gentity_get(i, "sess.team_damage_received")) + local tdg = tonumber(et.gentity_get(i, "sess.team_damage")) + local tdr = tonumber(et.gentity_get(i, "sess.team_received")) local tk = tonumber(et.gentity_get(i, "sess.team_kills")) local sk = tonumber(et.gentity_get(i, "sess.self_kills")) local d = tonumber(et.gentity_get(i, "sess.deaths")) local k = tonumber(et.gentity_get(i, "sess.kills")) local gibs = tonumber(et.gentity_get(i, "sess.gibs")) local kd = 0 + local kr = 0 local timeplayed = tonumber(et.gentity_get(i, "sess.time_axis")) + tonumber(et.gentity_get(i, "sess.time_allies")) if death_time[i] ~= 0 then local diff = et.trap_Milliseconds() - death_time[i] @@ -206,21 +220,16 @@ function topshots_f(id) max_id[7] = i end -- kills per minute - if team == 1 then - if k > 10 then - local kpm = k/(((eomaptime - axis_time[i])/1000)/60) - if kpm > max[8] then - max[8] = kpm - max_id[8] = i - end + if k > 10 then + local kpm = 0 + if eomaptime == 0 then + kpm = k/(((et.trap_Milliseconds() - timeplayed)/1000)/60) + else + kpm = k/(((eomaptime - timeplayed)/1000)/60) end - elseif team == 2 then - if k > 10 then - local kpm = k/(((eomaptime - allies_time[i])/1000)/60) - if kpm > max[8] then - max[8] = kpm - max_id[8] = i - end + if kpm > max[8] then + max[8] = kpm + max_id[8] = i end end -- quickest lightweapon multikill @@ -397,20 +406,51 @@ function topshots_f(id) max[41] = topshots[i][31] max_id[41] = i end - -- most time dead - if timeplayed > 600000 or timeplayed == et.trap_Cvar_Get("timelimit") * 60 * 1000 then - if (death_time_total[i] / timeplayed) * 100 > max[42] then - max[42] = (death_time_total[i] / timeplayed) * 100 + --damage per minute + if dg > 1400 then + local dpm = 0 + if eomaptime == 0 then + dpm = dg/(((et.trap_Milliseconds() - timeplayed)/1000)/60) + else + dpm = dg/(((eomaptime - timeplayed)/1000)/60) + end + if dpm > max[42] then + max[42] = dpm max_id[42] = i - max[44] = death_time_total[i] end end - -- least time dead - if timeplayed > 600000 or timeplayed == et.trap_Cvar_Get("timelimit") * 60 * 1000 then - if (death_time_total[i] / timeplayed) * 100 < max[43] then - max[43] = (death_time_total[i] / timeplayed) * 100 + --tank (damage received/deaths) + if dr > 2000 then + local drdr = 0 + if d ~= 0 then + drdr = (dr / d) / 130 + else + drdr = (dr + 1) / 130 + end + if drdr > 3 then + max[43] = drdr max_id[43] = i - max[45] = death_time_total[i] + end + end + --most useful kills + if topshots[i][34] > max[44] then + max[44] = topshots[i][34] + max_id[44] = i + end + --most time dead + if timeplayed > 600000 or timeplayed == et.trap_Cvar_Get("timelimit") then + if (death_time_total[i] / timeplayed) * 100 > max[45] then + max[45] = (death_time_total[i] / timeplayed) * 100 + max_id[45] = i + max[47] = death_time_total[i] + end + end + -- least time dead + if timeplayed > 600000 or timeplayed == et.trap_Cvar_Get("timelimit") then + if (death_time_total[i] / timeplayed) * 100 < max[46] then + max[46] = (death_time_total[i] / timeplayed) * 100 + max_id[46] = i + max[48] = death_time_total[i] end end end @@ -448,13 +488,28 @@ function topshots_f(id) end end local j = 1 - local players = {} - for j=1, 43 do - if max[j] > 1 or (j == 43 and max[j] == 0) then - if j ~= 10 and j ~= 25 and j ~= 33 then - if j == 8 then + local plyrs = {} + for j=1, 46 do + if max[j] > 1 and (j ~= 46 or (j == 46 and max[j] ~= 100)) then + if j ~= 10 and j ~= 25 and j ~= 33 and j~= 42 then + if j == 1 then + --topshot_sayClients("^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. max[j] .. "\"\n") + table.insert(plyrs, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + max[j] + }) + if max[42] > 1 then + --topshot_sayClients("^z" .. topshot_names[42] .. ": " .. et.gentity_get(max_id[42], "pers.netname") .. " ^z- ^1" .. max[42] .. "\"\n") + table.insert(plyrs, { + topshot_names[42], + et.gentity_get(max_id[42], "pers.netname"), + max[42] + }) + end + elseif j == 8 then --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. "\"\n") - table.insert(players, { + table.insert(plyrs, { topshot_names[j], et.gentity_get(max_id[j], "pers.netname"), roundNum(max[j], 2) @@ -463,7 +518,7 @@ function topshots_f(id) -- dirty "fix" instead of reordering all indexes lol if max[33] > 1 then --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[33] .. ": " .. et.gentity_get(max_id[33], "pers.netname") .. " ^z- ^1" .. max[33] .. "\"\n") - table.insert(players, { + table.insert(plyrs, { topshot_names[33], et.gentity_get(max_id[33], "pers.netname"), max[33] @@ -471,33 +526,40 @@ function topshots_f(id) end --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[25] .. ": " .. et.gentity_get(max_id[25], "pers.netname") .. " ^z- ^1" .. max[25] .. "\"\n") --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. max[j] .. " ^zkills in ^1" .. roundNum(max[10]/1000, 3) .. " ^zseconds\"\n") - table.insert(players, { + table.insert(plyrs, { topshot_names[25], et.gentity_get(max_id[25], "pers.netname"), max[25] }) - table.insert(players, { + table.insert(plyrs, { topshot_names[j], et.gentity_get(max_id[j], "pers.netname"), max[j] .. " ^7kills in " .. roundNum(max[10]/1000, 2) .. "s" }) elseif j == 11 then --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. " ^zm\"\n") - table.insert(players, { + table.insert(plyrs, { topshot_names[j], et.gentity_get(max_id[j], "pers.netname"), roundNum(max[j], 2) .. " ^7m" }) - elseif j == 42 or j == 43 then + elseif j == 43 then + --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. " ^zpercent\"\n") + table.insert(plyrs, { + topshot_names[j], + et.gentity_get(max_id[j], "pers.netname"), + "^7Damage received vs death ratio: " .. roundNum(max[j], 2) .. "^7x" + }) + elseif j == 45 or j == 46 then --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. roundNum(max[j], 2) .. " ^zpercent, ^1" .. roundNum((max[j+2] / 60000), 2) .. " ^zmin\"\n") - table.insert(players, { + table.insert(plyrs, { topshot_names[j], et.gentity_get(max_id[j], "pers.netname"), roundNum(max[j], 2) .. " ^7percent, " .. roundNum((max[j+2] / 60000), 2) .. " ^7min" }) else --et.trap_SendServerCommand(-1, "chat \"^z" .. topshot_names[j] .. ": " .. et.gentity_get(max_id[j], "pers.netname") .. " ^z- ^1" .. max[j] .. "\"\n") - table.insert(players, { + table.insert(plyrs, { topshot_names[j], et.gentity_get(max_id[j], "pers.netname"), max[j] @@ -511,28 +573,28 @@ function topshots_f(id) if ws_max[z] > 1 then if z == 1 then --et.trap_SendServerCommand(-1, "chat \"^zHighest light weapons accuracy: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. roundNum(ws_max[z], 2) .. " ^zpercent\"\n") - table.insert(players, { + table.insert(plyrs, { "Highest light weapons accuracy", et.gentity_get(ws_max_id[z], "pers.netname"), roundNum(ws_max[z], 2) .. " percent" }) elseif z == 2 then --et.trap_SendServerCommand(-1, "chat \"^zHighest headshot accuracy: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. roundNum(ws_max[z], 2) .. " ^zpercent\"\n") - table.insert(players, { + table.insert(plyrs, { "Highest headshot accuracy", et.gentity_get(ws_max_id[z], "pers.netname"), roundNum(ws_max[z], 2) .. " percent" }) elseif z == 3 then --et.trap_SendServerCommand(-1, "chat \"^zMost headshots: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. ws_max[z] .. "\"\n") - table.insert(players, { + table.insert(plyrs, { "Most headshots", et.gentity_get(ws_max_id[z], "pers.netname"), ws_max[z] }) elseif z == 4 then --et.trap_SendServerCommand(-1, "chat \"^zMost bullets fired: " .. et.gentity_get(ws_max_id[z], "pers.netname") .. " ^z- ^1" .. ws_max[z] .. "\"\n") - table.insert(players, { + table.insert(plyrs, { "Most bullets fired", et.gentity_get(ws_max_id[z], "pers.netname"), ws_max[z] @@ -544,7 +606,7 @@ function topshots_f(id) {name = "Award" }, {name = "Player", align = "right"}, {name = "Value", align = "right"}, - }, players) + }, plyrs) local p = 0 for p=0, sv_maxclients-1 do local t = tonumber(et.gentity_get(p, "sess.sessionTeam")) @@ -804,6 +866,16 @@ function et_Obituary(victim, killer, mod) local posv = et.gentity_get(killer, "ps.origin") local killdist = dist(posk, posv) + if v_teamid == 1 then + if redspawn + redlimbo1 / 1000 - ltm2 >= (redlimbo1/1000)/2 and redspawn + redlimbo1 / 1000 - ltm2 > 0 then + topshots[killer][34] = topshots[killer][34] + 1 + end + elseif v_teamid == 2 then + if bluespawn + bluelimbo1 / 1000 - ltm2 >= (bluelimbo1/1000)/2 and bluespawn + bluelimbo1 / 1000 - ltm2 > 0 then + topshots[killer][34] = topshots[killer][34] + 1 + end + end + checkMultiKill(killer, mod) checkKSpreeEnd(victim) checkDSpreeEnd(killer) @@ -943,33 +1015,115 @@ function et_RunFrame(levelTime) end end gamestate = tonumber(et.trap_Cvar_Get("gamestate")) + + if math.fmod(levelTime, 1000) ~= 0 then return end + if gamestate == 0 then + redlimbo1 = tonumber(et.trap_Cvar_Get("g_redlimbotime")) + bluelimbo1 = tonumber(et.trap_Cvar_Get("g_bluelimbotime")) + if redlimbo2 == 0 then + redlimbo2 = redlimbo1 + bluelimbo2 = bluelimbo1 + end + if redlimbo1 ~= redlimbo2 or bluelimbo1 ~= bluelimbo2 then + if redlimbo1 ~= redlimbo2 then + changedred = true + redflag = false + redlimbo2 = redlimbo1 + elseif bluelimbo1 ~= bluelimbo2 then + changedblue = true + blueflag = false + bluelimbo2 = bluelimbo1 + end + end + ltm2 = os.time() + if redflag == true then + if ltm2 == redspawn + redlimbo1 / 1000 then + redspawn = ltm2 + end + end + if blueflag == true then + if ltm2 == bluespawn + bluelimbo1 / 1000 then + bluespawn = ltm2 + end + end + end end function et_ClientBegin(id) local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) - if team == 1 then - axis_time[id] = et.trap_Milliseconds() - elseif team == 2 then - allies_time[id] = et.trap_Milliseconds() + if players[id] == nil then + players[id] = team + end +end + +function et_ClientUserinfoChanged(clientNum) + local team = tonumber(et.gentity_get(clientNum, "sess.sessionTeam")) + if players[clientNum] == nil then + players[clientNum] = team + end + if players[clientNum] ~= team then + spawns[clientNum] = nil end + players[clientNum] = team end function et_ClientSpawn(id, revived) killing_sprees[id] = 0 local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) if revived ~= 1 then - if team == 1 and axis_time[id] == 0 then - axis_time[id] = et.trap_Milliseconds() - elseif team == 2 and allies_time[id] == 0 then - allies_time[id] = et.trap_Milliseconds() - elseif team == 3 then - axis_time[id] = 0 - allies_time[id] = 0 + local health = tonumber(et.gentity_get(id, "health")) + local team = tonumber(et.gentity_get(id, "sess.sessionTeam")) + if team == 1 then + if health > 0 then + if redflag == false then + if spawns[id] == nil then + spawns[id] = 1 + else + spawns[id] = spawns[id] + 1 + end + if spawns[id] == 2 then + redflag = true + redspawn = os.time() + end + if changedred == true then + redflag = true + redspawn = os.time() + changedred = false + end + end + redspawn2 = os.time() + if redspawn ~= 0 and redspawn ~= redspawn2 then + redspawn = redspawn2 + end + end + elseif team == 2 then + if health > 0 then + if blueflag == false then + if spawns[id] == nil then + spawns[id] = 1 + else + spawns[id] = spawns[id] + 1 + end + if spawns[id] == 2 then + blueflag = true + bluespawn = os.time() + end + if changedblue == true then + blueflag = true + bluespawn = os.time() + changedblue = false + end + end + bluespawn2 = os.time() + if bluespawn ~= 0 and bluespawn ~= bluespawn2 then + bluespawn = bluespawn2 + end + end end end hitters[id] = {nil, nil, nil, nil} hitRegionsData[id] = getAllHitRegions(id) - if team == 2 or team == 3 then + if team == 1 or team == 2 then if death_time[id] ~= 0 then local diff = et.trap_Milliseconds() - death_time[id] death_time_total[id] = death_time_total[id] + diff @@ -981,9 +1135,7 @@ end function et_ClientDisconnect(id) killing_sprees[id] = 0 death_sprees[id] = 0 - topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0, [32]=0, [33]=0} - axis_time[id] = 0 - allies_time[id] = 0 + topshots[id] = { [1]=0, [2]=0, [3]=0, [4]=0, [5]=0, [6]=0, [7]=0, [8]=0, [9]=0, [10]=0, [11]=0, [12]=0, [13]=0, [14]=0, [15]=0, [16]=0, [17]=0, [18]=0, [19]=0, [20]=0, [21]=0, [22]=0, [23]=0, [24]=0, [25]=0, [26]=0, [27]=0, [28]=0, [29]=0, [30]=0, [31]=0, [32]=0, [33]=0, [34]=0} mkps[id] = { [1]=0, [2]=0, [3]=0 } vsstats[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} vsstats_kills[id]={[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,[11]=0,[12]=0,[13]=0,[14]=0,[15]=0,[16]=0,[17]=0,[18]=0,[19]=0,[20]=0,[21]=0,[22]=0,[23]=0,[24]=0,[25]=0,[26]=0,[27]=0,[28]=0,[29]=0,[30]=0,[31]=0,[32]=0,[33]=0,[34]=0,[35]=0,[36]=0,[37]=0,[38]=0,[39]=0,[40]=0,[41]=0,[42]=0,[43]=0,[44]=0,[45]=0,[46]=0,[47]=0,[48]=0,[49]=0,[50]=0,[51]=0,[52]=0,[53]=0,[54]=0,[55]=0,[56]=0,[57]=0,[58]=0,[59]=0,[60]=0,[61]=0,[62]=0,[63]=0} @@ -1003,6 +1155,8 @@ function et_ClientDisconnect(id) hitters[id] = {nil, nil, nil, nil} death_time[id] = 0 death_time_total[id] = 0 + players[id] = nil + spawns[id] = nil end --- Sends a nice table to a client. From 4dcfc6bba714974e6f86e2fd8d1503fd3c3bc1ba Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 29 Jan 2024 18:05:04 +0100 Subject: [PATCH 49/71] Add files via upload --- endstats.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/endstats.lua b/endstats.lua index 3e314c8..f2962a3 100644 --- a/endstats.lua +++ b/endstats.lua @@ -50,6 +50,7 @@ redlimbo2 = 0 bluelimbo2 = 0 changedred = false changedblue = false +paused = false topshot_names = { [1]="Most damage given", [2]="Most damage received", [3]="Most team damage given", [4]="Most team damage received", [5]="Most teamkills", [6]="Most selfkills", [7]="Most deaths", [8]="Most kills per minute", [9]="Quickest multikill w/ light weapons", [11]="Farthest riflenade kill", [12]="Most light weapon kills", [13]="Most pistol kills", [14]="Most rifle kills", [15]="Most riflenade kills", [16]="Most sniper kills", [17]="Most knife kills", [18]="Most air support kills", [19]="Most mine kills", [20]="Most grenade kills", [21]="Most panzer kills", [22]="Most mortar kills", [23]="Most panzer deaths", [24]="Mortarmagnet", [25]="Most multikills", [26]="Most MG42 kills", [27]="Most MG42 deaths", [28]="Most revives", [29]="Most revived", [30]="Best K/D ratio", [31]="Most dynamites planted", [32]="Most dynamites defused", [33]="Most doublekills", [34]="Longest killing spree", [35]="Longest death spree", [36]="Most objectives stolen", [37]="Most objectives returned", [38]="Most corpse gibs", [39]="Most kill assists", [40]="Most killsteals", [41]="Most headshot kills", [42]="Most damage per minute", [43]="Tank/Meatshield (Refuses to die)", [44]="Most useful kills (>Half respawn time left)", [45]="Full respawn king", [46]="Least time dead (What spawn?)"} @@ -1005,6 +1006,22 @@ function checkDSpreeEnd(id) end function et_RunFrame(levelTime) + if math.fmod(levelTime, 100) ~= 0 then return end + local cs = tonumber(et.trap_GetConfigstring(et.CS_SERVERTOGGLES)) + if paused == false then + if (1 << 4 & cs) == 1 then + paused = true + changedred = true + redflag = false + changedblue = true + blueflag = false + end + elseif paused = true then + if (1 << 4 & cs) == 0 then + paused = false + end + end + if math.fmod(levelTime, 500) ~= 0 then return end local ltm = et.trap_Milliseconds() From 030bfbbe35775bad83dbc4e7e261010e6a206cba Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 13 Feb 2024 06:50:42 +0100 Subject: [PATCH 50/71] Update endstats.lua --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index f2962a3..e088b28 100644 --- a/endstats.lua +++ b/endstats.lua @@ -1016,7 +1016,7 @@ function et_RunFrame(levelTime) changedblue = true blueflag = false end - elseif paused = true then + elseif paused == true then if (1 << 4 & cs) == 0 then paused = false end From bb8f82e23235265f3f6d29081f9ce63d30c095b9 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 14 Feb 2024 10:46:48 +0100 Subject: [PATCH 51/71] Add files via upload --- endstats.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/endstats.lua b/endstats.lua index e088b28..42b3060 100644 --- a/endstats.lua +++ b/endstats.lua @@ -224,9 +224,9 @@ function topshots_f(id) if k > 10 then local kpm = 0 if eomaptime == 0 then - kpm = k/(((et.trap_Milliseconds() - timeplayed)/1000)/60) + kpm = k/((timeplayed/1000)/60) else - kpm = k/(((eomaptime - timeplayed)/1000)/60) + kpm = k/((timeplayed/1000)/60) end if kpm > max[8] then max[8] = kpm From 521218cc0983a844eb0a05782db784229a4d0bd2 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 14 Feb 2024 11:00:35 +0100 Subject: [PATCH 52/71] Add files via upload --- endstats.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/endstats.lua b/endstats.lua index 42b3060..9e39996 100644 --- a/endstats.lua +++ b/endstats.lua @@ -223,11 +223,7 @@ function topshots_f(id) -- kills per minute if k > 10 then local kpm = 0 - if eomaptime == 0 then - kpm = k/((timeplayed/1000)/60) - else - kpm = k/((timeplayed/1000)/60) - end + kpm = k/((timeplayed/1000)/60) if kpm > max[8] then max[8] = kpm max_id[8] = i From b8846303d4b5af2a9e8ced00fd3a5f09003bf8ec Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 14 Feb 2024 11:08:08 +0100 Subject: [PATCH 53/71] Add files via upload --- endstats.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/endstats.lua b/endstats.lua index 9e39996..756afb8 100644 --- a/endstats.lua +++ b/endstats.lua @@ -406,11 +406,7 @@ function topshots_f(id) --damage per minute if dg > 1400 then local dpm = 0 - if eomaptime == 0 then - dpm = dg/(((et.trap_Milliseconds() - timeplayed)/1000)/60) - else - dpm = dg/(((eomaptime - timeplayed)/1000)/60) - end + dpm = dg/((timeplayed/1000)/60) if dpm > max[42] then max[42] = dpm max_id[42] = i From 96c2eea5b3668334d011bec23cb58bc582d0aa1d Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sun, 18 Feb 2024 10:11:19 +0100 Subject: [PATCH 54/71] Update ETWsk.lua --- ETWsk.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ETWsk.lua b/ETWsk.lua index cc33fda..34eee84 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -855,7 +855,7 @@ function printSpawns(cno) et.trap_SendServerCommand(cno,"chat \"^3ATTENTION:^7 Mapname: ^3"..mapname.."\n\"") end for i,spawn in pairs(c.spawns) do - if cno == -1 then et.G_Print("ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state]) + if cno == -1 then et.G_Print(string.format("ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state])) else et.trap_SendServerCommand(cno, "chat \"^3ATTENTION:^7 Spawn ^3"..i.."^7 "..spawn.name.." "..protect[spawn.state].."\n\"") end end From 9a0b7711b188f3581888c2a658ce8082d4e57537 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Sat, 9 Mar 2024 19:16:29 +0100 Subject: [PATCH 55/71] Add files via upload --- ETWsk.lua | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index 34eee84..31b9f06 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -44,13 +44,13 @@ Author = "[ETW-FZ] Mad@Mat" -------------------------------------------------------------------------------- ETWsk_putspec = 1 -- number of sk's needed for setting a client -- to spectators -ETWsk_kick = 99 -- number of sk's needed for kicking a client -ETWsk_kicklen = 20*60 -- duration of kick +ETWsk_kick = 3 -- number of sk's needed for kicking a client +ETWsk_kicklen = 5 -- duration of kick -- benny ----------------------------------------------------------------------- ETWsk_persistentoffender = 1 -- enable punishment 4 persistent spawn killers ETWsk_POThreshold = 2 -- if players has been kicked before, he will -- be temp banned with his XX spawn kill -ETWsk_banval = 30*60 -- (ETWsk_banval * 4 ^ kicksb4) = ban +ETWsk_banval = 30 -- (ETWsk_banval * 4 ^ kicksb4) = ban -- If ETWsk_banval = 30, he'll be kicked 4 -- 120 minutes, next is 480, 1920, 7680, ... ETWsk_pofile = "ETWsk_PO.txt" -- save to /etpro/ETWsk_PO.txt @@ -285,6 +285,10 @@ function getConfig(map) c.spawns[5] = {name = "Allied Entrance", state = PROTECT_ALLIES, pos = {-857, -8050, 328}, radius2 = 870} c.spawns[10] = {name = "Tunnel Spawn", state = NO_PROTECT, pos = {-6165, -1288, 344}, radius2 = 300} c.spawns[11] = {name = "Axis Fuel Dump Lower Exit", state = PROTECT_AXIS, pos = {-8977, -7310, 232}, radius2 = 200} + c.spawns[12] = {name = "Axis Garage", state = PROTECT_AXIS, pos = {-10614, -6452, 232}, radius2 = 250} + c.spawns[13] = {name = "Axis Garage2", state = PROTECT_AXIS, pos = {-10792, -6416, 232}, radius2 = 120} + c.spawns[14] = {name = "Axis Garage3", state = PROTECT_AXIS, pos = {-10622, -6575, 408}, radius2 = 80} + c.spawns[15] = {name = "Axis Garage2", state = PROTECT_AXIS, pos = {-10819, -6576, 408}, radius2 = 150} c.actions[1] = {spawn = 1, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} c.actions[2] = {spawn = 6, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} c.actions[3] = {spawn = 7, newstate = PROTECT_ALLIES, trigger = "breached the Tunnel Doors"} @@ -320,6 +324,14 @@ function getConfig(map) c.spawns[13] = {name = "Axis Roof3", state = PROTECT_AXIS, pos = {-1277, -386, 296}, radius2 = 400} c.spawns[14] = {name = "Axis Roof4", state = PROTECT_AXIS, pos = {-1701, -149, 296}, radius2 = 200} + elseif map =="et_operation_b3" then + c.spawns[1] = {name = "Axis Main Spawn", state = PROTECT_AXIS, pos = {2307, -3920, 80}, radius2 = 400} + c.spawns[2] = {name = "Axis Garage Spawns", state = PROTECT_AXIS, pos = {3075, -3874, -195}, radius2 = 400} + c.spawns[3] = {name = "Allied North Hut", state = PROTECT_ALLIES, pos = {6787, -2102, 80}, radius2 = 260} + c.spawns[4] = {name = "Allied South Hut", state = PROTECT_ALLIES, pos = {6621, -2710, 80}, radius2 = 230} + c.spawns[5] = {name = "Allied South Hut2", state = PROTECT_ALLIES, pos = {6600, -2778, 80}, radius2 = 200} + + -- Braundorf B4 16.11.2008 elseif map == "braundorf_b4" or map == "braundorf_final" then c.spawns[1] = {name = "Factory District", state = NO_PROTECT, pos = {3505, -2355, 320}, radius2 = 375} @@ -349,6 +361,8 @@ function getConfig(map) c.spawns[4] = {name = "Allied Camp Base", state = PROTECT_ALLIES, pos = {1250, 2760, -400}, radius2 = 1140} c.spawns[5] = {name = "Allied Camp Water Pump", state = NO_PROTECT, pos = {2584, 2144, -592}, radius2 = 1000} c.spawns[6] = {name = "Axis Garrison Above", state = PROTECT_AXIS, pos = {7378, 4090, -199}, radius2 = 190} + c.spawns[7] = {name = "Axis Garrison Above2", state = PROTECT_AXIS, pos = {7151, 4289, -143}, radius2 = 230} + c.spawns[8] = {name = "Axis Garrison Above3", state = PROTECT_AXIS, pos = {7050, 4815, -143}, radius2 = 200} c.actions[1] = {spawn = 2, newstate = PROTECT_ALLIES, trigger = "breached the Old City wall"} c.actions[2] = {spawn = 4, newstate = NO_PROTECT, trigger = "Allies have built the Oasis Water"} c.actions[3] = {spawn = 5, newstate = PROTECT_ALLIES, trigger = "Allies have built the Oasis Water"} @@ -356,7 +370,7 @@ function getConfig(map) c.actions[5] = {spawn = 5, newstate = NO_PROTECT, trigger = "Axis have damaged the Oasis Water"} -- Goldrush 25.11.2008 -- Goldrush 05.10.2018 - disabled Allied spawnroof protection when truck with gold is near truck barrier #2 - elseif map == "goldrush" or map == "sw_goldrush_te" or map == "uje_goldrush" then + elseif map == "goldrush" or map == "sw_goldrush_te" or map == "uje_goldrush" or map == "goldrush-gals" then c.spawns[1] = {name = "Tank Depot Main Exit", state = PROTECT_AXIS, pos = {-79, 3005, 320}, radius2 = 250} c.spawns[4] = {name = "Tank Depot Alternate Exit", state = PROTECT_AXIS, pos = {-664, 3541, 386}, radius2 = 420} c.spawns[5] = {name = "Tank Depot Room", state = PROTECT_AXIS, pos = {-48, 3649, 344}, radius2 = 550} @@ -855,7 +869,7 @@ function printSpawns(cno) et.trap_SendServerCommand(cno,"chat \"^3ATTENTION:^7 Mapname: ^3"..mapname.."\n\"") end for i,spawn in pairs(c.spawns) do - if cno == -1 then et.G_Print(string.format("ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state])) + if cno == -1 then et.G_Print(string.format("ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state])) else et.trap_SendServerCommand(cno, "chat \"^3ATTENTION:^7 Spawn ^3"..i.."^7 "..spawn.name.." "..protect[spawn.state].."\n\"") end end @@ -971,19 +985,19 @@ function ClientSpawnkill(victim, killer, isheavy) local kicksb4 = isPO(killer) if kicksb4 > 0 then - et.trap_DropClient(killer, "temp ban - "..kicksb4.." former kicks for spawn killing!", (ETWsk_banval * math.pow(1,kicksb4))) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2has been temp banned - repeated spawn killing!\"\n") spawnkills[killer] = nil addPO (killer) savePO(ETWsk_pofile) + et.trap_DropClient(killer, "temp ban - "..kicksb4.." former kicks for spawn killing!", (ETWsk_banval * math.pow(1,kicksb4))) + et.G_LogPrint("LUA event: temp SK ban for " .. killername .. " - ".. kicksb4 .. " former kicks for spawn killing\n") return end end - et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^1WARNING: ^2Spawn kill (#".. - numsk..") by ^7"..killername.."\"\n" ) - et.trap_SendServerCommand(killer, "cp \""..killername.." : ^1DO NOT SPAWN KILL!!! \"\n") + --et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^1WARNING: ^2Spawn kill (#"..numsk..") by ^7"..killername.."\"\n" ) + --et.trap_SendServerCommand(killer, "cp \""..killername.." : ^1DO NOT SPAWN KILL!!! \"\n") if(numsk >= ETWsk_putspec and numsk < ETWsk_kick) then et.trap_SendConsoleCommand(et.EXEC_APPEND, putspec(killer)) @@ -991,13 +1005,15 @@ function ClientSpawnkill(victim, killer, isheavy) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2was set to Spectators - too many Spawnkills!\"\n") et.trap_SendServerCommand( killer, - "bp \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") + "cpm \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") + et.G_LogPrint("LUA event: " .. killername .. " sent to spectators for spawnkilling (" .. numsk .. " SK)\n") elseif(numsk == ETWsk_kick) then - et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. " ^2has been kicked - too many spawn kills!\"\n") addPO(killer) savePO(ETWsk_pofile) + et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) + et.G_LogPrint("LUA event: temp SK ban for " .. killername .. "\n") elseif(numsk > ETWsk_kick) then -- do nothing you dumb shit else From e09bc06814625cf06f302c9e3e7a13eeddb3df17 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 12 Mar 2024 18:09:26 +0100 Subject: [PATCH 56/71] Add files via upload --- endstats.lua | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/endstats.lua b/endstats.lua index 756afb8..f28a5d1 100644 --- a/endstats.lua +++ b/endstats.lua @@ -133,23 +133,25 @@ function hitType(clientNum) end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) - if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then - if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then - local v_team = et.gentity_get(target, "sess.sessionTeam") - local k_team = et.gentity_get(attacker, "sess.sessionTeam") - local v_health = et.gentity_get(target, "health") - local hitType = hitType(attacker) - if hitType == HR_HEAD then - if not has_value(explosives, meansOfDeath) then - hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} - if v_team ~= k_team then - if damage >= v_health then - topshots[attacker][31] = topshots[attacker][31] + 1 + if gamestate == 0 then + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then + if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then + local v_team = et.gentity_get(target, "sess.sessionTeam") + local k_team = et.gentity_get(attacker, "sess.sessionTeam") + local v_health = et.gentity_get(target, "health") + local hitType = hitType(attacker) + if hitType == HR_HEAD then + if not has_value(explosives, meansOfDeath) then + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} + if v_team ~= k_team then + if damage >= v_health then + topshots[attacker][31] = topshots[attacker][31] + 1 + end end end + else + hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} end - else - hitters[target][et.trap_Milliseconds()] = {[1]=attacker, [2]=damage, [3]=meansOfDeath} end end end From 04d1b47f944f25ca006eac4b8f804df29255e571 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Thu, 14 Mar 2024 10:48:56 +0100 Subject: [PATCH 57/71] Add files via upload --- ETWsk.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ETWsk.lua b/ETWsk.lua index 31b9f06..0de60a4 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -946,6 +946,9 @@ function et_Obituary(victim, killer, meansOfDeath) local isheavy = false for k,v in pairs(heavyweapons) do if (meansOfDeath == v) then isheavy = true end + if mapname == "goldrush" or mapname == "goldrush-gals" then -- don't punish tank mg + if (meansOfDeath == 3) then isheavy = false end + end end -- protected spawn? local vpos = et.gentity_get(victim, "r.currentOrigin") From 4ba0037031e785b3e589a05150a0eb40ebc523b6 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 19 Mar 2024 15:53:37 +0100 Subject: [PATCH 58/71] Add +1 XP for kill assist --- killassists.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/killassists.lua b/killassists.lua index 43274e8..de5cf26 100644 --- a/killassists.lua +++ b/killassists.lua @@ -313,6 +313,7 @@ function et_Obituary(victim, killer, mod) if announce_killer == true then et.trap_SendServerCommand(killer, "chat \"^zKill Assists: " .. names_cens .. "\";") end + et.G_AddSkillPoints(max_id, et.SK_BATTLE_SENSE, 1, "KillAssist") end else if names ~= "" then From 2ec316eb796c3e59aba1d9effedf54553914d596 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 20 Mar 2024 10:19:38 +0100 Subject: [PATCH 59/71] Update endstats.lua --- endstats.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endstats.lua b/endstats.lua index f28a5d1..39f4564 100644 --- a/endstats.lua +++ b/endstats.lua @@ -134,7 +134,7 @@ end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) if gamestate == 0 then - if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 and not (tonumber(target) < 0) and not (tonumber(target) > tonumber(et.trap_Cvar_Get("sv_maxclients"))) then if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then local v_team = et.gentity_get(target, "sess.sessionTeam") local k_team = et.gentity_get(attacker, "sess.sessionTeam") From 47d1341030c8aac3de5d278c17ae801b154fcf06 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 20 Mar 2024 10:19:57 +0100 Subject: [PATCH 60/71] Update killassists.lua --- killassists.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/killassists.lua b/killassists.lua index de5cf26..0cdb48e 100644 --- a/killassists.lua +++ b/killassists.lua @@ -108,7 +108,7 @@ function hitType(clientNum) end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) - if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 then + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 and not (tonumber(target) < 0) and not (tonumber(target) > tonumber(et.trap_Cvar_Get("sv_maxclients"))) then if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then local hitType = hitType(attacker) if hitType == HR_HEAD then From 5e1225f9334bc1ab0c08f47204ed871af0c48f5d Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 19 Apr 2024 20:45:32 +0200 Subject: [PATCH 61/71] Update endstats.lua --- endstats.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/endstats.lua b/endstats.lua index 39f4564..191f87f 100644 --- a/endstats.lua +++ b/endstats.lua @@ -857,8 +857,8 @@ function et_Obituary(victim, killer, mod) deaths[victim] = deaths[victim] + 1 worst_enemy[victim][killer] = worst_enemy[victim][killer] + 1 easiest_prey[killer][victim] = easiest_prey[killer][victim] + 1 - local posk = et.gentity_get(victim, "ps.origin") - local posv = et.gentity_get(killer, "ps.origin") + local posk = et.gentity_get(killer, "ps.origin") + local posv = et.gentity_get(victim, "ps.origin") local killdist = dist(posk, posv) if v_teamid == 1 then From bbd0f94d48ec97b48f67015cb3e89d92836599b9 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 24 Apr 2024 09:56:29 +0200 Subject: [PATCH 62/71] Add files via upload --- suddendeath.lua | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/suddendeath.lua b/suddendeath.lua index 9b06551..d5a0454 100644 --- a/suddendeath.lua +++ b/suddendeath.lua @@ -26,7 +26,7 @@ stuck_time = 0 intervals = {[1]=0, [2]=0} sudden_death = false first_obj = false -sw_sd_disabled = false +sw_flag = false -- Constans COLOR = {} @@ -34,27 +34,19 @@ COLOR.PLACE = '^8' COLOR.TEXT = '^w' COLOR.TIME = '^8' -- this constat is changing in the print_message() function -CHAT = "bp" +CHAT = "cpm" POPUP = "legacy" timer = {} +OLD = os.time() + function et_InitGame(levelTime, randomSeed, restart) et.RegisterModname("suddendeath.lua" .. et.FindSelf()) mapname = string.lower(et.trap_Cvar_Get("mapname")) gametype = tonumber(et.trap_Cvar_Get("g_gametype")) - local alliedwins = tonumber(et.trap_Cvar_Get("g_alliedWins")) - local maptime = et.trap_Cvar_Get("timelimit") if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then - if alliedwins == 1 then - sw_sd_disabled = true - else - if maptime > et.trap_Cvar_Get("sd_defaulttime") - sw_sd_disabled = true - end - end - else - et.trap_Cvar_Set("sd_defaulttime", maptime) + sw_flag = true end end @@ -187,9 +179,9 @@ function et_Print( text ) print_message(-1, -1, timer[index]["place"]) --et.G_LogPrint("dynamite set: " .. index .. "\n") - if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then + if gametype ~= 3 or (gametype == 3 and sw_flag == false) then if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then - if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then + if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the Bunker Controls" or plant == "the Axis Submarine" then local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... local timeleft timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) @@ -250,7 +242,7 @@ function et_Print( text ) if team == "axis" then team = 1 else team = 2 end - if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then + if gametype ~= 3 or (gametype == 3 and sw_flag == false) then if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then if sudden_death == true then @@ -300,9 +292,9 @@ function et_Print( text ) if start2 and stop2 then start2,stop2,plant = string.find(text, POPUP .. " announce: \"([^%\"]*)\"") if start2 and stop2 then -- dynamite planted - if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then + if gametype ~= 3 or (gametype == 3 and sw_flag == false) then if mapname == "oasis" or mapname == "sw_oasis_b3" then - if plant == "Allied team has destroyed the South Anti-Tank Gun!" or plant == "Allied team has destroyed the North Anti-Tank Gun!" then + if plant == "^7Allies have destroyed the North Anti-Tank Gun!" or plant == "^7Allies have destroyed the South Anti-Tank Gun!" or plant == "^7Allied team has destroyed the South Anti-Tank Gun!" or plant == "^7Allied team has destroyed the North Anti-Tank Gun!" then if first_obj == false then first_obj = true else @@ -310,7 +302,7 @@ function et_Print( text ) end end elseif mapname == "erdenberg_t2" then - if plant == "The West Flak88 has been destroyed!" or plant == "The East Flak88 has been destroyed!" then + if plant == "^7^dAllies have destroyed the West Flak88!" or plant == "^7^dAllies have destroyed the East Flak88!" then if first_obj == false then first_obj = true else @@ -318,7 +310,7 @@ function et_Print( text ) end end elseif mapname == "tc_base" then - if plant == "Allied team has disabled the South Radar!" or plant == "Allied team has disabled the North Radar!" then + if plant == "^7Allied team has disabled the South Radar!" or plant == "^7Allied team has disabled the North Radar!" then if first_obj == false then first_obj = true else From f3bd6ae50f8f3babc229560ab86117d1c5c46d3f Mon Sep 17 00:00:00 2001 From: x0rnn Date: Wed, 24 Apr 2024 10:16:13 +0200 Subject: [PATCH 63/71] Add files via upload --- suddendeath.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/suddendeath.lua b/suddendeath.lua index d5a0454..c60f519 100644 --- a/suddendeath.lua +++ b/suddendeath.lua @@ -26,7 +26,7 @@ stuck_time = 0 intervals = {[1]=0, [2]=0} sudden_death = false first_obj = false -sw_flag = false +sw_sd_disabled = false -- Constans COLOR = {} @@ -39,14 +39,22 @@ POPUP = "legacy" timer = {} -OLD = os.time() - function et_InitGame(levelTime, randomSeed, restart) et.RegisterModname("suddendeath.lua" .. et.FindSelf()) mapname = string.lower(et.trap_Cvar_Get("mapname")) gametype = tonumber(et.trap_Cvar_Get("g_gametype")) + local alliedwins = tonumber(et.trap_Cvar_Get("g_alliedWins")) + local maptime = et.trap_Cvar_Get("timelimit") if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then - sw_flag = true + if alliedwins == 1 then + sw_sd_disabled = true + else + if maptime > et.trap_Cvar_Get("sd_defaulttime") + sw_sd_disabled = true + end + end + else + et.trap_Cvar_Set("sd_defaulttime", maptime) end end @@ -179,7 +187,7 @@ function et_Print( text ) print_message(-1, -1, timer[index]["place"]) --et.G_LogPrint("dynamite set: " .. index .. "\n") - if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the Bunker Controls" or plant == "the Axis Submarine" then local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... @@ -242,7 +250,7 @@ function et_Print( text ) if team == "axis" then team = 1 else team = 2 end - if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then if sudden_death == true then @@ -292,7 +300,7 @@ function et_Print( text ) if start2 and stop2 then start2,stop2,plant = string.find(text, POPUP .. " announce: \"([^%\"]*)\"") if start2 and stop2 then -- dynamite planted - if gametype ~= 3 or (gametype == 3 and sw_flag == false) then + if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then if mapname == "oasis" or mapname == "sw_oasis_b3" then if plant == "^7Allies have destroyed the North Anti-Tank Gun!" or plant == "^7Allies have destroyed the South Anti-Tank Gun!" or plant == "^7Allied team has destroyed the South Anti-Tank Gun!" or plant == "^7Allied team has destroyed the North Anti-Tank Gun!" then if first_obj == false then @@ -302,7 +310,7 @@ function et_Print( text ) end end elseif mapname == "erdenberg_t2" then - if plant == "^7^dAllies have destroyed the West Flak88!" or plant == "^7^dAllies have destroyed the East Flak88!" then + if plant == "^7The West Flak88 has been destroyed!" or plant == "^7The East Flak88 has been destroyed!" then if first_obj == false then first_obj = true else From 31a794ea415b054a5a0a12680b8c5a24bedd9797 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 3 May 2024 11:30:55 +0200 Subject: [PATCH 64/71] Add files via upload --- ETWsk.lua | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index 0de60a4..13b6194 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -44,7 +44,7 @@ Author = "[ETW-FZ] Mad@Mat" -------------------------------------------------------------------------------- ETWsk_putspec = 1 -- number of sk's needed for setting a client -- to spectators -ETWsk_kick = 3 -- number of sk's needed for kicking a client +ETWsk_kick = 2 -- number of sk's needed for kicking a client ETWsk_kicklen = 5 -- duration of kick -- benny ----------------------------------------------------------------------- ETWsk_persistentoffender = 1 -- enable punishment 4 persistent spawn killers @@ -63,7 +63,7 @@ ETWsk_expires = 0 -- if enabled, spawn protection expires when -- the victim hurts an enemy -- benny ----------------------------------------------------------------------- sinbin = true -- [true|false] -sinbin_duration = 15000 -- in milliseconds: 30000 = 30 seconds +sinbin_duration = 300000 -- in milliseconds: 30000 = 30 seconds sinbin_pos = "chat" -- prints to client on sin bin, "b 8 " = chat area -------------------------------------------------------------------------------- @@ -993,7 +993,7 @@ function ClientSpawnkill(victim, killer, isheavy) spawnkills[killer] = nil addPO (killer) savePO(ETWsk_pofile) - et.trap_DropClient(killer, "temp ban - "..kicksb4.." former kicks for spawn killing!", (ETWsk_banval * math.pow(1,kicksb4))) + et.trap_DropClient(killer, "temp ban - "..kicksb4.." former kicks for spawn killing!", (ETWsk_banval * (2^kicksb4))) et.G_LogPrint("LUA event: temp SK ban for " .. killername .. " - ".. kicksb4 .. " former kicks for spawn killing\n") return end @@ -1010,15 +1010,16 @@ function ClientSpawnkill(victim, killer, isheavy) et.trap_SendServerCommand( killer, "cpm \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") et.G_LogPrint("LUA event: " .. killername .. " sent to spectators for spawnkilling (" .. numsk .. " SK)\n") - elseif(numsk == ETWsk_kick) then - et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. - " ^2has been kicked - too many spawn kills!\"\n") - addPO(killer) - savePO(ETWsk_pofile) - et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) - et.G_LogPrint("LUA event: temp SK ban for " .. killername .. "\n") - elseif(numsk > ETWsk_kick) then - -- do nothing you dumb shit + elseif(numsk >= ETWsk_kick) then + local kteam = et.gentity_get(killer, "sess.sessionTeam") + if kteam ~= 3 then + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. + " ^2has been kicked - too many spawn kills!\"\n") + addPO(killer) + savePO(ETWsk_pofile) + et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) + et.G_LogPrint("LUA event: temp spawnkill ban for " .. killername .. " (" .. numsk .. " SK)\n") + end else et.gentity_set(killer, "health", -511) end From dc94490eb975207fa261469cc958472207a881a4 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Tue, 7 May 2024 15:52:10 +0200 Subject: [PATCH 65/71] Update killassists.lua --- killassists.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/killassists.lua b/killassists.lua index 0cdb48e..6b31cfa 100644 --- a/killassists.lua +++ b/killassists.lua @@ -332,8 +332,8 @@ function et_Obituary(victim, killer, mod) end if v_teamid ~= k_teamid then if announce_hp == true then - local posk = et.gentity_get(victim, "ps.origin") - local posv = et.gentity_get(killer, "ps.origin") + local posk = et.gentity_get(killer, "ps.origin") + local posv = et.gentity_get(victim, "ps.origin") local killdist = dist(posk, posv) local killerhp = et.gentity_get(killer, "health") local C2 = 2 From 7601b32731d2e00797370a8a55e8f2efb88341a9 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 13 May 2024 10:24:51 +0200 Subject: [PATCH 66/71] Add files via upload --- ETWsk.lua | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index 13b6194..b5bf3d4 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -988,13 +988,13 @@ function ClientSpawnkill(victim, killer, isheavy) local kicksb4 = isPO(killer) if kicksb4 > 0 then - et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. - " ^2has been temp banned - repeated spawn killing!\"\n") + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3has been temp banned - repeated spawn killing!\"\n") spawnkills[killer] = nil addPO (killer) savePO(ETWsk_pofile) et.trap_DropClient(killer, "temp ban - "..kicksb4.." former kicks for spawn killing!", (ETWsk_banval * (2^kicksb4))) et.G_LogPrint("LUA event: temp SK ban for " .. killername .. " - ".. kicksb4 .. " former kicks for spawn killing\n") + et.G_globalSound("sound/misc/duke_crapouttahere.wav") return end end @@ -1003,23 +1003,22 @@ function ClientSpawnkill(victim, killer, isheavy) --et.trap_SendServerCommand(killer, "cp \""..killername.." : ^1DO NOT SPAWN KILL!!! \"\n") if(numsk >= ETWsk_putspec and numsk < ETWsk_kick) then - et.trap_SendConsoleCommand(et.EXEC_APPEND, putspec(killer)) + et.trap_SendConsoleCommand( et.EXEC_APPEND, "ref remove " .. killer .. "\n" ) sinbinhash[killer] = et.trap_Milliseconds() + sinbin_duration - et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. - " ^2was set to Spectators - too many Spawnkills!\"\n") - et.trap_SendServerCommand( killer, - "cpm \"^3ATTENTION: ^1WARNING: ^2You were set to Spectator \"\n") + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3was set to Spectators - too many Spawnkills!\"\n") + et.trap_SendServerCommand( killer, "cpm \"^3ATTENTION: ^1WARNING: ^3You were set to Spectator\"\n") et.G_LogPrint("LUA event: " .. killername .. " sent to spectators for spawnkilling (" .. numsk .. " SK)\n") elseif(numsk >= ETWsk_kick) then - local kteam = et.gentity_get(killer, "sess.sessionTeam") - if kteam ~= 3 then - et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.. - " ^2has been kicked - too many spawn kills!\"\n") - addPO(killer) - savePO(ETWsk_pofile) - et.trap_DropClient(killer, "too many spawn kills!", ETWsk_kicklen) - et.G_LogPrint("LUA event: temp spawnkill ban for " .. killername .. " (" .. numsk .. " SK)\n") - end + if et.gentity_get(killer, "inuse") then + local kteam = et.gentity_get(killer, "sess.sessionTeam") + if kteam ~= 3 then + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3has been kicked - too many spawnkills!\"\n") + addPO(killer) + savePO(ETWsk_pofile) + et.trap_DropClient(killer, "Kicked for too many spawnkills!", ETWsk_kicklen) + et.G_LogPrint("LUA event: temp spawnkill ban for " .. killername .. " (" .. numsk .. " SK)\n") + end + end else et.gentity_set(killer, "health", -511) end From 1381bc5bd69371e109d0d22f6b51e941690f5f14 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Thu, 16 May 2024 19:37:54 +0200 Subject: [PATCH 67/71] Add files via upload --- ETWsk.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ETWsk.lua b/ETWsk.lua index b5bf3d4..06ca37a 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -46,6 +46,7 @@ ETWsk_putspec = 1 -- number of sk's needed for setting a client -- to spectators ETWsk_kick = 2 -- number of sk's needed for kicking a client ETWsk_kicklen = 5 -- duration of kick +first_sk = 0 -- benny ----------------------------------------------------------------------- ETWsk_persistentoffender = 1 -- enable punishment 4 persistent spawn killers ETWsk_POThreshold = 2 -- if players has been kicked before, he will @@ -1007,16 +1008,21 @@ function ClientSpawnkill(victim, killer, isheavy) sinbinhash[killer] = et.trap_Milliseconds() + sinbin_duration et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3was set to Spectators - too many Spawnkills!\"\n") et.trap_SendServerCommand( killer, "cpm \"^3ATTENTION: ^1WARNING: ^3You were set to Spectator\"\n") - et.G_LogPrint("LUA event: " .. killername .. " sent to spectators for spawnkilling (" .. numsk .. " SK)\n") + et.G_LogPrint("LUA event: " .. killername .. " sent to spectators for spawnkilling (" .. numsk .. " SK)\n") + et.G_globalSound("sound/misc/referee.wav") + first_sk = et.trap_Milliseconds() elseif(numsk >= ETWsk_kick) then - if et.gentity_get(killer, "inuse") then + if tonumber(et.gentity_get(killer, "pers.connected")) == 2 then local kteam = et.gentity_get(killer, "sess.sessionTeam") if kteam ~= 3 then - et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3has been kicked - too many spawnkills!\"\n") - addPO(killer) - savePO(ETWsk_pofile) - et.trap_DropClient(killer, "Kicked for too many spawnkills!", ETWsk_kicklen) - et.G_LogPrint("LUA event: temp spawnkill ban for " .. killername .. " (" .. numsk .. " SK)\n") + if first_sk ~= et.trap_Milliseconds() then + et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3has been kicked - too many spawnkills!\"\n") + addPO(killer) + savePO(ETWsk_pofile) + et.trap_DropClient(killer, "kicked for too many spawnkills!", ETWsk_kicklen) + et.G_LogPrint("LUA event: temp spawnkill ban for " .. killername .. " (" .. numsk .. " SK)\n") + et.G_globalSound("sound/misc/duke_crapouttahere.wav") + end end end else From 35058cf33c01c7b3991f4b60dda5ef93a2afe9a1 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 17 May 2024 22:28:29 +0200 Subject: [PATCH 68/71] Add files via upload --- ETWsk.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ETWsk.lua b/ETWsk.lua index 06ca37a..4e6034a 100644 --- a/ETWsk.lua +++ b/ETWsk.lua @@ -1015,7 +1015,7 @@ function ClientSpawnkill(victim, killer, isheavy) if tonumber(et.gentity_get(killer, "pers.connected")) == 2 then local kteam = et.gentity_get(killer, "sess.sessionTeam") if kteam ~= 3 then - if first_sk ~= et.trap_Milliseconds() then + if et.trap_Milliseconds() - first_sk > 30000 then et.trap_SendServerCommand(-1, "chat \"^3ATTENTION: ^7"..killername.." ^3has been kicked - too many spawnkills!\"\n") addPO(killer) savePO(ETWsk_pofile) From fcdca8b64a58d8849a7b7d49e4f2e33ab9cf37c3 Mon Sep 17 00:00:00 2001 From: x0rnn Date: Thu, 31 Oct 2024 12:46:28 +0100 Subject: [PATCH 69/71] Add files via upload --- objtrack.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/objtrack.lua b/objtrack.lua index 48faa83..1b0a8f8 100644 --- a/objtrack.lua +++ b/objtrack.lua @@ -51,7 +51,7 @@ function et_Print(text) local x = 1 for index in pairs(objcarriers_id) do if objcarriers[objcarriers_id[x]] == true then - local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 5) if redflag == 0 then local name = et.gentity_get(objcarriers_id[x], "pers.netname") et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the East Radar Parts!\"\n") @@ -67,7 +67,7 @@ function et_Print(text) local x = 1 for index in pairs(objcarriers_id) do if objcarriers[objcarriers_id[x]] == true then - local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 5) if redflag == 0 then local name = et.gentity_get(objcarriers_id[x], "pers.netname") et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the West Radar Parts!\"\n") @@ -115,7 +115,7 @@ function et_Print(text) local x = 1 for index in pairs(goldcarriers_id) do if goldcarriers[goldcarriers_id[x]] == true then - local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 6) + local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 5) if redflag == 0 then local name = et.gentity_get(goldcarriers_id[x], "pers.netname") et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") @@ -227,7 +227,7 @@ function et_Print(text) local x = 1 for index in pairs(goldcarriers_id) do if goldcarriers[goldcarriers_id[x]] == true then - local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 6) + local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 5) if redflag == 0 then local name = et.gentity_get(goldcarriers_id[x], "pers.netname") et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured a Gold Crate!\"\n") @@ -406,7 +406,7 @@ function et_Print(text) local x = 1 for index in pairs(goldcarriers_id) do if goldcarriers[goldcarriers_id[x]] == true then - local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 6) + local redflag = et.gentity_get(goldcarriers_id[x], "ps.powerups", 5) if redflag == 0 then local name = et.gentity_get(goldcarriers_id[x], "pers.netname") et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") @@ -456,7 +456,7 @@ function et_Print(text) --local x = 1 --for index in pairs(objcarriers_id) do --if objcarriers[objcarriers_id[x]] == true then - --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 5) --if redflag == 0 then --local name = et.gentity_get(objcarriers_id[x], "pers.netname") --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the North Documents!\"\n") @@ -472,7 +472,7 @@ function et_Print(text) --local x = 1 --for index in pairs(objcarriers_id) do --if objcarriers[objcarriers_id[x]] == true then - --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 5) --if redflag == 0 then --local name = et.gentity_get(objcarriers_id[x], "pers.netname") --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the South Documents!\"\n") @@ -731,7 +731,7 @@ function et_Print(text) --local x = 1 --for index in pairs(objcarriers_id) do --if objcarriers[objcarriers_id[x]] == true then - --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 6) + --local redflag = et.gentity_get(objcarriers_id[x], "ps.powerups", 5) --if redflag == 0 then --local name = et.gentity_get(objcarriers_id[x], "pers.netname") --et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7secured the first Gold Crate!\"\n") From 662c703bcd43ee75d337fc012905d7af140d48ac Mon Sep 17 00:00:00 2001 From: x0rnn Date: Fri, 8 Nov 2024 18:31:41 +0100 Subject: [PATCH 70/71] Add files via upload --- endstats.lua | 2 +- killassists.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/endstats.lua b/endstats.lua index 191f87f..edd1c34 100644 --- a/endstats.lua +++ b/endstats.lua @@ -134,7 +134,7 @@ end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) if gamestate == 0 then - if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 and not (tonumber(target) < 0) and not (tonumber(target) > tonumber(et.trap_Cvar_Get("sv_maxclients"))) then + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 and not (tonumber(target) < 0) and not (tonumber(target) > sv_maxclients-1) then if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then local v_team = et.gentity_get(target, "sess.sessionTeam") local k_team = et.gentity_get(attacker, "sess.sessionTeam") diff --git a/killassists.lua b/killassists.lua index 6b31cfa..bbb592c 100644 --- a/killassists.lua +++ b/killassists.lua @@ -108,7 +108,7 @@ function hitType(clientNum) end function et_Damage(target, attacker, damage, damageFlags, meansOfDeath) - if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 and not (tonumber(target) < 0) and not (tonumber(target) > tonumber(et.trap_Cvar_Get("sv_maxclients"))) then + if target ~= attacker and attacker ~= 1022 and attacker ~= 1023 and not (tonumber(target) < 0) and not (tonumber(target) > sv_maxclients-1) then if has_value(light_weapons, meansOfDeath) or has_value(explosives, meansOfDeath) then local hitType = hitType(attacker) if hitType == HR_HEAD then From 1bca10e12ee61374be8a42fd73d8333f72c69c4f Mon Sep 17 00:00:00 2001 From: x0rnn Date: Mon, 16 Dec 2024 11:25:50 +0100 Subject: [PATCH 71/71] SW support, dual dyna objective support --- suddendeath.lua | 1038 +++++++++++++++++++++++++++++++---------------- 1 file changed, 693 insertions(+), 345 deletions(-) diff --git a/suddendeath.lua b/suddendeath.lua index c60f519..175a95c 100644 --- a/suddendeath.lua +++ b/suddendeath.lua @@ -1,345 +1,693 @@ --- x0rnn: added dynamite "sudden death" mode --- modified Quake 3 sudden death sound: https://github.com/x0rnn/etpro/blob/master/lua/sudden_death.wav - ---------------------------------- -------- Dynamite counter -------- -------- By Necromancer -------- -------- 5/04/2009 -------- -------- www.usef-et.org -------- ---------------------------------- - -SHOW = 0 --- 0 means disable timer --- 1 means only the team that planted the dyno --- 2 means everyone - --- This script can be freely used and modified as long as the original author\s are mentioned (and their homepage: www.usef-et.org) - -mapname = "" -gametype = 0 -mapstarted = false -paused = false -mapstart_time = 0 -paused_time = 0 -unpaused_time = 0 -stuck_time = 0 -intervals = {[1]=0, [2]=0} -sudden_death = false -first_obj = false -sw_sd_disabled = false - --- Constans -COLOR = {} -COLOR.PLACE = '^8' -COLOR.TEXT = '^w' -COLOR.TIME = '^8' -- this constat is changing in the print_message() function - -CHAT = "cpm" -POPUP = "legacy" - -timer = {} - -function et_InitGame(levelTime, randomSeed, restart) - et.RegisterModname("suddendeath.lua" .. et.FindSelf()) - mapname = string.lower(et.trap_Cvar_Get("mapname")) - gametype = tonumber(et.trap_Cvar_Get("g_gametype")) - local alliedwins = tonumber(et.trap_Cvar_Get("g_alliedWins")) - local maptime = et.trap_Cvar_Get("timelimit") - if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then - if alliedwins == 1 then - sw_sd_disabled = true - else - if maptime > et.trap_Cvar_Get("sd_defaulttime") - sw_sd_disabled = true - end - end - else - et.trap_Cvar_Set("sd_defaulttime", maptime) - end -end - -function et_RunFrame( levelTime ) - current = os.time() - for dyno, temp in pairs(timer) do - if timer[dyno]["time"] - current >= 0 then - for key,temp in pairs(timer[dyno]) do - if type(key) == "number" then - if timer[dyno]["time"] - current == key then - send_print(timer,dyno,key) - timer[dyno][key] = nil - --et.G_LogPrint("dynamite key deleted: " .. dyno .." key: " .. key .. "\n") - end - end - end - - else - --et.G_LogPrint("dynamite out: " .. dyno .. "\n") - place_destroyed(timer[dyno]["place"]) - --timer[dyno] = nil - end - end - - if math.fmod(levelTime, 1000) == 0 then - local gamestate = tonumber(et.trap_Cvar_Get("gamestate")) - if gamestate == 0 then - if mapstarted == false then - mapstart_time = et.trap_Milliseconds() - mapstarted = true - else - if paused == true then - local cs = et.trap_GetConfigstring(11) - if intervals[1] == 0 then - intervals[1] = cs - elseif intervals[1] ~= 0 then - if intervals[2] == 0 then - intervals[2] = cs - elseif intervals[2] ~= 0 then - intervals[1] = intervals[2] - intervals[2] = cs - if intervals[1] == intervals[2] then - paused = false - unpaused_time = et.trap_Milliseconds() - 1000 - stuck_time = unpaused_time - paused_time + stuck_time - intervals[1] = 0 - intervals[2] = 0 - end - end - end - end - end - end - end -end - -function et_ConsoleCommand() - local arg = et.trap_Argv(1) - if arg == "pause" then - paused = true - paused_time = et.trap_Milliseconds() - end - if arg == "unpause" then - paused = false - unpaused_time = et.trap_Milliseconds() - stuck_time = unpaused_time - paused_time + stuck_time + 10000 - end - return(0) -end - -function place_destroyed(place) -- removes any dynamties that were planted on this objective - for dynamite, temp in pairs(timer) do - if timer[dynamite]["place"] == place then - timer[dynamite] = nil - end - end -end - -function send_print(timer,dyno,ttime) - if SHOW == 0 then return end - if SHOW == 1 then - for player=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1, 1 do - if et.gentity_get(player,"sess.sessionTeam") == timer[dyno]["team"] then - print_message(player, ttime, timer[dyno]["place"]) - end - end - else - print_message(-1, ttime, timer[dyno]["place"]) - end -end - -function print_message(slot, ttime, place) - if ttime > 3 then - COLOR.TIME = '^8' - else - COLOR.TIME = '^1' - end - - if ttime == -1 then - et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite planted at " .. COLOR.PLACE .. place)) - elseif ttime == -2 then - et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite defused at " .. COLOR.PLACE .. place)) - elseif ttime > 0 then - et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite at " .. COLOR.PLACE .. place .. COLOR.TEXT .. " exploding in " .. COLOR.TIME ..ttime .. COLOR.TEXT .. " seconds!")) - end -end - -function et_Print( text ) - --legacy popup: axis planted "the Old City MG Nest" - start,stop = string.find(text, POPUP .. " popup:",1,true) -- check that its not any player print, trying to manipulate the dyno counter - if start and stop then - start,stop,team,plant = string.find(text, POPUP .. " popup: (%S+) planted \"([^%\"]*)\"") - if start and stop then -- dynamite planted - if team == "axis" then team = 1 - else team = 2 end - index = #timer+1 - timer[index] = {} - timer[index]["team"] = team - timer[index]["place"] = plant - timer[index]["time"] = os.time() +30 - - timer[index][20] = true - timer[index][10] = true - timer[index][5] = true - timer[index][3] = true - timer[index][2] = true - timer[index][1] = true - timer[index][0] = true - - print_message(-1, -1, timer[index]["place"]) - --et.G_LogPrint("dynamite set: " .. index .. "\n") - - if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then - if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then - if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the Bunker Controls" or plant == "the Axis Submarine" then - local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... - local timeleft - timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) - if timeleft < 30000 then - sudden_death = true - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") - et.trap_SendServerCommand(-1, "chat \"^1Sudden Death mode is activated! Defuse the dynamite or lose!\"") - et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") + 0.5) - et.G_globalSound("sound/misc/sudden_death.wav") - for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do - local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) - if team == 2 then - if et.gentity_get(j,"sess.PlayerType") == 2 then - local health = tonumber(et.gentity_get(j, "health")) - if health > 0 then - et.gentity_set(j, "ps.ammoclip", 15, 0) - et.trap_SendServerCommand(j, "chat \"^1Sudden Death mode is activated! Can't plant additional dynamites!\"") - end - end - end - end - end - end - end - if mapname == "sw_oasis_b3" or mapname == "oasis" or mapname == "tc_base" or mapname == "erdenberg_t2" then - if first_obj == true then - if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" then - local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... - local timeleft - timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) - if timeleft < 30000 then - sudden_death = true - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") - et.trap_SendServerCommand(-1, "chat \"^1Sudden Death mode is activated! Defuse the dynamite or lose!\"") - et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") + 0.5) - et.G_globalSound("sound/misc/sudden_death.wav") - for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do - local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) - if team == 2 then - if et.gentity_get(j,"sess.PlayerType") == 2 then - local health = tonumber(et.gentity_get(j, "health")) - if health > 0 then - et.gentity_set(j, "ps.ammoclip", 15, 0) - et.trap_SendServerCommand(j, "chat \"^1Sudden Death mode is activated! Can't plant additional dynamites!\"") - end - end - end - end - end - end - end - end - end - end - - start,stop,team,plant = string.find(text, POPUP .. " popup: (%S+) defused \"([^%\"]*)\"") - if start and stop then -- dynamite defused - if team == "axis" then team = 1 - else team = 2 end - - if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then - if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "mp_sub_rc1" then - if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the bunker controls" or plant == "the Axis Submarine" then - if sudden_death == true then - local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... - local timeleft - timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) - if timeleft - 30000 > 3750 then - local t = ((timeleft - 30000) / 1000) / 60 - et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") - t) - else - et.trap_Cvar_Set("timelimit", 0.0001) - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") - end - end - end - end - if mapname == "sw_oasis_b3" or mapname == "oasis" or mapname == "tc_base" or mapname == "erdenberg_t2" then - if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" then - if sudden_death == true then - local timelimit = et.trap_Cvar_Get("timelimit") * 1000 * 60 - 2000 --counts 2 seconds more for some reason... - local timeleft - timeleft = timelimit - ((et.trap_Milliseconds() - stuck_time) - mapstart_time) - if timeleft - 30000 > 3750 then - local t = ((timeleft - 30000) / 1000) / 60 - et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("timelimit") - t) - else - et.trap_Cvar_Set("timelimit", 0.0001) - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") - end - end - end - end - end - - for index,temp in pairs(timer) do - if timer[index]["place"] == plant then - print_message(-1, -2, timer[index]["place"]) - timer[index] = nil - --et.G_LogPrint("dynamite removed: " .. index .. "\n") - return - end - end - end - end - --legacy announce: "Allied team has destroyed the South Anti-Tank Gun!" - start2,stop2 = string.find(text, POPUP .. " announce:",1,true) -- check that its not any player print, trying to manipulate the dyno counter - if start2 and stop2 then - start2,stop2,plant = string.find(text, POPUP .. " announce: \"([^%\"]*)\"") - if start2 and stop2 then -- dynamite planted - if gametype ~= 3 or (gametype == 3 and sw_sd_disabled == false) then - if mapname == "oasis" or mapname == "sw_oasis_b3" then - if plant == "^7Allies have destroyed the North Anti-Tank Gun!" or plant == "^7Allies have destroyed the South Anti-Tank Gun!" or plant == "^7Allied team has destroyed the South Anti-Tank Gun!" or plant == "^7Allied team has destroyed the North Anti-Tank Gun!" then - if first_obj == false then - first_obj = true - else - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") - end - end - elseif mapname == "erdenberg_t2" then - if plant == "^7The West Flak88 has been destroyed!" or plant == "^7The East Flak88 has been destroyed!" then - if first_obj == false then - first_obj = true - else - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") - end - end - elseif mapname == "tc_base" then - if plant == "^7Allied team has disabled the South Radar!" or plant == "^7Allied team has disabled the North Radar!" then - if first_obj == false then - first_obj = true - else - et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") - end - end - end - end - end - end -end - -function et_ClientSpawn(id, revived) - if revived ~= 1 then - if sudden_death == true then - local team = et.gentity_get(id, "sess.sessionTeam") - if team == 2 then - if et.gentity_get(id,"sess.PlayerType") == 2 then - et.gentity_set(id,"ps.ammoclip", 15, 0) - end - end - end - end -end +-- x0rnn: added dynamite "sudden death" mode +-- modified Quake 3 sudden death sound: https://github.com/x0rnn/etpro/blob/master/lua/sudden_death.wav + +--------------------------------- +------- Dynamite counter -------- +------- By Necromancer -------- +------- 5/04/2009 -------- +------- www.usef-et.org -------- +--------------------------------- + +SHOW = 0 +-- 0 means disable timer +-- 1 means only the team that planted the dyno +-- 2 means everyone + +-- This script can be freely used and modified as long as the original author/s are mentioned (and their homepage: www.usef-et.org) + +mapname = "" +gametype = 0 +gamestate = -1 +maptime = 0 +mapstarted = false +paused = false +mapstart_time = 0 +paused_time = 0 +unpaused_time = 0 +stuck_time = 0 +gameFrameLevelTime = 0 +intervals = {[1]=0, [2]=0} +sudden_death = false +first_obj = false +first_obj_time = 0 +second_obj_time = 0 +first_obj_loc = "" +second_obj_loc = "" +dyna_counter = 0 +dyna_maps = {"battery", "sw_battery", "fueldump", "braundorf_b4", "etl_braundorf", "mp_sub_rc1", "sub2", "sw_oasis_b3", "oasis", "tc_base", "etl_base", "erdenberg_t2"} +plants = {} +defuses = {} +dyna_pos = {} + +-- Constans +COLOR = {} +COLOR.PLACE = '^8' +COLOR.TEXT = '^w' +COLOR.TIME = '^8' -- this constant is changing in the print_message() function + +CHAT = "bp" +POPUP = "legacy" + +timer = {} + +function isEmpty(str) + if str == nil or str == '' then + return 0 + end + return str +end + +function roundNum(num, n) -- timelimit rounds to 6 decimals + local mult = 10^(n or 0) + return math.floor(num * mult + 0.5) / mult +end + +function has_value (tab, val) + for index, value in ipairs(tab) do + if value == val then + return true + end + end + return false +end + +function calcDist(pos1, pos2) + local dist2 = (pos1[1]-pos2[1])^2 + (pos1[2]-pos2[2])^2 + ((pos1[3]-pos2[3])*2)^2 + return math.sqrt(dist2) +end + +function et_InitGame(levelTime, randomSeed, restart) + et.RegisterModname("suddendeath.lua" .. et.FindSelf()) + mapname = string.lower(et.trap_Cvar_Get("mapname")) + gametype = tonumber(et.trap_Cvar_Get("g_gametype")) + maptime = tonumber(et.trap_Cvar_Get("timelimit")) + mapstart_time = et.trap_GetConfigstring(et.CS_LEVEL_START_TIME) +end + +function et_RunFrame( levelTime ) + gamestate = tonumber(et.trap_Cvar_Get("gamestate")) + if gametype == 3 then + if gamestate == 0 then + if mapstarted == false then + mapstarted = true + local winnerteam = tonumber(et.trap_Cvar_Get("sd_winnerteam")) or 1 + if has_value(dyna_maps, mapname) then + if tonumber(et.trap_Cvar_Get("g_currentRound")) == 1 then -- round 2 + if winnerteam == 2 then -- 2 = allies, 1 = axis + et.trap_Cvar_Set("timelimit", maptime - 0.5) + maptime = tonumber(et.trap_Cvar_Get("timelimit")) + else + if et.trap_Cvar_Get("sd_bonustime") > et.trap_Cvar_Get("sd_defaulttime") then -- sudden death was activated, but dynamite defused in overtime + et.trap_Cvar_Set("timelimit", et.trap_Cvar_Get("sd_defaulttime")) + maptime = tonumber(et.trap_Cvar_Get("timelimit")) + end + end + else + et.trap_Cvar_Set("sd_defaulttime", maptime) + et.trap_Cvar_Set("sd_bonustime", 0) + et.trap_Cvar_Set("sd_winnerteam", 1) + end + end + end + end + end + gameFrameLevelTime = levelTime + current = os.time() + for dyno, temp in pairs(timer) do + if timer[dyno]["time"] - current >= 0 then + for key,temp in pairs(timer[dyno]) do + if type(key) == "number" then + if timer[dyno]["time"] - current == key then + send_print(timer,dyno,key) + timer[dyno][key] = nil + --et.G_LogPrint("dynamite key deleted: " .. dyno .." key: " .. key .. "\n") + end + end + end + + else + --et.G_LogPrint("dynamite out: " .. dyno .. "\n") + place_destroyed(timer[dyno]["place"]) + --timer[dyno] = nil + end + end + + if math.fmod(levelTime, 1000) == 0 then + if gamestate == 0 then + if paused == true then + local cs = et.trap_GetConfigstring(11) + if intervals[1] == 0 then + intervals[1] = cs + elseif intervals[1] ~= 0 then + if intervals[2] == 0 then + intervals[2] = cs + elseif intervals[2] ~= 0 then + intervals[1] = intervals[2] + intervals[2] = cs + if intervals[1] == intervals[2] then + paused = false + unpaused_time = et.trap_Milliseconds() - 1000 + stuck_time = unpaused_time - paused_time + stuck_time + intervals[1] = 0 + intervals[2] = 0 + end + end + end + end + + if sudden_death == true then + for i=0,tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(i, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(i, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(i, "health")) + if health > 0 then + local pos = et.gentity_get(i, "r.currentOrigin") + local dist = calcDist(pos, dyna_pos) + if dist < 600 then + if et.gentity_get(i, "ps.ammoclip", 15) ~= 0 then + et.gentity_set(i, "ps.ammoclip", 15, 0) + et.RemoveWeaponFromPlayer(i, 15) + --et.RemoveWeaponFromPlayer(i, 21) + end + else + if et.gentity_get(i, "ps.ammoclip", 15) == 0 then + et.gentity_set(i, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(i, 15, 1, 1, 0) + --et.AddWeaponToPlayer(i, 21, 1, 1, 0) + end + end + end + end + end + end + end + + elseif gamestate == et.GS_INTERMISSION then + if gametype == 3 then + local winnerteam = tonumber(isEmpty(et.Info_ValueForKey(et.trap_GetConfigstring(et.CS_MULTI_MAPWINNER), "w"))) + 1 -- change from scripting value for winner (0==AXIS, 1==ALLIES) to spawnflag value + et.trap_Cvar_Set("sd_winnerteam", winnerteam) + end + end + end +end + +function et_WeaponFire(clientNum, weapon) + if sudden_death == true then + local team = tonumber(et.gentity_get(clientNum, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(clientNum, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(clientNum, "health")) + if health > 0 then + local pos = et.gentity_get(clientNum, "r.currentOrigin") + local dist = calcDist(pos, dyna_pos) + if dist < 600 then + if weapon == 21 then + return 1 + end + end + end + end + end + end +end + +function et_ConsoleCommand() + local arg = et.trap_Argv(1) + if arg == "pause" then + paused = true + paused_time = et.trap_Milliseconds() + end + if arg == "unpause" then + paused = false + unpaused_time = et.trap_Milliseconds() + stuck_time = unpaused_time - paused_time + stuck_time + 10000 + end + return(0) +end + +function place_destroyed(place) -- removes any dynamite timers that were planted on this objective + for dynamite, temp in pairs(timer) do + if timer[dynamite]["place"] == place then + timer[dynamite] = nil + end + end +end + +function send_print(timer,dyno,ttime) + if SHOW == 0 then return end + if SHOW == 1 then + for player=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1, 1 do + if et.gentity_get(player, "sess.sessionTeam") == timer[dyno]["team"] then + print_message(player, ttime, timer[dyno]["place"]) + end + end + else + print_message(-1, ttime, timer[dyno]["place"]) + end +end + +function print_message(slot, ttime, place) + if ttime > 3 then + COLOR.TIME = '^8' + else + COLOR.TIME = '^1' + end + + if ttime == -1 then + et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite planted at " .. COLOR.PLACE .. place)) + elseif ttime == -2 then + et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite defused at " .. COLOR.PLACE .. place)) + elseif ttime > 0 then + et.trap_SendServerCommand( slot , string.format('%s \"%s"\n',CHAT, COLOR.TEXT .. "Dynamite at " .. COLOR.PLACE .. place .. COLOR.TEXT .. " exploding in " .. COLOR.TIME ..ttime .. COLOR.TEXT .. " seconds!")) + end +end + +function et_Print(text) + if (string.find(text, "min Timebonus!") or string.find(text, "mins ^oTime Bonus!")) and not string.find(text, "say") then + if sudden_death == true then + sudden_death = false + et.trap_Cvar_Set("timelimit", tonumber(et.trap_Cvar_Get("timelimit")) - 0.5) + end + maptime = tonumber(et.trap_Cvar_Get("timelimit")) + end + + if string.find(text, "Dynamite_Plant") and not string.find(text, "say") then + local junk1,junk2,id,loc = string.find(text, "^Dynamite_Plant:%s+(%d+)%s+([^\n]+)") + table.insert(plants, {time=et.trap_Milliseconds(), name=et.gentity_get(id, "pers.netname"), location=loc, pos=et.gentity_get(id, "r.currentOrigin")}) + elseif string.find(text, "Dynamite_Diffuse") and not string.find(text, "say") then + local junk1,junk2,id,loc = string.find(text, "^Dynamite_Diffuse:%s+(%d+)%s+([^\n]+)") + table.insert(defuses, {time=et.trap_Milliseconds(), name=et.gentity_get(id, "pers.netname"), location=loc}) + end + + --legacy popup: axis planted "the Old City MG Nest" + start,stop = string.find(text, POPUP .. " popup:",1,true) -- check that its not any player print, trying to manipulate the dyno counter + if start and stop then + start,stop,team,plant = string.find(text, POPUP .. " popup: (%S+) planted \"([^%\"]*)\"") + if start and stop then -- dynamite planted + local timestamp = et.trap_Milliseconds() + if team == "axis" then team = 1 + else team = 2 end + index = #timer+1 + timer[index] = {} + timer[index]["team"] = team + timer[index]["place"] = plant + timer[index]["time"] = os.time() +30 + + timer[index][20] = true + timer[index][10] = true + timer[index][5] = true + timer[index][3] = true + timer[index][2] = true + timer[index][1] = true + timer[index][0] = true + + print_message(-1, -1, timer[index]["place"]) + --et.G_LogPrint("dynamite set: " .. index .. "\n") + + if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "etl_braundorf" or mapname == "mp_sub_rc1" or mapname == "sub2" then + if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the Bunker Controls" or plant == "the Axis Submarine" or plant == "the axis submarine" then + local timelimit = tonumber(et.trap_Cvar_Get("timelimit")) * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft = roundNum(timelimit - ((gameFrameLevelTime - stuck_time) - mapstart_time), 6) + if timeleft < 30000 then + if sudden_death == false then + sudden_death = true + for i, dyna in ipairs(plants) do + if dyna.time >= timestamp - 5 and dyna.time <= timestamp then + if plant == dyna.location then + dyna_pos = dyna.pos + break + end + end + end + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") + et.trap_SendServerCommand(-1, "chat \"^1Dynamite Sudden Death mode is activated!\"") + et.trap_Cvar_Set("timelimit", tonumber(et.trap_Cvar_Get("timelimit")) + 0.5) + et.G_globalSound("sound/misc/sudden_death.wav") + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + local pos = et.gentity_get(j, "r.currentOrigin") + local dist = calcDist(pos, dyna_pos) + if dist < 600 then + if et.gentity_get(j, "ps.ammoclip", 15) ~= 0 then + et.gentity_set(j, "ps.ammoclip", 15, 0) + et.RemoveWeaponFromPlayer(j, 15) + --et.RemoveWeaponFromPlayer(j, 21) + end + else + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + et.trap_SendServerCommand(j, "chat \"^1Sudden Death mode is activated! Can't plant additional dynamites!\"") + end + end + end + end + end + end + end + end + if mapname == "sw_oasis_b3" or mapname == "oasis" or mapname == "tc_base" or mapname == "etl_base" or mapname == "erdenberg_t2" then + if first_obj == true then + if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" or plant == "the South Radar" or plant == "the North Radar" then + local timelimit = tonumber(et.trap_Cvar_Get("timelimit")) * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft = roundNum(timelimit - ((gameFrameLevelTime - stuck_time) - mapstart_time), 6) + if timeleft < 30000 then + if sudden_death == false then + sudden_death = true + for i, dyna in ipairs(plants) do + if dyna.time >= timestamp - 10 and dyna.time <= timestamp then + if plant == dyna.location then + dyna_pos = dyna.pos + break + end + end + end + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") + et.trap_SendServerCommand(-1, "chat \"^1Dynamite Sudden Death mode is activated!\"") + et.trap_Cvar_Set("timelimit", tonumber(et.trap_Cvar_Get("timelimit")) + 0.5) + et.G_globalSound("sound/misc/sudden_death.wav") + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + local pos = et.gentity_get(j, "r.currentOrigin") + local dist = calcDist(pos, dyna_pos) + if dist < 600 then + if et.gentity_get(j, "ps.ammoclip", 15) ~= 0 then + et.gentity_set(j, "ps.ammoclip", 15, 0) + et.RemoveWeaponFromPlayer(j, 15) + --et.RemoveWeaponFromPlayer(j, 21) + end + else + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + et.trap_SendServerCommand(j, "chat \"^1Sudden Death mode is activated! Can't plant additional dynamites!\"") + end + end + end + end + end + end + end + else + if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" or plant == "the South Radar" or plant == "the North Radar" then + local timelimit = tonumber(et.trap_Cvar_Get("timelimit")) * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft = roundNum(timelimit - ((gameFrameLevelTime - stuck_time) - mapstart_time), 6) + if timeleft < 60000 then + if first_obj_time == 0 then + first_obj_time = timestamp + first_obj_loc = plant + dyna_counter = dyna_counter + 1 + else + if plant == first_obj_loc then + dyna_counter = dyna_counter + 1 + first_obj_time = timestamp + else + second_obj_time = timestamp + second_obj_loc = plant + if timeleft < 30000 then + if sudden_death == false then + sudden_death = true + for i, dyna in ipairs(plants) do + if dyna.time >= timestamp - 10 and dyna.time <= timestamp then + if plant == dyna.location then + dyna_pos = dyna.pos + break + end + end + end + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death activated!\n") + et.trap_SendServerCommand(-1, "chat \"^1Dynamite Sudden Death mode is activated!\"") + et.trap_Cvar_Set("timelimit", tonumber(et.trap_Cvar_Get("timelimit")) + 0.5) + et.G_globalSound("sound/misc/sudden_death.wav") + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + local pos = et.gentity_get(j, "r.currentOrigin") + local dist = calcDist(pos, dyna_pos) + if dist < 600 then + if et.gentity_get(j, "ps.ammoclip", 15) ~= 0 then + et.gentity_set(j, "ps.ammoclip", 15, 0) + et.RemoveWeaponFromPlayer(j, 15) + --et.RemoveWeaponFromPlayer(j, 21) + end + else + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + et.trap_SendServerCommand(j, "chat \"^1Dynamite Sudden Death mode is activated! Can't plant additional dynamites!\"") + end + end + end + end + end + end + end + end + end + end + end + end + end + + start,stop,team,plant = string.find(text, POPUP .. " popup: (%S+) defused \"([^%\"]*)\"") + if start and stop then -- dynamite defused + local timestamp = et.trap_Milliseconds() + if team == "axis" then team = 1 + else team = 2 end + + if mapname == "battery" or mapname == "sw_battery" or mapname == "fueldump" or mapname == "braundorf_b4" or mapname == "etl_braundorf" or mapname == "mp_sub_rc1" or mapname == "sub2" then + if plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the Bunker Controls" or plant == "the Axis Submarine" or plant == "the axis submarine" then + if sudden_death == true then + local timelimit = tonumber(et.trap_Cvar_Get("timelimit")) * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft = roundNum(timelimit - ((gameFrameLevelTime - stuck_time) - mapstart_time), 6) + if gametype == 4 or gametype == 6 then + if (timelimit - 0.033333) - timeleft < (maptime * 1000 * 60) then + sudden_death = false + et.trap_Cvar_Set("timelimit", maptime) + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + end + end + end + elseif (timelimit - 0.033333) - timeleft >= (maptime * 1000 * 60) then + et.trap_Cvar_Set("timelimit", 0.0001) + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") + for i, dyna in ipairs(defuses) do + if dyna.time == timestamp -1 then + if plant == dyna.location then + et.trap_SendServerCommand(-1, "chat \"" .. dyna.name .. " ^7defused ^1" .. plant .. "^7!\"") + break + end + end + end + end + elseif gametype == 3 then + if (timelimit - 0.033333) - timeleft < (maptime * 1000 * 60) then + sudden_death = false + et.trap_Cvar_Set("timelimit", maptime) + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + end + end + end + elseif (timelimit - 0.033333) - timeleft >= (maptime * 1000 * 60) then + et.trap_Cvar_Set("sd_bonustime", roundNum(timelimit/1000/60 - timeleft/1000/60, 6)) + et.trap_Cvar_Set("timelimit", 0.0001) + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") + for i, dyna in ipairs(defuses) do + if dyna.time >= timestamp - 10 and dyna.time <= timestamp then + if plant == dyna.location then + et.trap_SendServerCommand(-1, "chat \"" .. dyna.name .. " ^7defused ^1" .. plant .. "^7!\"") + break + end + end + end + end + end + end + end + end + if mapname == "sw_oasis_b3" or mapname == "oasis" or mapname == "tc_base" or mapname == "etl_base" or mapname == "erdenberg_t2" then + if plant == "the South PAK 75mm Gun" or plant == "the North PAK 75mm Gun" or plant == "the South Anti-Tank Gun" or plant == "the North Anti-Tank Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" or plant == "the South Radar" or plant == "the North Radar" then + if sudden_death == true then + local timelimit = tonumber(et.trap_Cvar_Get("timelimit")) * 1000 * 60 - 2000 --counts 2 seconds more for some reason... + local timeleft = roundNum(timelimit - ((gameFrameLevelTime - stuck_time) - mapstart_time), 6) + if gametype == 4 or gametype == 6 then + if (timelimit - 0.033333) - timeleft < (maptime * 1000 * 60) then + if first_obj_loc == plant then + dyna_counter = dyna_counter - 1 + end + if dyna_counter == 0 or second_obj_loc == plant then + if dyna_counter == 0 then + first_obj_time = second_obj_time + first_obj_loc = second_obj_loc + second_obj_time = 0 + second_obj_loc = "" + elseif second_obj_loc == plant then + second_obj_time = 0 + second_obj_loc = "" + end + sudden_death = false + et.trap_Cvar_Set("timelimit", maptime) + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + end + end + end + end + elseif (timelimit - 0.033333) - timeleft >= (maptime * 1000 * 60) then + et.trap_Cvar_Set("timelimit", 0.0001) + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") + for i, dyna in ipairs(defuses) do + if dyna.time >= timestamp - 10 and dyna.time <= timestamp then + if plant == dyna.location then + et.trap_SendServerCommand(-1, "chat \"" .. dyna.name .. " ^7defused ^1" .. plant .. "^7!\"") + break + end + end + end + end + elseif gametype == 3 then + if (timelimit - 0.033333) - timeleft < (maptime * 1000 * 60) then + if first_obj_loc == plant then + dyna_counter = dyna_counter - 1 + end + if dyna_counter == 0 or second_obj_loc == plant then + if dyna_counter == 0 then + first_obj_time = second_obj_time + first_obj_loc = second_obj_loc + second_obj_time = 0 + second_obj_loc = "" + elseif second_obj_loc == plant then + second_obj_time = 0 + second_obj_loc = "" + end + sudden_death = false + et.trap_Cvar_Set("timelimit", maptime) + for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do + local team = tonumber(et.gentity_get(j, "sess.sessionTeam")) + if team == 2 then + if et.gentity_get(j, "sess.PlayerType") == 2 then + local health = tonumber(et.gentity_get(j, "health")) + if health > 0 then + if et.gentity_get(j, "ps.ammoclip", 15) == 0 then + et.gentity_set(j, "ps.ammoclip", 15, 1) + et.AddWeaponToPlayer(j, 15, 1, 1, 0) + --et.AddWeaponToPlayer(j, 21, 1, 1, 0) + end + end + end + end + end + end + elseif (timelimit - 0.033333) - timeleft >= (maptime * 1000 * 60) then + et.trap_Cvar_Set("sd_bonustime", roundNum(timelimit/1000/60 - timeleft/1000/60, 6)) + et.trap_Cvar_Set("timelimit", 0.0001) + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Axis defused!\n") + for i, dyna in ipairs(defuses) do + if dyna.time >= timestamp - 10 and dyna.time <= timestamp then + if plant == dyna.location then + et.trap_SendServerCommand(-1, "chat \"" .. dyna.name .. " ^7defused ^1" .. plant .. "^7!\"") + break + end + end + end + end + end + else + if first_obj_loc == plant then + dyna_counter = dyna_counter - 1 + if dyna_counter == 0 then + first_obj_time = 0 + first_obj_loc = "" + end + end + end + end + end + + for index,temp in pairs(timer) do + if timer[index]["place"] == plant then + print_message(-1, -2, timer[index]["place"]) + timer[index] = nil + --et.G_LogPrint("dynamite removed: " .. index .. "\n") + return + end + end + end + end + + if string.find(text, "Objective_Destroyed") and not string.find(text, "say") then + local junk1,junk2,id,plant = string.find(text, "^Objective_Destroyed:%s+(%d+)%s+([^\n]+)") + local name = et.gentity_get(id, "pers.netname") + + if plant == "the North Anti-Tank Gun" or plant == "the South Anti-Tank Gun" or plant == "the North PAK 75mm Gun" or plant == "the South PAK 75mm Gun" or plant == "the West Flak88" or plant == "the East Flak88" or plant == "the South Radar [02]" or plant == "the North Radar [01]" or plant == "the North Radar" or plant == "the South Radar" or plant == "the Gun Controls" or plant == "the Fuel Dump" or plant == "the Bunker Controls" or plant == "the Axis Submarine" or plant == "the axis submarine" then + if mapname == "oasis" or mapname == "sw_oasis_b3" or mapname == "erdenberg_t2" or mapname == "tc_base" or mapname == "etl_base" then + if first_obj == false then + first_obj = true + else + if sudden_death == true then + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") + end + end + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7destroyed ^1" .. plant .. "^7!\"") + else + et.trap_SendServerCommand(-1, "chat \"" .. name .. " ^7destroyed ^1" .. plant .. "^7!\"") + if sudden_death == true then + et.G_LogPrint("LUA event: " .. mapname .. " Dynamite sudden death, Allies win!\n") + end + end + end + end +end