





but what's wrong with this script below? (i was not test this script on old version(0.1.1.9)) the menu and scope position is not working, i was disable the


Don't annoyed 

-- Point system v0.4 by Rian2_idih
dir = "sys/lua/"
dec = "decrease"
inc="increase"
snipers = {31,33,34,35,36,37}
ctscore = 0
tscore = 0
countdown = false
timebomb = tonumber(game("mp_c4timer"))-1
timenodefuse = (timebomb-10)
timedefuse = (timebomb-5)
timems = 0
function Array(size,value)
local array = {}
for i = 1, size do
array[i]=value
end
return array
end
dofile(dir.."wrapper.lua")
mp_infammo(1)
mp_autoteambalance(0)
xpviewer={}
table_reqlvlup = {
1500,
2500,
4000,
6000,
8500,
10000,
12500,
15000,
18000,
25000,
30500,
36000,
43000,
56300,
55000,
61000,
65500,
67500,
70900,
74500,
81200,
87100,
93700,
101000,
110200
}
table_weapon = {
1,
4,
6,
3,
10,
11,
20,
22,
30,
32,
31,
33,
34,
37,
36,
35,
40,
49,
48,
47,
46,
45,
45,
45,
45
}
table_weapon2 = {
0,
0,
0,
0,
3,
3,
1,
1,
58,
58,
58,
58,
79,
79,
79,
79,
80,
80,
80,
80,
80,
0,
0,
41,
83
}
language = {
[1] = {
"Anda dibunuh oleh %s di %sx%s dengan %s",
"%s mempunyai %s armor dan %s health",
"%s mempunyai %s health",
"Anda membunuh %s di %sx%s dengan %s",
"Login sebagai %s",
"Tidak login",
"Naik level ke level %s@C",
"harga",
"Beli Perlengkapan",
"Sistem pesan",
"Tentang",
"Normal sistem pesan",
"Kustom sistem pesan",
"Waktu sistem pesan",
"Level sistem pesan",
"Semua",
"Merah",
"Biru",
"Hijau",
"Kuning",
"Anda spraying tunggu 30 detik",
"Anda harus level 3 untuk menggunakan fasilitas ini@C",
"Tidak cukup xp untuk membeli ini@C",
"%s menggunakan resetscore",
"Anda tidak mempunyai resetscore",
"Nama server: %s",
"Map server: %s",
"Lua oleh Idlers",
"Tibia sistem pesan",
"Menu point sistem",
"Pengaturan",
"Bahasa",
"Warna",
"Bahasa indonesia",
"Bahasa inggris",
"Peluru Meledak",
"Peluru Meledak: %s",
"Anda tidak mempunyai Peluru Meledak@C",
"Berhasil membeli item tersebut!@C",
"Sistem pesan anda telah diganti!@C"
},
[2] = {
"You killed by %s at %sx%s with %s",
"%s has %s Armor and %s Health left",
"%s has %s Health left",
"You killing %s at %sx%s with %s",
"Logged in as %s",
"Not login",
"Level up to level %s@C",
"price",
"Buying Item",
"Message System",
"About",
"Normal say system",
"Custom say system",
"Clock say system",
"Level say system",
"All",
"Red",
"Blue",
"Green",
"Yellow",
"You spraying wait 30 second",
"You must level 3 to use this function@C",
"Not enough xp to buy this@C",
"%s used resetscore",
"You don't have resetscore",
"Server name: %s",
"Server map: %s",
"Lua by Idlers",
"Tibia say system",
"Point system menu",
"Settings",
"Language",
"Color",
"Indonesian Language",
"English Language",
"Explosive Bullets",
"Explosive Bullets: %s",
"You don't have Explosive Bullets@C",
"Success buying that item!@C",
"Your say system has been changed!@C"
},
}
function totable(t,match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
function xphud(a,b,c,d,e,f)
local toprint = ("©"..c..""..d)
parse('hudtxt2 '..a..' '..b..' "'..toprint..'" '..e.." "..f)
end
function dist(x1,y1,x2,y2)
return math.sqrt( (x1-x2)^2 + (y1-y2)^2 )
end
_player = player
function player(id,value)
if value=="exp" then
return point_exp[id]
elseif value=="level" then
return level_level[id]
elseif value=="resetscore" then
return resetscoreleft[id]
else
return _player(id,value)
end
end
function addxp(id,type,xp)
if id==nil then id=0 end
if type==nil then type=inc end
if xp==nil then xp=100 end
if type==inc then
point_exp[id]=point_exp[id]+xp
elseif type==dec then
point_exp[id]=point_exp[id]-xp
end
end
function save(id,usgnid)
file = io.open("sys/lua/xp system/"..usgnid..'.txt', "w+") or io.tmpfile()
local text = ""
text = tostring(point_exp[id])
text = text .." "..level_level[id]
text = text .." "..point_score[id]
text = text .." "..point_deaths[id]
text = text .." "..resetscoreleft[id]
file:write(text)
file:close()
end
function load(id,file)
for line in file:lines() do
local parses = totable(line)
local point = tonumber(parses[1])
local level = tonumber(parses[2])
local score = tonumber(parses[4])
local dead = tonumber(parses[5])
local rs = tonumber(parses[6])
if point ~= nil then
point_exp[id]=point
end
if level ~= nil then
level_level[id]=level
end
if score ~= nil then
point_score[id]=score
end
if dead ~= nil then
point_deaths[id]=dead
end
if rs ~= nil then
resetscoreleft[id]=rs
end
end
end
function buyweapons(id)
men = language[lang[id]][9]..","..language[lang[id]][36].."|"..language[lang[id]][8]..": 300xp,Defuse Kit|"..language[lang[id]][8]..": 200xp"
menu(id,men)
end
function pointscript_menu(id)
resetscorestr = "Resetscore|("..resetscoreleft[id]..")"
men = language[lang[id]][30]..","..resetscorestr..","..language[lang[id]][9]..","..language[lang[id]][11]
menu(id,men)
end
function msgsystem(id)
men = language[lang[id]][10]..","..language[lang[id]][12]..","..language[lang[id]][13]
menu(id,men)
end
function msgcustom(id)
men = language[lang[id]][13]..","..language[lang[id]][14]..","..language[lang[id]][15]..","..language[lang[id]][29]..","..language[lang[id]][16]
menu(id,men)
end
function color(id)
men = language[lang[id]][33]..","..language[lang[id]][17]..","..language[lang[id]][18]..","..language[lang[id]][19]..","..language[lang[id]][20]
menu(id,men)
end
function point_reach(id)
if point_exp[id]==table_reqlvlup[level_level[id]] then
if level_level[id]==#table_reqlvlup+1 then
refresh(id)
else
level_level[id]=level_level[id]+1
strip(id,table_weapon[player(id,"level")-1])
equip(id,table_weapon[player(id,"level")])
setweapon(id,table_weapon[player(id,"level")])
resetscoreleft[id]=resetscoreleft[id]+1
addxp(id,dec,player(id,"exp"))
level_levelup(id)
refresh(id)
end
end
end
function level_levelup(id)
msg2(id,string.format("©000255000"..language[lang[id]][7].."", player(id,"level")))
end
function needlvl3(id)
msg2(id,"©255000000"..language[lang[id]][22])
end
function needxp(id)
msg2(id,"©25500000"..language[lang[id]][23])
end
function sethud(id)
id = tonumber(id)
parse("hudtxt2 "..id.." 38 \""..posx[id].."\" "..(positionx[id]-20).." "..positiony[id])
parse("hudtxt2 "..id.." 39 \""..posy[id].."\" "..positionx[id].." "..(positiony[id]-20))
end
function refresh(i)
if i~=nil then
if player(i,"exists") then
if level_level[i]==#table_reqlvlup+1 then
xphud(i,1,"255255255","Level: Max level",0,200)
xphud(i,2,"255255255","Xp: "..player(i,"exp"),0,215)
else
xphud(i,1,"255255255","Level: "..player(i,"level"),0,200)
xphud(i,2,"255255255","Xp: "..player(i,"exp").."/"..table_reqlvlup[player(i,"level")].." ("..string.sub(""..player(i,"exp")*100/table_reqlvlup[level_level[i]].."",1,5).."%)",0,215)
end
xphud(i,3,"255255255","Kills: "..point_score[i],0,230)
xphud(i,4,"255255255","Deaths: "..point_deaths[i],0,245)
end
end
end
pl = game("sv_maxplayers")
point_exp = Array(pl,0)
level_level = Array(pl,1)
point_score = Array(pl,0)
point_deaths = Array(pl,0)
say_color = Array(pl,0)
say_system = Array(pl,0)
resetscoreleft = Array(pl,3)
lang = Array(pl,2)
explosivebullets = Array(pl,0)
bulletmode = Array(pl,false)
posx = Array(pl,0)
posy = Array(pl,0)
positionx = Array(pl,0)
positiony = Array(pl,0)
attacks = Array(pl,0)
parse("hudtxt 40 \"©255000000T Score:"..tscore.."\" 200 5")
parse("hudtxt 41 \"©000000255CT Score:"..ctscore.."\" 400 5")
addhook("kill","point_kill")
function point_kill(id,pl,lol,x,y)
if pl~=id then
weapon = player(id,"weapontype")
addxp(id)
point_deaths[pl]=point_deaths[pl]+1
point_score[id]=point_score[id]+1
refresh(pl)
refresh(id)
point_reach(id)
msg2(pl,string.format("©255000000"..language[lang[pl]][1].."", player(id,"name") , x , y , itemtype(weapon,"name")))
msg2(id,string.format("©000255000"..language[lang[id]][4].."", player(pl,"name") , x , y , itemtype(weapon,"name")))
if player(id,"armor")>0 then
msg2(pl,string.format("©255000000"..language[lang[pl]][2].."", player(id,"name") , player(id,"armor") , player(id,"health")))
else
msg2(pl,string.format("©255000000"..language[lang[pl]][3].."", player(id,"name") , player(id,"health")))
end
if player(id,"team")==1 then tscore=tscore+1 end
if player(id,"team")==2 then ctscore=ctscore+1 end
parse("hudtxt 40 \"©255000000T Score:"..tscore.."\" 200 5")
parse("hudtxt 41 \"©000000255CT Score:"..ctscore.."\" 400 5")
end
end
addhook("second","point_second")
function point_second()
for _, id in ipairs(player(0,"table")) do
setmoney(id,0)
mp_infammo(1)
refresh(id)
end
end
addhook("team","point_team")
function point_team(id,what)
if what>0 then
men = language[lang[id]][32]..","..language[lang[id]][34]..","..language[lang[id]][35]
menu(id,men)
end
end
addhook("say","point_say")
function point_say(id,txt)
if txt:sub(1,4)=="!say" then
success = {}
color = txt:sub(5,8)
saysys = txt:sub(9,10)
if color>=0 and color<=3 then
say_color[id]=color
success[1]=true
end
if saysys>=0 and saysys<=4 then
say_system[id]=saysys
success[2]=true
end
if success[1]~=nil and success[2]~=nil then
msg2(id,string.char(169).."255255255"..language[lang[id]][40])
end
end
if say_system[id]==1 then
if say_color[id]==0 then
msg(os.date("©255000000%H:%M:%S "..player(id,"name")..": "..txt))
return 1
elseif say_color[id]==1 then
msg(os.date("©000000255%H:%M:%S "..player(id,"name")..": "..txt))
return 1
elseif say_color[id]==2 then
msg(os.date("©000255000%H:%M:%S "..player(id,"name")..": "..txt))
return 1
elseif say_color[id]==3 then
msg(os.date("©255255000%H:%M:%S "..player(id,"name")..": "..txt))
return 1
end
elseif say_system[id]==2 then
if say_color[id]==0 then
msg("©255000000"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
elseif say_color[id]==1 then
msg("©000000255"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
elseif say_color[id]==2 then
msg("©000255000"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
elseif say_color[id]==3 then
msg("©255255000"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
end
elseif say_system[id]==3 then
if say_color[id]==0 then
if txt:sub(-1)=="!" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©255000000%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
elseif say_color[id]==1 then
if txt:sub(-1)=="!" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©000000255%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
elseif say_color[id]==2 then
if txt:sub(-1)=="!" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©000255000%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
elseif say_color[id]==3 then
if txt:sub(-1)=="!" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©255255000%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
end
elseif say_system[id]==4 then
if say_color[id]==0 then
if txt:sub(-1)=="!" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©255000000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
elseif say_color[id]==1 then
if txt:sub(-1)=="!" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©000000255%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
elseif say_color[id]==2 then
if txt:sub(-1)=="!" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©000255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
elseif say_color[id]==3 then
if txt:sub(-1)=="!" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©255255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
end
return 0
end
end
addhook("join","point_load")
function point_load(id)
level_level[id]=1
point_exp[id]=0
local usgnid = player(id,"usgn")
if usgnid > 0 then
msg2(id,string.format("©000255000"..language[lang[id]][5].."", usgnid))
local filename = "sys/lua/xp system/"..usgnid..".txt"
local file = io.open(filename)
if file then
load(id,file)
if file ~= nil then
file:close()
end
end
else
msg2(id,"©255000000"..language[lang[id]][6])
end
end
addhook("leave","point_save")
function point_save(id,reason)
local usgnid = player(id,"usgn")
if usgnid > 0 then
save(id,usgnid)
end
level_level[id]=1
point_exp[id]=0
end
addhook("spawn","level_weapon")
function level_weapon(id)
equip(id,table_weapon[level_level[id]])
for _, t in ipairs(player(0,"team1")) do
strip(t,2)
end
for _, ct in ipairs(player(0,"team2")) do
if level_level[ct]>1 then
strip(ct,1)
end
end
if table_weapon2[level_level[id]]>0 then
equip(id,table_weapon2[level_level[id]])
end
end
addhook("minute","point_saveminute")
function point_saveminute()
for _, id in ipairs(player(0,"table")) do
if player(id,"usgn")>0 then
save(id,player(id,"usgn"))
end
end
end
addhook("buy","nobuy")
function nobuy(id,weapon)
return 1
end
addhook("walkover","notaking")
function notaking(id,iid,type,ain,a,mode)
if type~=55 then
return 1
end
end
addhook("drop","nodrop")
function nodrop(id,iid,type,ain,a,mode,x,y)
return 1
end
addhook("die","nodropdie")
function nodropdie(id)
attacks[id]=0
parse("hudtxt2 "..id.." 38 \" \" 0 0")
parse("hudtxt2 "..id.." 39 \" \" 0 0")
return 1
end
addhook("spray","spraymsg")
function spraymsg(id)
msg2(id,"©000255000"..language[lang[id]][21])
end
addhook("serveraction","servermenu")
function servermenu(id,sel)
if sel==1 then
pointscript_menu(id)
elseif sel==2 then
men = language[lang[id]][31]..","..language[lang[id]][10]..","..language[lang[id]][32]..","..language[lang[id]][36]
menu(id,men)
end
end
addhook("attack","makeexplosion")
function makeexplosion(id)
if bulletmode[id]==true then
if explosivebullets[id]>0 then
local k=1
local x=false
local ptbl = player(0,"tableliving")
local px = player(id,"x")
local py = player(id,"y")
local prot = math.rad(player(id,"rot")-90)
local xinc = math.cos(prot)
local yinc = math.sin(prot)
local cx = px + xinc; local cy = py + yinc
local pl_hit = 1
while ( not tile(cx/32, cy/32, "wall") ) and ( not x ) do
k=k+1
cx = cx + xinc; cy = cy + yinc
if (k>700) then --just in case check
break
end
for _, i in pairs(ptbl) do
if( ( dist(cx,cy,player(i,"x"),player(i,"y")) <=20 ) and i ~= id ) then
x = true
pl_hit = 0
end
end
end
parse("explosion "..math.ceil(cx - ( pl_hit*xinc*32 )).." "..math.ceil(cy - ( pl_hit*yinc*32) ).." 40 75 "..id)
end
if explosivebullets[id]==0 then endexpbullet(id) end
end
end
addhook("menu","pointmenu")
function pointmenu(id,men,sel)
if men==language[lang[id]][30] then
if sel==1 then
if resetscoreleft[id]>0 then
setscore(id,0)
setdeaths(id,0)
resetscoreleft[id]=resetscoreleft[id]-1
for _, i in ipairs(player(0,"table")) do
msg2(i,string.format("©000255000"..language[lang[id]][24].."", player(id,"name")))
end
else
msg2(id,"©255000000"..language[lang[id]][25])
end
elseif sel==2 then
if level_level[id]>=3 then
buyweapons(id)
else
needlvl3(id)
end
elseif sel==3 then
msg2(id,string.format("©000255000"..language[lang[id]][26].."", game("sv_name")))
msg2(id,string.format("©000255000"..language[lang[id]][27].."", game("sv_map")))
msg2(id,"©000255000"..language[lang[id]][28])
end
end
if men==language[lang[id]][33] then
if sel==0 then
pointscript_menu(id)
elseif sel==1 then
if point_exp[id]>=300 then
if level_level[id]>=3 then
explosivebullets = explosivebullets+1
addxp(id,dec,300)
msg2(id,string.char(169).."255000000"..language[lang[id]][39])
refresh(id)
else
needlvl3(id)
end
else
needxp(id)
end
elseif sel==2 then
if point_exp[id]>=200 then
spawnitem(56,player(id,"tilex"),player(id,"tiley"))
addxp(id,dec,200)
msg2(id,string.char(169).."255000000"..language[lang[id]][39])
refresh(id)
else
needxp(id)
end
end
end
if men==language[lang[id]][10] then
if sel==0 then
men = language[lang[id]][31]..","..language[lang[id]][10]..","..language[lang[id]][32]
menu(id,men)
elseif sel==1 then
say_system[id]=0
elseif sel==2 then
msgcustom(id)
end
end
if men==language[lang[id]][13] then
if sel==0 then
msgsystem(id)
elseif sel==1 then
say_system[id]=1
color(id)
elseif sel==2 then
say_system[id]=2
color(id)
elseif sel==3 then
say_system[id]=3
color(id)
elseif sel==4 then
say_system[id]=4
color(id)
end
end
if men==language[lang[id]][33] then
if sel==0 then
msgcustom(id)
elseif sel==1 then
say_color[id]=0
elseif sel==2 then
say_color[id]=1
elseif sel==3 then
say_color[id]=2
elseif sel==4 then
say_color[id]=3
end
end
if men==language[lang[id]][32] then
if sel==1 then
lang[id]=1
else
lang[id]=2
end
end
if men==language[lang[id]][31] then
if sel==1 then
if player(id,"level")>=3 then
msgsystem(id)
else
needlvl3(id)
end
elseif sel==2 then
men = language[lang[id]][32]..","..language[lang[id]][34]..","..language[lang[id]][35]
menu(id,men)
elseif sel==3 then
if explosivebullets[id]>0 then
bulletmode[id]=true
end
end
end
end
addhook("clientdata","set")
function set(id,mode,x,y)
if mode==0 then
positionx[id]=x
positiony[id]=y
end
if mode==2 then
posx[id]=x
posy[id]=y
end
end
addhook("attack2","weaponmode")
function weaponmode(id,mode)
weapon=player(id,"weapontype")
for _, l in ipairs(snipers) do
if weapon==l then
attacks[id]=mode
end
end
end
dir = "sys/lua/"
dec = "decrease"
inc="increase"
snipers = {31,33,34,35,36,37}
ctscore = 0
tscore = 0
countdown = false
timebomb = tonumber(game("mp_c4timer"))-1
timenodefuse = (timebomb-10)
timedefuse = (timebomb-5)
timems = 0
function Array(size,value)
local array = {}
for i = 1, size do
array[i]=value
end
return array
end
dofile(dir.."wrapper.lua")
mp_infammo(1)
mp_autoteambalance(0)
xpviewer={}
table_reqlvlup = {
1500,
2500,
4000,
6000,
8500,
10000,
12500,
15000,
18000,
25000,
30500,
36000,
43000,
56300,
55000,
61000,
65500,
67500,
70900,
74500,
81200,
87100,
93700,
101000,
110200
}
table_weapon = {
1,
4,
6,
3,
10,
11,
20,
22,
30,
32,
31,
33,
34,
37,
36,
35,
40,
49,
48,
47,
46,
45,
45,
45,
45
}
table_weapon2 = {
0,
0,
0,
0,
3,
3,
1,
1,
58,
58,
58,
58,
79,
79,
79,
79,
80,
80,
80,
80,
80,
0,
0,
41,
83
}
language = {
[1] = {
"Anda dibunuh oleh %s di %sx%s dengan %s",
"%s mempunyai %s armor dan %s health",
"%s mempunyai %s health",
"Anda membunuh %s di %sx%s dengan %s",
"Login sebagai %s",
"Tidak login",
"Naik level ke level %s@C",
"harga",
"Beli Perlengkapan",
"Sistem pesan",
"Tentang",
"Normal sistem pesan",
"Kustom sistem pesan",
"Waktu sistem pesan",
"Level sistem pesan",
"Semua",
"Merah",
"Biru",
"Hijau",
"Kuning",
"Anda spraying tunggu 30 detik",
"Anda harus level 3 untuk menggunakan fasilitas ini@C",
"Tidak cukup xp untuk membeli ini@C",
"%s menggunakan resetscore",
"Anda tidak mempunyai resetscore",
"Nama server: %s",
"Map server: %s",
"Lua oleh Idlers",
"Tibia sistem pesan",
"Menu point sistem",
"Pengaturan",
"Bahasa",
"Warna",
"Bahasa indonesia",
"Bahasa inggris",
"Peluru Meledak",
"Peluru Meledak: %s",
"Anda tidak mempunyai Peluru Meledak@C",
"Berhasil membeli item tersebut!@C",
"Sistem pesan anda telah diganti!@C"
},
[2] = {
"You killed by %s at %sx%s with %s",
"%s has %s Armor and %s Health left",
"%s has %s Health left",
"You killing %s at %sx%s with %s",
"Logged in as %s",
"Not login",
"Level up to level %s@C",
"price",
"Buying Item",
"Message System",
"About",
"Normal say system",
"Custom say system",
"Clock say system",
"Level say system",
"All",
"Red",
"Blue",
"Green",
"Yellow",
"You spraying wait 30 second",
"You must level 3 to use this function@C",
"Not enough xp to buy this@C",
"%s used resetscore",
"You don't have resetscore",
"Server name: %s",
"Server map: %s",
"Lua by Idlers",
"Tibia say system",
"Point system menu",
"Settings",
"Language",
"Color",
"Indonesian Language",
"English Language",
"Explosive Bullets",
"Explosive Bullets: %s",
"You don't have Explosive Bullets@C",
"Success buying that item!@C",
"Your say system has been changed!@C"
},
}
function totable(t,match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
function xphud(a,b,c,d,e,f)
local toprint = ("©"..c..""..d)
parse('hudtxt2 '..a..' '..b..' "'..toprint..'" '..e.." "..f)
end
function dist(x1,y1,x2,y2)
return math.sqrt( (x1-x2)^2 + (y1-y2)^2 )
end
_player = player
function player(id,value)
if value=="exp" then
return point_exp[id]
elseif value=="level" then
return level_level[id]
elseif value=="resetscore" then
return resetscoreleft[id]
else
return _player(id,value)
end
end
function addxp(id,type,xp)
if id==nil then id=0 end
if type==nil then type=inc end
if xp==nil then xp=100 end
if type==inc then
point_exp[id]=point_exp[id]+xp
elseif type==dec then
point_exp[id]=point_exp[id]-xp
end
end
function save(id,usgnid)
file = io.open("sys/lua/xp system/"..usgnid..'.txt', "w+") or io.tmpfile()
local text = ""
text = tostring(point_exp[id])
text = text .." "..level_level[id]
text = text .." "..point_score[id]
text = text .." "..point_deaths[id]
text = text .." "..resetscoreleft[id]
file:write(text)
file:close()
end
function load(id,file)
for line in file:lines() do
local parses = totable(line)
local point = tonumber(parses[1])
local level = tonumber(parses[2])
local score = tonumber(parses[4])
local dead = tonumber(parses[5])
local rs = tonumber(parses[6])
if point ~= nil then
point_exp[id]=point
end
if level ~= nil then
level_level[id]=level
end
if score ~= nil then
point_score[id]=score
end
if dead ~= nil then
point_deaths[id]=dead
end
if rs ~= nil then
resetscoreleft[id]=rs
end
end
end
function buyweapons(id)
men = language[lang[id]][9]..","..language[lang[id]][36].."|"..language[lang[id]][8]..": 300xp,Defuse Kit|"..language[lang[id]][8]..": 200xp"
menu(id,men)
end
function pointscript_menu(id)
resetscorestr = "Resetscore|("..resetscoreleft[id]..")"
men = language[lang[id]][30]..","..resetscorestr..","..language[lang[id]][9]..","..language[lang[id]][11]
menu(id,men)
end
function msgsystem(id)
men = language[lang[id]][10]..","..language[lang[id]][12]..","..language[lang[id]][13]
menu(id,men)
end
function msgcustom(id)
men = language[lang[id]][13]..","..language[lang[id]][14]..","..language[lang[id]][15]..","..language[lang[id]][29]..","..language[lang[id]][16]
menu(id,men)
end
function color(id)
men = language[lang[id]][33]..","..language[lang[id]][17]..","..language[lang[id]][18]..","..language[lang[id]][19]..","..language[lang[id]][20]
menu(id,men)
end
function point_reach(id)
if point_exp[id]==table_reqlvlup[level_level[id]] then
if level_level[id]==#table_reqlvlup+1 then
refresh(id)
else
level_level[id]=level_level[id]+1
strip(id,table_weapon[player(id,"level")-1])
equip(id,table_weapon[player(id,"level")])
setweapon(id,table_weapon[player(id,"level")])
resetscoreleft[id]=resetscoreleft[id]+1
addxp(id,dec,player(id,"exp"))
level_levelup(id)
refresh(id)
end
end
end
function level_levelup(id)
msg2(id,string.format("©000255000"..language[lang[id]][7].."", player(id,"level")))
end
function needlvl3(id)
msg2(id,"©255000000"..language[lang[id]][22])
end
function needxp(id)
msg2(id,"©25500000"..language[lang[id]][23])
end
function sethud(id)
id = tonumber(id)
parse("hudtxt2 "..id.." 38 \""..posx[id].."\" "..(positionx[id]-20).." "..positiony[id])
parse("hudtxt2 "..id.." 39 \""..posy[id].."\" "..positionx[id].." "..(positiony[id]-20))
end
function refresh(i)
if i~=nil then
if player(i,"exists") then
if level_level[i]==#table_reqlvlup+1 then
xphud(i,1,"255255255","Level: Max level",0,200)
xphud(i,2,"255255255","Xp: "..player(i,"exp"),0,215)
else
xphud(i,1,"255255255","Level: "..player(i,"level"),0,200)
xphud(i,2,"255255255","Xp: "..player(i,"exp").."/"..table_reqlvlup[player(i,"level")].." ("..string.sub(""..player(i,"exp")*100/table_reqlvlup[level_level[i]].."",1,5).."%)",0,215)
end
xphud(i,3,"255255255","Kills: "..point_score[i],0,230)
xphud(i,4,"255255255","Deaths: "..point_deaths[i],0,245)
end
end
end
pl = game("sv_maxplayers")
point_exp = Array(pl,0)
level_level = Array(pl,1)
point_score = Array(pl,0)
point_deaths = Array(pl,0)
say_color = Array(pl,0)
say_system = Array(pl,0)
resetscoreleft = Array(pl,3)
lang = Array(pl,2)
explosivebullets = Array(pl,0)
bulletmode = Array(pl,false)
posx = Array(pl,0)
posy = Array(pl,0)
positionx = Array(pl,0)
positiony = Array(pl,0)
attacks = Array(pl,0)
parse("hudtxt 40 \"©255000000T Score:"..tscore.."\" 200 5")
parse("hudtxt 41 \"©000000255CT Score:"..ctscore.."\" 400 5")
addhook("kill","point_kill")
function point_kill(id,pl,lol,x,y)
if pl~=id then
weapon = player(id,"weapontype")
addxp(id)
point_deaths[pl]=point_deaths[pl]+1
point_score[id]=point_score[id]+1
refresh(pl)
refresh(id)
point_reach(id)
msg2(pl,string.format("©255000000"..language[lang[pl]][1].."", player(id,"name") , x , y , itemtype(weapon,"name")))
msg2(id,string.format("©000255000"..language[lang[id]][4].."", player(pl,"name") , x , y , itemtype(weapon,"name")))
if player(id,"armor")>0 then
msg2(pl,string.format("©255000000"..language[lang[pl]][2].."", player(id,"name") , player(id,"armor") , player(id,"health")))
else
msg2(pl,string.format("©255000000"..language[lang[pl]][3].."", player(id,"name") , player(id,"health")))
end
if player(id,"team")==1 then tscore=tscore+1 end
if player(id,"team")==2 then ctscore=ctscore+1 end
parse("hudtxt 40 \"©255000000T Score:"..tscore.."\" 200 5")
parse("hudtxt 41 \"©000000255CT Score:"..ctscore.."\" 400 5")
end
end
addhook("second","point_second")
function point_second()
for _, id in ipairs(player(0,"table")) do
setmoney(id,0)
mp_infammo(1)
refresh(id)
end
end
addhook("team","point_team")
function point_team(id,what)
if what>0 then
men = language[lang[id]][32]..","..language[lang[id]][34]..","..language[lang[id]][35]
menu(id,men)
end
end
addhook("say","point_say")
function point_say(id,txt)
if txt:sub(1,4)=="!say" then
success = {}
color = txt:sub(5,8)
saysys = txt:sub(9,10)
if color>=0 and color<=3 then
say_color[id]=color
success[1]=true
end
if saysys>=0 and saysys<=4 then
say_system[id]=saysys
success[2]=true
end
if success[1]~=nil and success[2]~=nil then
msg2(id,string.char(169).."255255255"..language[lang[id]][40])
end
end
if say_system[id]==1 then
if say_color[id]==0 then
msg(os.date("©255000000%H:%M:%S "..player(id,"name")..": "..txt))
return 1
elseif say_color[id]==1 then
msg(os.date("©000000255%H:%M:%S "..player(id,"name")..": "..txt))
return 1
elseif say_color[id]==2 then
msg(os.date("©000255000%H:%M:%S "..player(id,"name")..": "..txt))
return 1
elseif say_color[id]==3 then
msg(os.date("©255255000%H:%M:%S "..player(id,"name")..": "..txt))
return 1
end
elseif say_system[id]==2 then
if say_color[id]==0 then
msg("©255000000"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
elseif say_color[id]==1 then
msg("©000000255"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
elseif say_color[id]==2 then
msg("©000255000"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
elseif say_color[id]==3 then
msg("©255255000"..player(id,"name").."(Level "..player(id,"level").."): "..txt)
return 1
end
elseif say_system[id]==3 then
if say_color[id]==0 then
if txt:sub(-1)=="!" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©255000000%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
elseif say_color[id]==1 then
if txt:sub(-1)=="!" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©000000255%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
elseif say_color[id]==2 then
if txt:sub(-1)=="!" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©000255000%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
elseif say_color[id]==3 then
if txt:sub(-1)=="!" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").." yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").." asks : "..txt.." "))
return 1
else
msg(os.date("©255255000%H:%M:%S "..player(id,"name").." says : "..txt.." "))
return 1
end
end
elseif say_system[id]==4 then
if say_color[id]==0 then
if txt:sub(-1)=="!" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255000000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©255000000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
elseif say_color[id]==1 then
if txt:sub(-1)=="!" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000000255%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©000000255%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
elseif say_color[id]==2 then
if txt:sub(-1)=="!" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©000255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©000255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
elseif say_color[id]==3 then
if txt:sub(-1)=="!" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") yells : "..txt:upper().." "))
return 1
elseif txt:sub(-1)=="?" then
msg(os.date("©255255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") asks : "..txt.." "))
return 1
else
msg(os.date("©255255000%H:%M:%S "..player(id,"name").."(Level "..player(id,"level")..") says : "..txt.." "))
return 1
end
end
return 0
end
end
addhook("join","point_load")
function point_load(id)
level_level[id]=1
point_exp[id]=0
local usgnid = player(id,"usgn")
if usgnid > 0 then
msg2(id,string.format("©000255000"..language[lang[id]][5].."", usgnid))
local filename = "sys/lua/xp system/"..usgnid..".txt"
local file = io.open(filename)
if file then
load(id,file)
if file ~= nil then
file:close()
end
end
else
msg2(id,"©255000000"..language[lang[id]][6])
end
end
addhook("leave","point_save")
function point_save(id,reason)
local usgnid = player(id,"usgn")
if usgnid > 0 then
save(id,usgnid)
end
level_level[id]=1
point_exp[id]=0
end
addhook("spawn","level_weapon")
function level_weapon(id)
equip(id,table_weapon[level_level[id]])
for _, t in ipairs(player(0,"team1")) do
strip(t,2)
end
for _, ct in ipairs(player(0,"team2")) do
if level_level[ct]>1 then
strip(ct,1)
end
end
if table_weapon2[level_level[id]]>0 then
equip(id,table_weapon2[level_level[id]])
end
end
addhook("minute","point_saveminute")
function point_saveminute()
for _, id in ipairs(player(0,"table")) do
if player(id,"usgn")>0 then
save(id,player(id,"usgn"))
end
end
end
addhook("buy","nobuy")
function nobuy(id,weapon)
return 1
end
addhook("walkover","notaking")
function notaking(id,iid,type,ain,a,mode)
if type~=55 then
return 1
end
end
addhook("drop","nodrop")
function nodrop(id,iid,type,ain,a,mode,x,y)
return 1
end
addhook("die","nodropdie")
function nodropdie(id)
attacks[id]=0
parse("hudtxt2 "..id.." 38 \" \" 0 0")
parse("hudtxt2 "..id.." 39 \" \" 0 0")
return 1
end
addhook("spray","spraymsg")
function spraymsg(id)
msg2(id,"©000255000"..language[lang[id]][21])
end
addhook("serveraction","servermenu")
function servermenu(id,sel)
if sel==1 then
pointscript_menu(id)
elseif sel==2 then
men = language[lang[id]][31]..","..language[lang[id]][10]..","..language[lang[id]][32]..","..language[lang[id]][36]
menu(id,men)
end
end
addhook("attack","makeexplosion")
function makeexplosion(id)
if bulletmode[id]==true then
if explosivebullets[id]>0 then
local k=1
local x=false
local ptbl = player(0,"tableliving")
local px = player(id,"x")
local py = player(id,"y")
local prot = math.rad(player(id,"rot")-90)
local xinc = math.cos(prot)
local yinc = math.sin(prot)
local cx = px + xinc; local cy = py + yinc
local pl_hit = 1
while ( not tile(cx/32, cy/32, "wall") ) and ( not x ) do
k=k+1
cx = cx + xinc; cy = cy + yinc
if (k>700) then --just in case check
break
end
for _, i in pairs(ptbl) do
if( ( dist(cx,cy,player(i,"x"),player(i,"y")) <=20 ) and i ~= id ) then
x = true
pl_hit = 0
end
end
end
parse("explosion "..math.ceil(cx - ( pl_hit*xinc*32 )).." "..math.ceil(cy - ( pl_hit*yinc*32) ).." 40 75 "..id)
end
if explosivebullets[id]==0 then endexpbullet(id) end
end
end
addhook("menu","pointmenu")
function pointmenu(id,men,sel)
if men==language[lang[id]][30] then
if sel==1 then
if resetscoreleft[id]>0 then
setscore(id,0)
setdeaths(id,0)
resetscoreleft[id]=resetscoreleft[id]-1
for _, i in ipairs(player(0,"table")) do
msg2(i,string.format("©000255000"..language[lang[id]][24].."", player(id,"name")))
end
else
msg2(id,"©255000000"..language[lang[id]][25])
end
elseif sel==2 then
if level_level[id]>=3 then
buyweapons(id)
else
needlvl3(id)
end
elseif sel==3 then
msg2(id,string.format("©000255000"..language[lang[id]][26].."", game("sv_name")))
msg2(id,string.format("©000255000"..language[lang[id]][27].."", game("sv_map")))
msg2(id,"©000255000"..language[lang[id]][28])
end
end
if men==language[lang[id]][33] then
if sel==0 then
pointscript_menu(id)
elseif sel==1 then
if point_exp[id]>=300 then
if level_level[id]>=3 then
explosivebullets = explosivebullets+1
addxp(id,dec,300)
msg2(id,string.char(169).."255000000"..language[lang[id]][39])
refresh(id)
else
needlvl3(id)
end
else
needxp(id)
end
elseif sel==2 then
if point_exp[id]>=200 then
spawnitem(56,player(id,"tilex"),player(id,"tiley"))
addxp(id,dec,200)
msg2(id,string.char(169).."255000000"..language[lang[id]][39])
refresh(id)
else
needxp(id)
end
end
end
if men==language[lang[id]][10] then
if sel==0 then
men = language[lang[id]][31]..","..language[lang[id]][10]..","..language[lang[id]][32]
menu(id,men)
elseif sel==1 then
say_system[id]=0
elseif sel==2 then
msgcustom(id)
end
end
if men==language[lang[id]][13] then
if sel==0 then
msgsystem(id)
elseif sel==1 then
say_system[id]=1
color(id)
elseif sel==2 then
say_system[id]=2
color(id)
elseif sel==3 then
say_system[id]=3
color(id)
elseif sel==4 then
say_system[id]=4
color(id)
end
end
if men==language[lang[id]][33] then
if sel==0 then
msgcustom(id)
elseif sel==1 then
say_color[id]=0
elseif sel==2 then
say_color[id]=1
elseif sel==3 then
say_color[id]=2
elseif sel==4 then
say_color[id]=3
end
end
if men==language[lang[id]][32] then
if sel==1 then
lang[id]=1
else
lang[id]=2
end
end
if men==language[lang[id]][31] then
if sel==1 then
if player(id,"level")>=3 then
msgsystem(id)
else
needlvl3(id)
end
elseif sel==2 then
men = language[lang[id]][32]..","..language[lang[id]][34]..","..language[lang[id]][35]
menu(id,men)
elseif sel==3 then
if explosivebullets[id]>0 then
bulletmode[id]=true
end
end
end
end
addhook("clientdata","set")
function set(id,mode,x,y)
if mode==0 then
positionx[id]=x
positiony[id]=y
end
if mode==2 then
posx[id]=x
posy[id]=y
end
end
addhook("attack2","weaponmode")
function weaponmode(id,mode)
weapon=player(id,"weapontype")
for _, l in ipairs(snipers) do
if weapon==l then
attacks[id]=mode
end
end
end
i didn't use a code tag because it's not working(maybe too big)