Spoiler -- FUNCTIONS --
function initArray(m)
local array = {}
for i = 0, m do
array[i]=0
end
return array
end
function teamhud(id)
parse('hudtxt2 '..id..' 1 "'..teamcolor[yourteam[id]]..' TEAM NAME : '..teamname[yourteam[id]]..'" 430 325')
parse('hudtxt2 '..id..' 2 "'..teamcolor[yourteam[id]]..' TEAM SCORE : '..teamscore[yourteam[id]]..'" 450 340')
parse('hudtxt2 '..id..' 3 "'..teamcolor[yourteam[id]]..' TEAM DEATHS : '..teamdeaths[yourteam[id]]..'" 480 355')
end
-- VARIABLES --
yourteam=initArray(32) -- PLAYER TEAM
img=initArray(32) -- TEAM COLOR UNDER PLAYER
teamscore=initArray(4) -- TEAM SCORE
teamdeaths=initArray(4) -- TEAM DEATHS
teamcolor=initArray(4) -- TEAM COLOR
teamname=initArray(4) -- TEAM NAME
parse("sv_gm 1")
-- TEAM COLORS (RGB) --
teamcolor[1] = [[©255000000]] -- RED TEAM
teamcolor[2] = [[©000000255]] -- BLUE TEAM
teamcolor[3] = [[©255255000]] -- YELLOW TEAM
teamcolor[4] = [[©000255000]] -- GREEN TEAM
-- TEAM NAMES --
teamname[1] = [[Red Team]] -- RED TEAM
teamname[2] = [[Blue Team]] -- BLUE TEAM
teamname[3] = [[Yellow Team]] -- YELLOW TEAM
teamname[4] = [[Green Team]] -- GREEN TEAM
-- SCRIPT --
addhook("spawn","m4dm_spawn")
function m4dm_spawn(id)
if (yourteam[id] > 0) then
freeimage(id)
img[id] = image("gfx/sprites/flare4.bmp",1,-1,(id+100))
imageblend(img[id],1)
imagealpha(img[id],0.5)
imagecolor(img[id],string.sub(teamcolor[yourteam[id]],2,4),string.sub(teamcolor[yourteam[id]],5,7),string.sub(teamcolor[yourteam[id]],8,10))
end
teamhud(id)
end
addhook("team","m4dm_team")
function m4dm_team(id)
if (yourteam[id] == 0) then -- IF PLAYER DON'T SELECTED TEAM THEN
if player(id,"bot") then
yourteam[id] = math.random(1,4)
parse("killplayer "..id)
end
menu(id,'Select your team !!!,'..teamname[1]..','..teamname[2]..','..teamname[3]..','..teamname[4]..'') -- OPEN SELECT TEAM MENU
end
teamhud(id)
end
addhook("kill","m4dm_kill")
function m4dm_kill(id,source)
local t=yourteam[source]
local s=yourteam[id]
teamscore[s] = teamscore[s] + 1 -- ADD KILLER TEAM SCORE
teamdeaths[t] = teamdeaths[t] + 1 -- ADD VICTIM TEAM DEATHS
teamhud(id)
end
addhook("menu","m4dm_menu")
function m4dm_menu(id,t,b)
if (t == "Select your team !!!") then -- IF CLICKED BUTTON IN SELECT TEAM MENU
if (b == 1) then -- IF SELECTED TEAM X PLAYER ID TEAM = X
yourteam[id] = 1
end
if (b == 2) then
yourteam[id] = 2
end
if (b == 3) then
yourteam[id] = 3
end
if (b == 4) then
yourteam[id] = 4
end
if (b < 1 or b > 4) then
menu(id,'Select your team !!!,'..teamname[1]..','..teamname[2]..','..teamname[3]..','..teamname[4]..'')
end
end
teamhud(id)
end
addhook("say","m4dm_say")
function m4dm_say(id,t)
if (t == "!other") then -- IF PLAYER SAY : "!other" THEN
local i = 1
msg2(id,teamcolor[i]..''..teamname[i]..' | SCORE : '..teamscore[i]..' DEATHS : '..teamdeaths[i])
i=i+1
msg2(id,teamcolor[i]..''..teamname[i]..' | SCORE : '..teamscore[i]..' DEATHS : '..teamdeaths[i])
i=i+1
msg2(id,teamcolor[i]..''..teamname[i]..' | SCORE : '..teamscore[i]..' DEATHS : '..teamdeaths[i])
i=i+1
msg2(id,teamcolor[i]..''..teamname[i]..' | SCORE : '..teamscore[i]..' DEATHS : '..teamdeaths[i])
return 1
end
msg(teamcolor[yourteam[id]]..player(id,"name").." : "..t)
teamhud(id)
return 1
end
addhook("hit","m4dm_hit")
function m4dm_hit(id,src)
if (yourteam[id] == yourteam[src]) then
return 1
end
end
addhook("startround","m4dm_startround")
function m4dm_startround()
for g = 1,32 do
teamscore[g]=0
teamdeaths[g]=0
end
end
addhook("serveraction","m4dm_serveraction")
function m4dm_serveraction(id,k)
if (k==0) then
menu(id,'Select your team !!!,'..teamname[1]..','..teamname[2]..','..teamname[3]..','..teamname[4]..'')
end
end