Spoiler if dh4==nil then dh4={} end
dh4.classes={}
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
dh4.credits = initArray(32)
dh4.expcred = initArray(32)
function credits(id)
parse('hudtxt2 '..id..' 1 "©255255000Credits: '..dh4.credits[id]..'" 425 425')
end
addhook("kill","dh4.getcred")
function dh4.getcred(id,victim,weapon,y,x)
dh4.expcred[id]=dh4.expcred[id]+250
if (dh4.expcred[id]>=1000) then
dh4.credits[id]=dh4.credits[id]+1
dh4.expcred[id] = 0
end
credits(id)
end
addhook("startround","dh4.sr")
function dh4.sr()
parse('sv_sound \"rbow/play.wav\"')
end
addhook("spawn","dh4.spawn")
function dh4.spawn(id)
dh4.levelhud(id)
dh4.exphud(id)
credits(id)
dh4.title(id)
end
dh4.level = initArray(32)
dh4.exp = initArray(32)
addhook("kill","dh4.getlvl")
function dh4.getlvl(id,victim,weapon,y,x)
dh4.exp[id]=dh4.exp[id]+250
if (dh4.exp[id]>=5000) then
dh4.level[id]=dh4.level[id]+1
dh4.exp[id] = 0
parse('sv_sound2 '..id..' \"dh4/lvl.wav"')
msg2(id,"©000255000Level Up!@C")
dh4.levelhud(id)
end
dh4.exphud(id)
dh4.levelhud(id)
end
function dh4.levelhud(id)
parse('hudtxt2 '..id..' 2 "©255255000Level: '..dh4.level[id]..'" 225 400')
end
function dh4.exphud(id)
parse('hudtxt2 '..id..' 3 "©255255000Experience: '..dh4.exp[id]..'" 225 425')
end
addhook("move","dh4.move")
function dh4.move(id,x,y,walk)
rot = player(id,"rot")
parse('hudtxt2 '..id..' 4 "©000255000Coordinates X: '..x..' Y: '..y..' " 13 105')
end
addhook("movetile","dh4.movet")
function dh4.movet(id,x,y)
parse('hudtxt2 '..id..' 8 "©000255000Tile Coordinates X: '..x..' Y: '..y..' " 13 130')
end
addhook("menu","dh4.menu")
function dh4.menu(id,men,sel)
if (men=="Buy Menu") then
if (sel==0) then
end
if (sel==1) then
if dh4.credits[id] >= 8 then
dh4.credits[id]=dh4.credits[id]-8
parse("sethealth "..id.." 250")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==2) then
if dh4.credits[id] >= 5 then
dh4.credits[id]=dh4.credits[id]-5
parse("equip "..id.." 65")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==3) then
if dh4.credits[id] >= 10 then
dh4.credits[id]=dh4.credits[id]-10
parse("equip "..id.." 32")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==4) then
if dh4.credits[id] >= 5 then
dh4.credits[id]=dh4.credits[id]-5
parse("equip "..id.." 61")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==5) then
if dh4.credits[id] >= 4 then
dh4.credits[id]=dh4.credits[id]-4
parse("equip "..id.." 62")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==6) then
if dh4.credits[id] >= 15 then
dh4.credits[id]=dh4.credits[id]-15
parse("equip "..id.." 81")
credits(id)
else
msg2(id,"©255000000Not enough Credits!@C")
end
end
if (sel==7) then
if dh4.credits[id] >= 2 then
dh4.credits[id]=dh4.credits[id]-2
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
dh4.classes.classmenu(id)
end
if (sel==2) then
dh4.buymenu(id)
end
if (sel==3) then
dh4.lvlmen(id)
end
if (sel==4) then
dh4.credmen(id)
end
if (sel==5) then
dh4.cmdmen(id)
end
end
if (men=="Level Menu") then
if (sel<=0) then
end
if (sel==1) then
dh4.level[id]=0
msg2(id,"©©000255000Successful to Reset Level!@C")
dh4.levelhud(id)
end
if (sel==2) then
dh4.exp[id]=0
msg2(id,"©©000255000Successful to Reset Experience!@C")
dh4.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)
dh4.credits[id]=dh4.credits[id]+1
credits(id)
dh4.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)
dh4.credits[id]=dh4.credits[id]+5
credits(id)
dh4.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)
dh4.credits[id]=dh4.credits[id]+10
credits(id)
dh4.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)
dh4.credits[id]=dh4.credits[id]+15
credits(id)
dh4.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)
dh4.credits[id]=dh4.credits[id]+16
credits(id)
dh4.credmen(id)
else
msg2(id,"©255000000Not enough Money!@C")
end
end
end
if (men=="Commands Menu") then
if (sel<=0) then
end
if (sel==1) then
msg2(id,"©000255000dh_give_lvl <id> <lvl>@C")
end
if (sel==2) then
msg2(id,"©000255000dh_give_exp <id> <exp>@C")
end
if (sel==3) then
msg2(id,"©000255000dh_give_credits <id> <credits>@C")
end
end
end
function dh4.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","dh4.sa")
function dh4.sa(id,act)
if (act<=1) then
dh4.buymenu(id)
end
if (act==2) then
dh4.classes.classmenu(id)
end
if (act==3) then
dh4.main(id)
end
end
function dh4.main(id)
menu(id,"Main Menu,Class Menu,Buy Menu,Level Menu,Credits Menu,Commands Menu")
end
function dh4.lvlmen(id)
menu(id,"Level Menu,Reset Level,Reset Experience")
end
function dh4.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","dh4.parse")
function dh4.parse(cmd)
local parses = string.split(cmd)
local cm = tostring(parses[1])
local id = tonumber(parses[2])
if (cm=="dh_give_lvl") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
dh4.level[id]=dh4.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=="dh_give_exp") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
dh4.exp[id]=dh4.exp[id]+cm2
msg2(id,"©000255000Admin Gave you "..cm2.." of Experience!@C")
print(cm.." "..id.." "..cm2)
dh4.exphud(id)
return 1
else
print("©255000000Error: You Forgot id or amount of Experience")
return 1
end
end
if (cm=="dh_give_credits") then
local cm2 = tonumber(parses[3])
if (id ~= nil and cm2 ~= nil) then
dh4.credits[id]=dh4.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
return 0
end
function dh4.title(id)
parse('hudtxt2 '..id..' 7 "©000255000|Dote-Heroes|D-H Mod" 247 13')
parse('hudtxt2 '..id..' 9 "©160160255'..game("sv_name")..'" 260 26')
end
function dh4.cmdmen(id)
menu(id,"Commands Menu@b,dh_give_lvl <id> <level>|Give to player More level,dh_give_exp <id> <experience>|Give to player More Experience,dh_give_credits <id> <credits>|Give to player More Credits")
end