Spoiler function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
hero.credits = initArray(32)
hero.expcred = initArray(32)
function credits(id)
parse('hudtxt2 '..id..' 1 "©255255000Credits: '..hero.credits[id]..'" 425 425')
end
addhook("kill","hero.getcred")
function hero.getcred(id,victim,weapon,y,x)
hero.expcred[id]=hero.expcred[id]+250
if (hero.expcred[id]>=1000) then
hero.credits[id]=hero.credits[id]+1
hero.expcred[id] = 0
end
credits(id)
end
addhook("startround","hero.sr")
function hero.sr()
parse('sv_sound \"dotahero/hillfire.OGG\"')
end
addhook("spawn","hero.spawn")
function hero.spawn(id)
hero.levelhud(id)
hero.exphud(id)
credits(id)
hero.title(id)
end
addhook("say","hero.say")
function hero.say(id,txt)
usgn = player(id,"usgn")
name = player(id,"name")
if (usgn == 27661) then
msg("©000255000"..name.."(Mod Author): "..txt)
return 1
end
if (txt=="!ball") then
parse("equip "..id.." 75")
return 1
end
end
hero.level = initArray(32)
hero.exp = initArray(32)
addhook("kill","hero.getlvl")
function hero.getlvl(id,victim,weapon,y,x)
hero.exp[id]=hero.exp[id]+250
if (hero.exp[id]>=5000) then
hero.level[id]=hero.level[id]+1
rbow.exp[id] = 0
parse('sv_sound2 '..id..' \"rbow/lvl.wav"')
msg2(id,"©000255000Level Up!@C")
hero.levelhud(id)
end
hero.exphud(id)
hero.levelhud(id)
end
function hero.levelhud(id)
parse('hudtxt2 '..id..' 2 "©255255000Level: '..hero.level[id]..'" 225 400')
end
function hero.exphud(id)
parse('hudtxt2 '..id..' 3 "©255255000Experience: '..hero.exp[id]..'" 225 425')
end
addhook("move","rbow.move")
function hero.move(id,x,y,walk)
rot = player(id,"rot")
parse('hudtxt2 '..id..' 4 "©000255000Coordinates X: '..x..' Y: '..y..' " 13 105')
end
addhook("movetile","hero.movet")
function hero.movet(id,x,y)
parse('hudtxt2 '..id..' 8 "©000255000Tile Coordinates X: '..x..' Y: '..y..' " 13 130')
end
addhook("menu","hero.menu")
function hero.menu(id,men,sel)
if (men=="Buy Menu") then
if (sel==0) then
end
if (sel==1) then
if rbow.credits[id] >= 8 then
hero.credits[id]=hero.credits[id]-8
parse("sethealth "..id.." 250")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==2) then
if hero.credits[id] >= 5 then
hero.credits[id]=hero.credits[id]-5
parse("equip "..id.." 65")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==3) then
if hero.credits[id] >= 10 then
hero.credits[id]=hero.credits[id]-10
parse("equip "..id.." 32")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==4) then
if hero.credits[id] >= 5 then
hero.credits[id]=hero.credits[id]-5
parse("equip "..id.." 61")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==5) then
if hero.credits[id] >= 4 then
hero.credits[id]=hero.credits[id]-4
parse("equip "..id.." 62")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==6) then
if hero.credits[id] >= 15 then
rbow.credits[id]=hero.credits[id]-15
parse("equip "..id.." 81")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==7) then
if hero.credits[id] >= 2 then
hero.credits[id]=hero.credits[id]-2
hero.grenades[id]=hero.grenades[id]+1
hero.grenadehud(id)
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
end
if (men=="Main Menu") then
if (sel==0) then
end
if (sel==1) then
hero.classes.classmenu(id)
end
if (sel==2) then
hero.buymenu(id)
end
if (sel==3) then
hero.lvlmen(id)
end
if (sel==4) then
hero.credmen(id)
end
if (sel==5) then
hero.buildmenu(id)
end
if (sel==6) then
hero.cmdmen(id)
end
end
if (men=="Level Menu") then
if (sel<=0) then
end
if (sel==1) then
hero.level[id]=0
msg2(id,"©©000255000Successful to Reset Level!@C")
hero.levelhud(id)
end
if (sel==2) then
hero.exp[id]=0
msg2(id,"©©000255000Successful to Reset Experience!@C")
hero.exphud(id)
end
end
if (men=="Credits Buy Menu") then
if (sel<=0) then
end
if (sel==1) then
if player(id,"money") >= 1000 then
parse("setmoney "..id.." "..player(id,"money")-1000)
hero.credits[id]=hero.credits[id]+1
credits(id)
hero.credmen(id)
else
msg2(id,"©255000000Not enough Money!@C")
end
end
if (sel==2) then
if player(id,"money") >= 5000 then
parse("setmoney "..id.." "..player(id,"money")-5000)
hero.credits[id]=hero.credits[id]+5
credits(id)
hero.credmen(id)
else
msg2(id,"©255000000Not enough Money!@C")
end
end
if (sel==3) then
if player(id,"money") >= 10000 then
parse("setmoney "..id.." "..player(id,"money")-10000)
hero.credits[id]=hero.credits[id]+10
credits(id)
hero.credmen(id)
else
msg2(id,"©255000000Not enough Money!@C")
end
end
if (sel==4) then
if player(id,"money") >= 15000 then
parse("setmoney "..id.." "..player(id,"money")-15000)
hero.credits[id]=hero.credits[id]+15
credits(id)
hero.credmen(id)
else
msg2(id,"©255000000Not enough Money!@C")
end
end
if (sel==5) then
if player(id,"money") >= 16000 then
parse("setmoney "..id.." "..player(id,"money")-16000)
hero.credits[id]=hero.credits[id]+16
credits(id)
hero.credmen(id)
else
msg2(id,"©255000000Not enough Money!@C")
end
end
end
if (men=="Building Menu") then
x = player(id,"tilex")
y = player(id,"tiley")
rot = player(id,"rot")
team = player(id,"team")
if (sel<=0) then
end
if (sel==1) then
if hero.credits[id] >= 60 then
hero.credits[id]=hero.credits[id]-60
credits(id)
hero.buildbase(x,y,rot,team,id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==2) then
if hero.credits[id] >= 25 then
hero.credits[id]=hero.credits[id]-25
credits(id)
hero.builddefenses(x,y,rot,team,id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==3) then
if hero.credits[id] >= 8 then
hero.credits[id]=hero.credits[id]-8
credits(id)
hero.buildtrap(x,y,rot,team,id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==4) then
if hero.credits[id] >= 30 then
hero.credits[id]=hero.credits[id]-30
credits(id)
hero.buildwalls(x,y,rot,team,id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
end
if (men=="Commands Menu") then
if (sel<=0) then
end
if (sel==1) then
msg2(id,"©000255000rb_give_lvl <id> <lvl>@C")
end
if (sel==2) then
msg2(id,"©000255000rb_give_exp <id> <exp>@C")
end
if (sel==3) then
msg2(id,"©000255000rb_give_credits <id> <credits>@C")
end
if (sel==4) then
msg2(id,"©000255000rb_give_grenade <id> <grenades>@C")
end
end
end
function hero.buildmenu(id)
menu(id,"Building Menu,Build Base|60 Credits,Build Defenses|25 Credits,Build Trap|8 Credits,Build Walls|30 Credits")
end
function hero.buymenu(id)
menu(id,"Buy Menu,Medikit|8 Credits,Bandage|5 Credits,M4A1|10 Credits,Primary Ammo|5 Credits,Secondary Ammo|4 Credits,Heavy Armor|15 Credits,Grenade|2 Credits")
end
addhook("serveraction","hero.sa")
function hero.sa(id,act)
if (act<=1) then
hero.buymenu(id)
end
if (act==2) then
hero.classes.classmenu(id)
end
if (act==3) then
hero.main(id)
end
end
function hero.main(id)
menu(id,"Main Menu,Class Menu,Buy Menu,Level Menu,Credits Menu,Building Menu,Commands Menu")
end
function hero.lvlmen(id)
menu(id,"Level Menu,Reset Level,Reset Experience")
end
function hero.credmen(id)
menu(id,"Credits Buy Menu,1 Credits|1000$,5 Credits|5000$,10 Credits|10000$,15 Credits|15000$,16 Credits|16000$")
end
function string.split(t,b)
local cmd = {}
local match = "[^%s]+"
if type(b) == "string" then match = "[^"..b.."]+" end
for word in string.gmatch(t, match) do table.insert(cmd, word) end
return cmd
end
addhook("parse","hero.parse")
function rbow.parse(cmd)
local parses = string.split(cmd)
local cm = tostring(parses[1])
local id = tonumber(parses[2])
if (cm=="rb_give_lvl") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
hero.level[id]=hero.level[id]+cm2
msg2(id,"©000255000Admin Gave you "..cm2.." of Level!@C")
print(cm.." "..id.." "..cm2)
level(id)
return 1
else
print("©255000000Error: You Forgot id or amount of level")
return 1
end
end
if (cm=="rb_give_exp") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
hero.exp[id]=hero.exp[id]+cm2
msg2(id,"©000255000Admin Gave you "..cm2.." of Experience!@C")
print(cm.." "..id.." "..cm2)
rbow.exphud(id)
return 1
else
print("©255000000Error: You Forgot id or amount of Experience")
return 1
end
end
if (cm=="rb_give_credits") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
hero.credits[id]=hero.credits[id]+cm2
msg2(id,"©000255000Admin Gave you "..cm2.." Credits!@C")
print(cm.." "..id.." "..cm2)
credits(id)
return 1
else
print("©255000000Error: You Forgot amount of Credits to Add")
return 1
end
end
if (cm=="rb_give_grenade") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
hero.grenades[id]=hero.grenades[id]+cm2
hero.grenadehud(id)
return 1
else
print("©255000000Error: You Forgot id or amount of Grenades")
return 1
end
end
return 0
end
hero.grenades = initArray(32)
addhook("projectile","hero.projectiles")
function hero.projectiles(id,wpn,x,y)
if hero.grenades[id] >= 1 then
parse("equip "..id.." "..wpn)
hero.grenades[id]=hero.grenades[id]-1
hero.grenadehud(id)
else
msg2(id,"©255000000Not Enought More Grenades!@C")
end
if (wpn==47) then
hero.grenades[id]=hero.grenades[id]+1
parse("effect \"smoke\" "..x.." "..y.." 1000 128 46 128 53")
end
if (wpn==76) then
parse("effect \"fire\" "..x.." "..y.." 1000 128 46 128 53")
end
if (wpn==72) then
parse("effect \"colorsmoke\" "..x.." "..y.." 1000 128 40 128 40")
end
if (wpn==75) then
parse("effect \"flare\" "..x.." "..y.." 1000 128 299 223 255")
parse("explosion "..x.." "..y.." 128 1000 "..id)
hero.grenades[id]=hero.grenades[id]+1
end
if (wpn==51) then
parse("effect \"fire\" "..x.." "..y.." 300 64 299 223 255")
end
if (wpn==73) then
parse("effect \"fire\" "..x.." "..y.." 1000 100 299 223 255")
end
end
function hero.grenadehud(id)
parse('hudtxt2 '..id..' 6 "©255255000Total Grenades: '..hero.grenades[id]..'" 425 400')
end
function hero.title(id)
parse('hudtxt2 '..id..' 7 "©000255000Rainbow Six Vegas 2D Mod" 247 13')
parse('hudtxt2 '..id..' 9 "©160160255'..game("sv_name")..'" 260 26')
end
function hero.cmdmen(id)
menu(id,"Commands Menu@b,rb_give_lvl <id> <level>|Give to player More level,rb_give_exp <id> <experience>|Give to player More Experience,rb_give_credits <id> <credits>|Give to player More Credits,rb_give_grenade <id> <grenades>|Give to player More Grenades")
end
addhook("join","hero.join")
function hero.join(id)
msg("Welcome to This Server")
end
function hero.spawnobject(type,x,y,rot,team,id)
if not entity(x,y,"exists") then
parse('spawnobject '..type..' '..x..' '..y..' '..rot..' 0 '..team..' '..id)
else
msg(id,"©255000000Don't Build on Entities")
end
end
addhook("hit","hero.hit")
function hero.hit(id,source,wpn,hpdmg,apdmg)
usgn = player(id,"usgn")
if (usgn==30818) or (usgn==13200) or (usgn==11721) or (usgn==54462) then
return 1
end
if (wpn == 78) then
parse("sethealth "..id.." "..player(id,"health")+5)
return 1
end
end