I need help on the mod/script it USE to work until i tried to make it better.Here is how it looks :
NOTE: There is more that one script
Main script:
Spoiler
dofile("sys/lua/MBT2D/CT Tanks.lua")
dofile("sys/lua/MBT2D/T Tanks.lua")
dofile("sys/lua/MBT2D/Others.lua")
dofile("sys/lua/MBT2D/T Tanks.lua")
dofile("sys/lua/MBT2D/Others.lua")
CT Tanks:
Spoiler
if sample==nil then sample={} end
sample.classes={}
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
sample.classes.class1=initArray(32)
function sample.classes.classmenu1(id)
menu(id,"Select your Tank,Gun Tank|5 dmg,Missle tank|15 dmg,cannon tank|25 dmg")
end
addhook("team","sample.classes.team1")
function sample.classes.team1(id,team)
if (team>0) then
sample.classes.classmenu1(id)
end
end
addhook("serveraction","sample.classes.serveraction1")
function sample.classes.serveraction1(id)
sample.classes.classmenu1(id)
end
addhook("menu","sample.classes.menu1")
function sample.classes.menu1(id,menu,sel)
if (menu=="Select your Tank") then
if (sel>=0 and sel<=3) then
sample.classes.class1[id]=sel
if (player(id,"health")>0) then
parse("killplayer "..id)
end
end
end
end
addhook("spawn","sample.classes.spawn1")
function sample.classes.spawn1(id)
-- Gun
if (sample.classes.class1[id]<=1) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 5")
function cttank_1(id)
end
-- missle
if (sample.classes.class1[id]==2) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 48")
function cttank_2(id)
end
-- Cannon
if (sample.classes.class1[id]==3) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -10")
parse ("equip "..id.." 49")
function cttank_3(id)
end
end
function cttank_1(id)
freeimage(id)
id1=image("gfx/MTB2D/1tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function cttank_2(id)
freeimage(id)
id1=image("gfx/MTB2D/2tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function cttank_3(id)
freeimage(id)
id1=image("gfx/MTB2D/3tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
sample.classes={}
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
sample.classes.class1=initArray(32)
function sample.classes.classmenu1(id)
menu(id,"Select your Tank,Gun Tank|5 dmg,Missle tank|15 dmg,cannon tank|25 dmg")
end
addhook("team","sample.classes.team1")
function sample.classes.team1(id,team)
if (team>0) then
sample.classes.classmenu1(id)
end
end
addhook("serveraction","sample.classes.serveraction1")
function sample.classes.serveraction1(id)
sample.classes.classmenu1(id)
end
addhook("menu","sample.classes.menu1")
function sample.classes.menu1(id,menu,sel)
if (menu=="Select your Tank") then
if (sel>=0 and sel<=3) then
sample.classes.class1[id]=sel
if (player(id,"health")>0) then
parse("killplayer "..id)
end
end
end
end
addhook("spawn","sample.classes.spawn1")
function sample.classes.spawn1(id)
-- Gun
if (sample.classes.class1[id]<=1) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 5")
function cttank_1(id)
end
-- missle
if (sample.classes.class1[id]==2) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 48")
function cttank_2(id)
end
-- Cannon
if (sample.classes.class1[id]==3) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -10")
parse ("equip "..id.." 49")
function cttank_3(id)
end
end
function cttank_1(id)
freeimage(id)
id1=image("gfx/MTB2D/1tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function cttank_2(id)
freeimage(id)
id1=image("gfx/MTB2D/2tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function cttank_3(id)
freeimage(id)
id1=image("gfx/MTB2D/3tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
T Tanks
Spoiler
if sample==nil then sample={} end
sample.classes={}
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
sample.classes.class2=initArray(32)
function sample.classes.classmenu2(id)
menu(id,"Select your t Tank,Gun Tank|5 dmg,Missle tank|15 dmg,cannon tank|25 dmg")
end
addhook("team","sample.classes.team2")
function sample.classes.team2(id,team)
if (team>2) then
sample.classes.classmenu2(id)
end
end
addhook("serveraction","sample.classes.serveraction2")
function sample.classes.serveraction2(id)
sample.classes.classmenu2(id)
end
addhook("menu","sample.classes.menu2")
function sample.classes.menu2(id,menu,sel)
if (menu=="Select your t Tank") then
if (sel>=0 and sel<=3) then
sample.classes.class2[id]=sel
if (player(id,"health")>0) then
parse("killplayer "..id)
end
end
end
end
addhook("spawn","sample.classes.spawn2")
function sample.classes.spawn2(id)
-- Gun
if (sample.classes.class2[id]<=1) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 5")
ttank_4(id)
end
-- missle
if (sample.classes.class2[id]==2) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 48")
ttank_5(id)
end
-- Cannon
if (sample.classes.class2[id]==3) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -10")
parse ("equip "..id.." 49")
ttank_6(id)
end
end
function ttank_4(id)
freeimage(id)
id1=image("gfx/MTB2D/4tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function ttank_5(id)
freeimage(id)
id1=image("gfx/MTB2D/5tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function ttank_6(id)
freeimage(id)
id1=image("gfx/MTB2D/6tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
sample.classes={}
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
sample.classes.class2=initArray(32)
function sample.classes.classmenu2(id)
menu(id,"Select your t Tank,Gun Tank|5 dmg,Missle tank|15 dmg,cannon tank|25 dmg")
end
addhook("team","sample.classes.team2")
function sample.classes.team2(id,team)
if (team>2) then
sample.classes.classmenu2(id)
end
end
addhook("serveraction","sample.classes.serveraction2")
function sample.classes.serveraction2(id)
sample.classes.classmenu2(id)
end
addhook("menu","sample.classes.menu2")
function sample.classes.menu2(id,menu,sel)
if (menu=="Select your t Tank") then
if (sel>=0 and sel<=3) then
sample.classes.class2[id]=sel
if (player(id,"health")>0) then
parse("killplayer "..id)
end
end
end
end
addhook("spawn","sample.classes.spawn2")
function sample.classes.spawn2(id)
-- Gun
if (sample.classes.class2[id]<=1) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 5")
ttank_4(id)
end
-- missle
if (sample.classes.class2[id]==2) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 48")
ttank_5(id)
end
-- Cannon
if (sample.classes.class2[id]==3) then
parse ("setmaxhealth "..id.." 100")
parse ("setarmor "..id.." 100")
parse ("speedmod "..id.." -10")
parse ("equip "..id.." 49")
ttank_6(id)
end
end
function ttank_4(id)
freeimage(id)
id1=image("gfx/MTB2D/4tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function ttank_5(id)
freeimage(id)
id1=image("gfx/MTB2D/5tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
function ttank_6(id)
freeimage(id)
id1=image("gfx/MTB2D/6tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,3)
imagealpha(id1,1.0)
end
Others
Spoiler
parse('mp_wpndmg elite 5')
parse('mp_wpndmg "Rocket Launcher" 15')
parse('mp_wpndmg "Grenade Launcher" 25')
addhook("buy","sample.classes.buy")
function sample.classes.buy()
return 1
end
addhook("drop","sample.classes.drop")
function sample.classes.drop()
return 1
end
addhook("die","sample.classes.die")
function sample.classes.die()
return 1
end
parse('mp_wpndmg "Rocket Launcher" 15')
parse('mp_wpndmg "Grenade Launcher" 25')
addhook("buy","sample.classes.buy")
function sample.classes.buy()
return 1
end
addhook("drop","sample.classes.drop")
function sample.classes.drop()
return 1
end
addhook("die","sample.classes.die")
function sample.classes.die()
return 1
end
Note:The difference between the "CT tanks" and "T tanks" are that the ct tanks are green and the ts are red.
Help me OR Give ideas(GOOD ideas)
edited 2×, last 21.11.09 02:38:34 am