Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.disableAutoScore()
- colors = {
- bar = 0x696969,
- hot_unselected = 0x7a7a7a,
- hot_selected = 0x878787
- }
- shop = {
- {n="Varinha",img="1596513dd70.png",price=10,dmg=5},
- {n="Taco de baseball",img="1596513ff8c.png",price=32,dmg=7},
- {n="Taco de golf",img="159651429a0.png",price=56,dmg=9},
- {n="Espada",img="15965145722.png",price=78,dmg=12},
- {n="Picareta",img="15965148ea9.png",price=122,dmg=15},
- {n="Machado",img="1596514b69b.png",price=143,dmg=18},
- {n="Pé de cabra",img="1596514d4d6.png",price=168,dmg=27},
- }
- keys = {48,49,50,51,52,53,54,55,56,57}
- local npcs={}
- local time_spawn = os.time();
- local p = {}
- local mapas = {"@6978537",'<C><P L="3000" D="x_deadmeat/x_zone/x_200.jpg,1541,-461;x_deadmeat/x_campement/repos_fond.jpg,-378,-280" Ca="" /><Z><S><S L="3000" H="10" X="1457" Y="404" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="3000" X="1" H="10" Y="316" T="14" P="0,0,0,0,90,0,0,0" /></S><D /><O /></Z></C>'}
- local zombies={
- {"15922b9ad4d.png", "15923a3e2d4.png", 115, 23, 92, "Zombie", 20, 3,4},
- {"159237ccbfd.png", "15923a3555b.png", 115, 23, 92, "Zombie", 30, 6,8},
- {"159237ce30f.png", "15923a37f86.png", 115, 23, 92, "Zombie", 40, 12,12},
- {"159238d77a9.png", "15923a3a9a7.png", 50, 23, 25, "Drekke", 60, 18,16},
- {"15927206568.png", "15927208310.png", 50, 21, 42,"Ghost", 80, 10,22}
- }
- textarea=ui.addTextArea
- function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss,black_marcation,ground_marcation)
- --if not backgroundColor then backgroundColor=0x324650 end
- --if not borderColor then borderColor=0x000001 end
- if black_marcation then
- textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha,emboss)
- end
- if ground_marcation then
- textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha,emboss)
- end
- textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
- end
- function eventNewPlayer(name)
- p[name]={
- damage=5,
- delete="",
- delete2="",
- tempo = os.time(),
- life = 50,
- maxLife = 50,
- img = '',
- hot_selected = {1,152,"15926ee8777.png"},
- hot_items = {},
- coins = 0
- }
- p[name].hot_items[0]={img="",dmg=0}
- p[name].hot_items[1]={img="15926ee8777.png",dmg=3}
- p[name].hot_items[2]={img="",dmg=0}
- p[name].hot_items[3]={img="",dmg=0}
- p[name].hot_items[4]={img="",dmg=0}
- p[name].hot_items[5]={img="",dmg=0}
- p[name].hot_items[6]={img="",dmg=0}
- p[name].hot_items[7]={img="",dmg=0}
- p[name].hot_items[8]={img="",dmg=0}
- p[name].hot_items[9]={img="",dmg=0}
- ui.addTextArea(-1,"",name,150,28,500,35,colors.bar,colors.bar,80,true)
- ui.addTextArea(0,"<p align='left'><font color='#000000'>0",name,609,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(1,"<p align='left'><font color='#000000'>1",name,152,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(2,"<p align='left'><font color='#000000'>2",name,203,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(3,"<p align='left'><font color='#000000'>3",name,254,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(4,"<p align='left'><font color='#000000'>4",name,305,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(5,"<p align='left'><font color='#000000'>5",name,355,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(6,"<p align='left'><font color='#000000'>6",name,406,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(7,"<p align='left'><font color='#000000'>7",name,457,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(8,"<p align='left'><font color='#000000'>8",name,508,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(9,"<p align='left'><font color='#000000'>9",name,558,30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- ui.addTextArea(p[name].hot_selected[1],"<p align='left'><font color='#ffffff'>"..p[name].hot_selected[1],name,p[name].hot_selected[2],30,40,32,colors.hot_selected,colors.hot_unselected,80,true)
- tfm.exec.setPlayerScore(name, 0, false)
- n = name
- tfm.exec.addImage(p[n].hot_items[0].img, "&0", 609, 32,n);
- tfm.exec.addImage(p[n].hot_items[1].img, "&1", 152, 32,n);
- tfm.exec.addImage(p[n].hot_items[2].img, "&2", 203, 32,n);
- tfm.exec.addImage(p[n].hot_items[3].img, "&3", 254, 32,n);
- tfm.exec.addImage(p[n].hot_items[4].img, "&4", 305, 32,n);
- tfm.exec.addImage(p[n].hot_items[5].img, "&5", 355, 32,n);
- tfm.exec.addImage(p[n].hot_items[6].img, "&6", 406, 32,n);
- tfm.exec.addImage(p[n].hot_items[7].img, "&7", 457, 32,n);
- tfm.exec.addImage(p[n].hot_items[8].img, "&8", 508, 32,n);
- tfm.exec.addImage(p[n].hot_items[9].img, "&9", 558, 32,n);
- ui.addTextArea(50,"<p align='center'><VI><a href='event:shop'><B><I>Loja</a>",name,725,370,65,20,nil,0x324645,nil,true,true)
- system.bindKeyboard(name,32,true,true) system.bindKeyboard(name,37,true,true) system.bindKeyboard(name,39,true,true)
- system.bindKeyboard(name,48,true,true) system.bindKeyboard(name,49,true,true) system.bindKeyboard(name,50,true,true)
- system.bindKeyboard(name,51,true,true) system.bindKeyboard(name,52,true,true) system.bindKeyboard(name,53,true,true)
- system.bindKeyboard(name,54,true,true) system.bindKeyboard(name,55,true,true) system.bindKeyboard(name,56,true,true)
- system.bindKeyboard(name,57,true,true)
- lifeBar(name)
- tfm.exec.chatMessage("<CE>Bem-vindo ao Dead Challenge</CE><br><J>Em manutenção...</J>",name)
- end
- function eventTextAreaCallback(id,name,link)
- if link == "shop" then
- ui.addTextArea(51,"",name,150,75,500,300,nil,0x324650,nil,true,true)
- ui.addTextArea(52,"<p align='center'><J><font size='15'><B>Loja",name,148,77,504,22,nil,0x324645,nil,true,true)
- ui.addTextArea(53,"<font size='13'><p align='center'><R><B><a href='event:close'>Fechar</a>",name,152,352,496,20,0x1a2b30,0x1a2b30,nil,true,true)
- ui.addTextArea(54,"<p align='center'><J><font size='12'><B><VP>"..p[name].coins.." R$",name,542,318,100,22,nil,0x324645,nil,true,true)
- grids(name)
- end
- if link == "close" then
- for i,v in pairs({51,52,53,54}) do
- ui.removeTextArea(v,name)
- ui.removeTextArea(6969+v,name)
- ui.removeTextArea(7979+v,name)
- end
- for i,v in pairs(ids) do
- ui.removeTextArea(v,name)
- ui.removeTextArea(6969+v,name)
- ui.removeTextArea(7979+v,name)
- end
- for i,v in pairs(images_grid) do
- tfm.exec.removeImage(v)
- end
- end
- for i,v in pairs(shop) do
- if link == "info-"..v.n then
- ui.addPopup(0,3,"<p align='center'><B><I><font color='#ffcc00'>Informações do(a) "..v.n.."</font><br><font color='#C53DFF'>Preço:</font> "..v.price.." R$<br><font color='#2ECF73'>Dano de Attack:</font> "..v.dmg,name,151,170,499,true)
- end
- end
- end
- function grids(name)
- x_ = 104
- c = 0
- y_ = 115
- v = 0
- images_grid = {}
- ids={}
- for i,v in pairs(shop) do
- x_ = x_+50
- c = c+1
- addGrid(c,v.img,"Buy",x_,y_,name,v.n)
- end
- end
- function addGrid(id,img,buttonText,x,y,name,item)
- id = 8989+id
- id2 = 4949+id
- id3 = 3939+id
- ui.addTextArea(id,"",name,x,y,80,78,0x0b161c,0x0b161c,nil,true)
- ui.addTextArea(id2,"<p align='center'><B><J>"..buttonText,name,x+1,y+61,30,16,0x38516b,0x38516b,nil,true)
- ui.addTextArea(id3,"<p align='center'><B><V><a href='event:info-"..item.."'>Info<</a>",name,x+42,y+61,37,16,0x38516b,0x38516b,nil,true)
- img = tfm.exec.addImage(img, "&0", x+15, y+8,name);
- table.insert(images_grid,img)
- x_=x_+52
- v=v+1
- if v == 5 then
- x_ = 104
- y_ = y_+100
- v=0
- end
- table.insert(ids,id)
- table.insert(ids,id2)
- table.insert(ids,id3)
- end
- function eventPlayerDied(name)
- vivos=vivos-1;
- if vivos == 0 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- end
- function eventNewGame()
- tfm.exec.setGameTime(9999999)
- npcs = {}
- for id=200,400 do
- ui.removeTextArea(id,nil)
- end
- vivos = 0
- for n, i in pairs(tfm.get.room.playerList) do
- p[n].life = p[n].maxLife
- lifeBar(n)
- vivos=vivos+1;
- end
- end
- function eventKeyboard(name,key,down,x,y)
- if key == 32 and p[name].tempo < os.time()-800 then
- for n,v in pairs(npcs) do
- if x >= tfm.get.room.objectList[v.id].x - 25 and x <= tfm.get.room.objectList[v.id].x + 25 and y >= tfm.get.room.objectList[v.id].y - 25 and y <= tfm.get.room.objectList[v.id].y + 25 and not tfm.get.room.playerList[name].isDead then
- itm = p[name].hot_selected[1]
- v.life = v.life-p[name].hot_items[itm].dmg
- p[name].tempo = os.time();
- if v.life < 1 then
- tfm.exec.setPlayerScore(name,math.random(12),true)
- p[name].delete = v.id
- p[name].delete2 = n
- if p[name].life < p[name].maxLife then
- p[name].life = p[name].life+math.random(5,20)
- end
- if p[name].life > p[name].maxLife then
- p[name].life = p[name].maxLife
- end
- lifeBar(name)
- end
- end
- end
- end
- if p[name].delete ~= '' then
- ui.removeTextArea(p[name].delete,nil)
- table.remove(npcs,p[name].delete2)
- tfm.exec.removeObject(p[name].delete)
- p[name].delete = ''
- end
- if key_def(key) then
- ui.addTextArea(p[name].hot_selected[1],"<p align='left'><font color='#000000'>"..p[name].hot_selected[1],name,p[name].hot_selected[2],30,40,32,colors.hot_unselected,colors.hot_unselected,80,true)
- p[name].hot_selected = {key_number(key),key_x(key_number(key)),initial_item}
- ui.addTextArea(p[name].hot_selected[1],"<p align='left'><font color='#ffffff'>"..p[name].hot_selected[1],name,p[name].hot_selected[2],30,40,32,colors.hot_selected,colors.hot_unselected,80,true)
- end
- end
- -- Sistema de vida por Fofinhoppp
- -- 21/12/2016
- function lifeBar(player)
- if not p[player] then return end
- local mLife = p[player].maxLife
- local life = p[player].life
- ui.addTextArea(10, '', player, -13, 25, 10, 370, 0xFF0000, 0xFF0000, 1, true)
- ui.addTextArea(11, '', player, -13, 395-(370/mLife)*life, 10, (370/mLife)*life, 0x00FF00, 0x00FF00, 1, true)
- ui.addTextArea(12, '', player, -15, 0, 10, 440, 0x6a7595, 0x6a7595, 1, true)
- end
- function eventLoop()
- if time_spawn < os.time()-3000 and #npcs < 20 then
- local monster = tfm.exec.addShamanObject(6300,math.random(10,3000),math.random(20,360))
- local imagem = zombies[math.random(#zombies)]
- local image = tfm.exec.addImage(imagem[math.random(1,2)], "#"..monster, -imagem[4], -imagem[5])
- local vida = math.random(10,imagem[7])
- table.insert(npcs,{id=monster,maxLife=vida,life=vida,damage=math.random(1,imagem[8]),img=image,textareaHeight=imagem[3],name=imagem[6],type = imagem,coins=math.random(1,imagem[9])})
- time_spawn = os.time();
- end
- for i,v in pairs(npcs) do
- for n,pi in pairs(tfm.get.room.playerList) do
- if pi.x >= tfm.get.room.objectList[v.id].x - 12 and pi.x <= tfm.get.room.objectList[v.id].x + 12 and pi.y >= tfm.get.room.objectList[v.id].y - 25 and pi.y <= tfm.get.room.objectList[v.id].y + 25 and not tfm.get.room.playerList[n].isDead then
- p[n].life = p[n].life-v.damage
- lifeBar(n)
- if p[n].life < 1 then
- p[n].life = 0
- tfm.exec.killPlayer(n)
- end
- end
- if pi.x >= tfm.get.room.objectList[v.id].x - 180 and pi.x <= tfm.get.room.objectList[v.id].x + 180 and pi.y >= tfm.get.room.objectList[v.id].y - 50 and pi.y <= tfm.get.room.objectList[v.id].y + 50 and not tfm.get.room.playerList[n].isDead then
- if pi.x > tfm.get.room.objectList[v.id].x then
- tfm.exec.moveObject(v.id,0,0,false,10,0,true)
- tfm.exec.removeImage(v.img)
- tfm.exec.addImage(v.type[2], '#'..v.id, -v.type[4], -v.type[5])
- elseif pi.x < tfm.get.room.objectList[v.id].x then
- tfm.exec.moveObject(v.id,0,0,false,-10,0,true)
- tfm.exec.removeImage(v.img)
- tfm.exec.addImage(v.type[1], '#'..v.id, -v.type[4], -v.type[5])
- end
- if pi.x < tfm.get.room.objectList[v.id].y then
- tfm.exec.moveObject(v.id,0,0,false,0,-15,true)
- end
- pular = math.random(0,5)
- if pular == 2 then
- tfm.exec.moveObject(v.id,0,0,false,0,-30,true)
- end
- ui.addTextArea(v.id,"<V>"..v.name.."<br><VI><font color='#FF0000'>♥ </font>"..v.life.."/"..v.maxLife.."</CR>",n,tfm.get.room.objectList[v.id].x-30,tfm.get.room.objectList[v.id].y-v.textareaHeight,50,nil,nil,0,70,false)
- else
- ui.removeTextArea(v.id,n)
- end
- end
- end
- end
- function key_def(key)
- returno = false
- for i,v in pairs(keys) do
- if key == v then
- retorno = true
- end
- end
- if key == 32 or key == 37 or key == 39 then
- retorno = false
- end
- return retorno
- end
- function key_number(key)
- keys_num = {}
- keys_num[48] = 0
- keys_num[49] = 1
- keys_num[50] = 2
- keys_num[51] = 3
- keys_num[52] = 4
- keys_num[53] = 5
- keys_num[54] = 6
- keys_num[55] = 7
- keys_num[56] = 8
- keys_num[57] = 9
- return keys_num[key]
- end
- function key_x(key)
- keys_x = {}
- keys_x[0] = 609
- keys_x[1] = 152
- keys_x[2] = 203
- keys_x[3] = 254
- keys_x[4] = 305
- keys_x[5] = 355
- keys_x[6] = 406
- keys_x[7] = 457
- keys_x[8] = 508
- keys_x[9] = 558
- return keys_x[key]
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement