Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --21 en adelanet equip blanco
- local map = {'<C><P defilante="0,0,0,1" F="4" L="2500" /><Z><S><S L="144" H="157" X="323" Y="269" T="8" P="0,0,0.3,0.2,0,0,0,0" /><S lua="1" H="10" L="400" o="7895a4" X="540" c="2" Y="225" T="12" P="0,0,0.3,0.2,40,0,0,0" /><S L="306" X="543" H="53" Y="388" T="9" P="0,0,,,,0,0,0" /><S lua="2" P="0,0,0.3,0.2,0,0,0,0" L="109" o="48606c" H="94" Y="122" T="12" X="341" /><S lua="3" L="109" o="3e535e" H="94" X="341" Y="213" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="4" P="0,0,0.3,0.2,0,0,0,0" L="109" o="48606c" X="341" Y="287" T="12" H="55" /><S lua="5" H="45" L="28" o="2a383f" X="341" c="2" Y="54" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="6" P="0,0,0.3,0.2,0,0,0,0" L="28" o="2a383f" H="45" c="2" Y="54" T="12" X="382" /><S lua="7" L="141" o="3a4f59" X="324" H="40" Y="367" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="8" L="75" o="3e535e" X="217" H="94" Y="236" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="9" P="0,0,0.3,0.2,0,0,0,0" L="75" o="48606c" H="94" Y="329" T="12" X="216" /><S lua="10" P="0,0,0.3,0.2,0,0,0,0" L="109" o="3e535e" H="94" Y="328" T="12" X="125" /><S lua="11" L="109" o="48606c" H="94" X="125" Y="235" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="12" P="0,0,0.3,0.2,90,0,0,0" L="109" o="3e535e" H="40" Y="242" T="12" X="51" /><S lua="13" L="109" o="48606c" H="40" X="51" Y="348" T="12" P="0,0,0.3,0.2,90,0,0,0" /><S lua="14" P="0,0,0.3,0.2,180,0,0,0" L="109" o="48606c" X="124" Y="395" T="12" H="40" /><S lua="15" L="109" o="3e535e" X="231" H="40" Y="394" T="12" P="0,0,0.3,0.2,180,0,0,0" /><S lua="16" P="0,0,0.3,0.2,0,0,0,0" L="302" o="2a383f" H="17" Y="356" T="12" X="545" /><S lua="17" P="0,0,0.3,0.2,0,0,0,0" L="112" o="48606c" H="16" Y="395" T="12" X="338" /><S lua="18" P="0,0,0.3,0.2,0,0,0,0" L="28" o="2a383f" X="300" c="2" Y="54" T="12" H="45" /><S lua="19" H="45" L="28" o="2a383f" X="341" c="2" Y="54" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="20" H="45" L="28" o="2a383f" X="341" c="2" Y="54" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="141" H="147" X="2208" Y="269" T="8" P="0,0,0.3,0.2,0,0,0,0" /> <S lua="21" X="2233" L="28" o="2a383f" H="45" c="2" Y="54" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="22" P="0,0,0.3,0.2,-40,0,0,0" L="400" o="7895a4" X="1994" c="2" Y="230" T="12" H="10" /><S L="306" H="53" X="1988" Y="382" T="9" P="0,0,,,,0,0,0" /> <S lua="23" H="45" L="28" o="2a383f" X="2152" c="2" Y="52" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="24" L="109" o="48606c" H="94" X="2193" Y="122" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="25" P="0,0,0.3,0.2,0,0,0,0" L="109" o="3e535e" X="2193" Y="213" T="12" H="94" /> <S lua="26" L="109" o="48606c" X="2193" H="55" Y="287" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="27" P="0,0,0.3,0.2,0,0,0,0" L="141" o="3a4f59" H="40" Y="367" T="12" X="2207" /><S lua="28" L="302" o="2a383f" H="17" X="1986" Y="363" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="29" L="112" o="48606c" H="16" X="2193" Y="389" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="30" P="0,0,0.3,0.2,0,0,0,0" L="75" o="3e535e" H="94" Y="235" T="12" X="2315" /><S lua="31" P="0,0,0.3,0.2,0,0,0,0" L="109" o="48606c" X="2407" Y="235" T="12" H="94" /><S lua="32" L="109" o="3e535e" H="40" X="2481" Y="242" T="12" P="0,0,0.3,0.2,90,0,0,0" /><S lua="33" P="0,0,0.3,0.2,0,0,0,0" L="28" o="2a383f" X="2192" c="2" Y="52" T="12" H="45" /><S lua="34" P="0,0,0.3,0.2,90,0,0,0" L="109" o="48606c" X="2480" Y="348" T="12" H="40" /><S lua="35" L="109" o="3e535e" H="94" X="2407" Y="328" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S lua="36" L="109" o="48606c" X="2407" H="40" Y="394" T="12" P="0,0,0.3,0.2,180,0,0,0" /><S lua="37" P="0,0,0.3,0.2,180,0,0,0" L="109" o="3e535e" H="40" Y="394" T="12" X="2298" /><S lua="38" L="75" o="48606c" H="94" X="2315" Y="329" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="1000" H="52" X="1246" Y="374" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" H="39" X="1040" Y="284" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" X="1200" H="39" Y="208" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" H="39" X="1593" Y="207" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" X="1396" H="39" Y="274" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" X="1041" H="39" Y="133" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" X="1405" H="39" Y="143" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="138" H="39" X="870" Y="207" T="6" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="-79" X="1246" /><P P="1,0" Y="346" T="1" X="840" /><P P="0,0" Y="345" T="2" X="817" /><P P="0,0" Y="345" T="2" X="832" /><P P="0,0" Y="345" T="2" X="832" /><P P="0,0" Y="346" T="2" X="852" /><P P="0,0" Y="346" T="2" X="852" /><P P="0,0" Y="350" T="0" X="937" /><P P="0,0" Y="347" T="0" X="1046" /><P P="0,0" Y="348" T="0" X="1235" /><P X="1140" Y="348" T="0" P="0,0" /><P P="0,0" Y="348" T="0" X="1327" /><P X="1512" Y="349" T="0" P="0,0" /><P P="0,0" Y="349" T="0" X="1689" /><P P="0,0" Y="349" T="1" X="962" /><P P="0,0" Y="299" T="1" X="1137" /><P P="0,0" Y="256" T="1" X="932" /><P P="0,0" Y="256" T="1" X="889" /><P P="0,0" Y="254" T="1" X="1228" /><P P="0,0" Y="224" T="1" X="1005" /><P P="0,0" Y="275" T="1" X="1397" /><P P="0,0" Y="173" T="1" X="851" /><P P="0,0" Y="349" T="1" X="1567" /><P P="1,0" Y="349" T="1" X="1658" /><P P="0,0" Y="345" T="1" X="1462" /><P P="0,0" Y="348" T="1" X="1281" /><P P="1,0" Y="269" T="1" X="806" /><P P="0,0" Y="321" T="1" X="1042" /><P P="0,0" Y="345" T="1" X="1091" /><P P="0,0" Y="349" T="1" X="1146" /><P P="0,0" Y="341" T="1" X="1206" /><P P="0,0" Y="343" T="1" X="1324" /><P P="0,0" Y="343" T="1" X="1393" /><P P="1,0" Y="259" T="1" X="1091" /><P P="1,0" Y="241" T="1" X="1178" /><P P="0,0" Y="231" T="1" X="1326" /><P P="0,0" Y="238" T="1" X="1473" /><P P="0,0" Y="192" T="1" X="1536" /><P P="1,0" Y="272" T="1" X="1651" /><P P="1,0" Y="261" T="1" X="1555" /></D><O /></Z></C>'}
- local sp = {}
- local mice = {}
- local playerList = {}
- local teams = {{}, {}}
- function main()
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- tfm.exec.newGame(map[1])
- end
- function eventNewPlayer(name)
- if not mice[name] then
- mice[name] = {
- inTeam = false,
- shoots = 3,
- -- Name, range, id, damage
- weapon = {"Default", 200, 9, math.random(40,60)},
- health = 300
- }
- end
- system.bindMouse(name, true)
- table.insert(playerList, name)
- end
- function eventNewGame()
- teams = {{}, {}}
- playerList = {}
- for name,_ in pairs(tfm.get.room.playerList) do table.insert(playerList, name) end
- ui.addTextArea(100, "", nil, 1, 1, 1250, 30, 0x000001, 0x000001, 1, false)
- ui.addTextArea(101, "", nil, 1250, 1, 1250, 30, 0xFFFFFF, 0xFFFFFF, 1, false)
- local xml = tfm.get.room.xmlMapInfo.xml
- for sup in xml:gmatch('(<S [^<]-lua="%d+"[^>]-/>)') do
- xs = sup:match('X="(%d+)"')
- ys = sup:match('Y="(%d+)"')
- width = sup:match('L="(%d+)"')
- height = sup:match('H="(%d+)"')
- id = sup:match('lua="(%d+)"')
- table.insert(sp, {ids=id,x=xs,y=ys,w=width,h=height,v=100})
- end
- for i=1,38 do
- ui.addTextArea(i, sp[i].v.."%", nil, sp[i].x-15, sp[i].y-10, nil, nil, 0, 0, 0, false)
- end
- makeTeams()
- end
- function makeTeams()
- table.sort(playerList, function() return math.random() > 0.5 end)
- for i, name in ipairs(playerList) do
- if not mice[name].inTeam then
- table.insert(teams[i%#teams+1], name)
- mice[name].inTeam = true
- end
- end
- table.foreach(tfm.get.room.playerList,
- function(k,v)
- if table.find(teams[1], k) then
- tfm.exec.setNameColor(k, 0xFFFFFF)
- elseif table.find(teams[2], k) then
- tfm.exec.setNameColor(k, 0x000001)
- end
- end)
- end
- function table.find(tbl, element)
- for a,b in pairs(tbl) do
- if b == element then
- return true
- end
- end
- return false
- end
- function table.delete(tbl, element)
- for a,b in pairs(tbl)do
- if tbl[a] == element then
- table.remove(tbl, a)
- break
- end
- end
- end
- function eventMouse(name,x,y)
- px,pxi = tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].x - x
- py,pyi = tfm.get.room.playerList[name].y,tfm.get.room.playerList[name].y - y
- Rsq = mice[name].weapon[2]^2
- distance = pxi*pxi + pyi*pyi
- if distance < Rsq then
- --if mice[name].shoots > 0 then
- tfm.exec.displayParticle(mice[name].weapon[3],x,y,0,0,0,0,nil)
- mice[name].shoots = mice[name].shoots - 1
- for i=1,38 do
- x4 = sp[i].x+(sp[i].w/2)
- x5 = sp[i].x-(sp[i].w/2)
- y4 = sp[i].y+(sp[i].h/2)
- y5 = sp[i].y-(sp[i].h/2)
- if x < x4 and x > x5 then
- if y < y4 and y > y5 then
- sp[i].v = sp[i].v - 10
- ui.addTextArea(i, sp[i].v.."%", nil, sp[i].x-15, sp[i].y-10, nil, nil, 0, 0, 0, false)
- if sp[i].v < 1 then
- tfm.exec.removePhysicObject (sp[i].ids)
- ui.addTextArea(i, "0%", nil, sp[i].x-15, sp[i].y-10, nil, nil, 0, 0, 0, false)
- sp[i].v = 0
- end
- end
- end
- end
- --end
- end
- for mouse, player in pairs(tfm.get.room.playerList) do
- if pythag(x, y, player.x, player.y, 15) then
- if mouse ~= name then
- print('hey')
- tfm.exec.displayParticle(mice[name].weapon[3],x,y,0,0,0,0,nil)
- end
- end
- end
- end
- function pythag(x1,y1,x2,y2,r)
- local x=x2-x1
- local y=y2-y1
- local r=r+r
- return x*x+y*y<r*r
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement