Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Error at getRegDate()
- Box={type=12, width=2000, height=10, foreground=true, friction=0.3, restitution=0.2, angle=0, color="0x6a7495", miceCollision=true, groundCollision=false}
- Admins={}
- Mods={}
- data={}
- EN={[1]="Choose two objects, which you will use.",
- [2]="Little box</font> and <font color='#BABD2F'>Large plank",
- [3]="Big box</font> and <font color='#BABD2F'>Little plank",
- [4]="Choose an object, which you want to buy. <b><font color='#CB546B'><a href='event:closeStore'>X</b></a></font><br>You have: ",
- [5]="Ball",
- [6]="Little box",
- [7]="Big box",
- [8]="Large plank",
- [9]="Little plank",
- [10]="Choose an object",
- [11]="Registration date: ",
- [12]="Wins: ",
- [13]="Loses: ",
- [14]="Rounds played: ",
- [15]="Transforms: ",
- [16]="Unlocked titles:",
- [17]="Full list",
- [18]="Awards:",
- [19]="Current object:",
- [20]="Close",
- [21]="Help",
- [22]="Store",
- [23]="<font size='12'>Choose an object",
- [24]="Do you want to buy a",
- [25]="Ball",
- [26]="Little box",
- [27]="Big box",
- [28]="Big plank",
- [29]="Little plank",
- [30]="Anvil",
- [31]="Cannon ball",
- [32]="Apple",
- [33]="Ice cube",
- [34]="You do not have enough money to buy this object",
- [35]="Skill: ",
- [36]="for",
- [37]="coins?"--do you want to buy a ball for 100 coins?
- }
- RU={
- [1]="Выберите два объекта, которые Вы будете использовать.",
- [2]="Маленький ящик</font> и <font color='#BABD2F'>Большая палка",
- [3]="Большой ящик</font> и <font color='#BABD2F'>Маленькая палка",
- [4]="Выберите объект, который хотите купить. <b><font color='#CB546B'><a href='event:closeStore'>X</b></a></font><br>У вас ",
- [5]="Мяч",
- [6]="Мал. ящик",
- [7]="Бол. ящик",
- [8]="Бол. палка",
- [9]="Мал. палка",
- [10]="Выберите объект.",
- [11]="Дата регистрации: ",
- [12]="Побед: ",
- [13]="Проигрышей: ",
- [14]="Раундов сыграно: ",
- [15]="Превращений: ",
- [16]="Открытые титулы:",
- [17]="Полный список",
- [18]="Награды:",
- [19]="Текущий объект:",
- [20]="Закрыть",
- [21]="Помощь",
- [22]="Магазин",
- [23]="<font size='13'>Выбор объекта",
- [24]="Купить объект",
- [25]="Мячик",
- [26]="Маленький ящик",
- [27]="Большой ящик",
- [28]="Большая палка",
- [29]="Маленькая палка",
- [30]="Наковальня",
- [31]="Ядро",
- [32]="Яблоко",
- [33]="Куб льда",
- [34]="У вас недостаточно монет",
- [35]="Навык: ",
- [36]="за",--------v
- [37]="монет?"--Купить объект мячик за 100 монет?
- }
- lng={}
- Obj={}
- obj={}
- x={}
- y={}
- checkCoords={}
- wait={}
- titles={[1]="Little mouse", [2]="Newbie", [3]="Fifty cent", [4]="Helpful mouse", [5]="Keeper of cheese", [6]="Hard worker", [7]="Cheese hunter", [8]="Proud"}
- tfm.exec.disableAutoShaman(true)
- table.IndexOf=function(t, value)
- for i, v in ipairs(t) do
- if v==value then
- return i
- end
- end
- return false
- end
- function table.contains(t,element)
- if element==nil then
- return false
- end
- for key,value in pairs(t) do
- if value==element then
- return true
- end
- end
- return false
- end
- function isStaff(playerName, tbl)
- if table.contains(tbl, playerName)==true then
- return true
- else
- return false
- end
- end
- --395 -185
- --function u(a,b,c,d,e,f,g,h,i,j,k)
- --ui.addTextArea(a, b, c, d, e, f, g, h, i, j, k)
- --end
- --[[titles:
- Colourful mouse - customize an object
- icemouse - buy a frozen mouse
- Cutie - buy a ball
- if data[playerName].wins>=10 and table.contains(data[playerName].titles, "2")==false then
- giveTitle(playerName, 2)
- end
- if data[playerName].wins>=50 and table.contains(data[playerName].titles, "3")==false then
- giveTitle(playerName, 3)
- end
- if data[playerName].wins>=100 and table.contains(data[playerName].titles, "4")==false then
- giveTitle(playerName, 4)
- end
- if data[playerName].wins>=150 and table.contains(data[playerName].titles, "5")==false then
- giveTitle(playerName, 5)
- end
- if data[playerName].wins>=200 and table.contains(data[playerName].titles, "6")==false then
- giveTitle(playerName, 6)
- end
- if data[playerName].wins>=250 and table.contains(data[playerName].titles, "7")==false then
- giveTitle(playerName, 7)
- end
- if data[playerName].wins>=300 and table.contains(data[playerName].titles, "8")==false then
- giveTitle(playerName, 8)
- end
- Proud - 300 wins
- Cheese hunter - 250 wins
- Hard worker - 200 wins
- Keeper of cheese - 150 wins
- Helpful Mouse - 100 wins
- Fifty cent - 50 wins
- Newbie - 10 wins
- Little mouse - new player
- Unlucky mouse - 100 deaths(loses)
- Reckless mouse - 250 deaths(loses)
- Hopeless - 400 deaths(loses)
- Mouse ghost - 600 deaths(loses)
- ]]
- function updateMap()
- tfm.exec.addPhysicObject(1, 396, -166, Box)
- tfm.exec.addPhysicObject(2, 396, -210, Box)
- Box.angle=90
- Box.width=30
- tfm.exec.addPhysicObject(3, 0, -185, Box)
- if mBorder2~=nil then
- tfm.exec.addPhysicObject(4, mBorder2, -186, Box)
- else
- tfm.exec.addPhysicObject(4, 1000, -186, Box)
- end
- Box.angle=0
- Box.width=3000
- Box.height=150
- Box.miceCollision=false
- tfm.exec.addPhysicObject(5, 420, -229, Box)
- Box.miceCollision=true
- Box.width=3000
- Box.height=10
- tfm.exec.setUIMapName("#<R>Transform<J>ice!<N>")
- end
- function buyObj(playerName)
- if data[playerName].obj[1]==nil then
- ui.addTextArea(31,"<p align='center'><font size='14'>"..lng[playerName][1].."</font></p>",playerName,205,101,400,150,0x6a7495,0x000000,1,true)
- ui.addTextArea(32,"<p align='center'><a href='event:sbox+plank'> <font size='15'><font color='#BABD2F'>"..lng[playerName][2].."</font></font></a></p>",playerName,255,151,300,25,0x000033,0x000000,0.3,true)
- ui.addTextArea(33,"<p align='center'><a href='event:bbox+plank'> <font size='15'><font color='#BABD2F'>"..lng[playerName][3].."</font></font></a></p>",playerName,255,201,300,25,0x000033,0x000000,0.3,true)
- end
- if data[playerName].obj[1]~=nil then
- ui.addTextArea(1,"<p align='center'><font size='15'> "..lng[playerName][4].."<font color='#BABD2F'>"..data[playerName].money.."</font> монет</font></p>",playerName,205,101,400,200,0x6a7495,0x000000,1,true)
- if table.contains(data[playerName].obj, "6")~=true then
- ui.addTextArea(2,"<p align='center'><a href='event:ball'> <font size='15'>"..lng[playerName][5].."</font></a></p>",playerName,215,151,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "1")~=true then
- ui.addTextArea(3,"<p align='center'><a href='event:small box'> <font size='15'>"..lng[playerName][6].."</font></a></p>",playerName,355,151,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "2")~=true then
- ui.addTextArea(4,"<p align='center'><a href='event:big box'> <font size='15'>"..lng[playerName][7].."</font></a></p>",playerName,495,151,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "4")~=true then
- ui.addTextArea(5,"<p align='center'><a href='event:big plank'> <font size='15'>"..lng[playerName][8].."</font></a></p>",playerName,215,201,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "3")~=true then
- ui.addTextArea(6,"<p align='center'><a href='event:small plank'> <font size='15'>"..lng[playerName][9].."</font></a></p>",playerName,355,201,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "10")~=true then
- ui.addTextArea(7,"<p align='center'><a href='event:anvil'> <font size='14'>"..lng[playerName][30].."</font></a></p>",playerName,495,201,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "17")~=true then
- ui.addTextArea(8,"<p align='center'><a href='event:cannon ball'> <font size='15'>"..lng[playerName][31].."</font></a></p>",playerName,215,251,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "39")~=true then
- ui.addTextArea(9,"<p align='center'><a href='event:apple'> <font size='15'>"..lng[playerName][32].."</font></a></p>",playerName,355,251,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "54")~=true then
- ui.addTextArea(10,"<p align='center'><a href='event:icemice'> <font size='15'>"..lng[playerName][33].."</font></a></p>",playerName,495,251,100,25,0x000033,0x000000,0.3,true)
- end
- end
- end
- function inventory(playerName)
- ui.addTextArea(1,"<p align='center'><font size='15'>"..lng[playerName][10].."</p></font>",playerName,205,101,400,200,0x6a7495,0x000000,1,true)--14
- ui.addTextArea(34,"<p align='center'><font size='15'><b><font color='#CB546B'><a href='event:closeStore'>X</a></b></font></font></p>",playerName,585,101,20,20,0,0,1,true)
- if table.contains(data[playerName].obj, "1")==true then
- ui.addTextArea(3,"<p align='center'><a href='event:small box'> <font size='15'>"..lng[playerName][6].."</font></a></p>",playerName,355,151,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "2")==true then
- ui.addTextArea(4,"<p align='center'><a href='event:big box'> <font size='15'>"..lng[playerName][7].."</font></a></p>",playerName,495,151,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "3")==true then
- ui.addTextArea(6,"<p align='center'><a href='event:small plank'> <font size='15'>"..lng[playerName][9].."</font></a></p>",playerName,355,201,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "4")==true then
- ui.addTextArea(5,"<p align='center'><a href='event:big plank'> <font size='15'>"..lng[playerName][8].."</font></a></p>",playerName,215,201,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "6")==true then
- ui.addTextArea(2,"<p align='center'><a href='event:ball'> <font size='15'>"..lng[playerName][5].."</font></a></p>",playerName,215,151,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "10")==true then
- ui.addTextArea(7,"<p align='center'><a href='event:anvil'> <font size='14'>"..lng[playerName][30].."</font></a></p>",playerName,495,201,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "17")==true then
- ui.addTextArea(8,"<p align='center'><a href='event:cannon ball'> <font size='15'>"..lng[playerName][31].."</font></a></p>",playerName,215,251,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "39")==true then
- ui.addTextArea(9,"<p align='center'><a href='event:apple'> <font size='15'>"..lng[playerName][32].."</font></a></p>",playerName,355,251,100,25,0x000033,0x000000,0.3,true)
- end
- if table.contains(data[playerName].obj, "54")==true then
- ui.addTextArea(10,"<p align='center'><a href='event:icemice'> <font size='15'>"..lng[playerName][33].."</font></a></p>",playerName,495,251,100,25,0x000033,0x000000,0.3,true)
- end
- end
- function isAdmin(playerName)
- a=0
- if table.contains(Mods, playerName)==true then
- a=1
- end
- if table.contains(Admins, playerName)==true then
- a=2
- end
- return a
- --[[
- if a==1 then playerName is mod
- if a==2 then playerName is admin
- ]]
- end
- function openProfile(playerName, s1, name)
- Obj[playerName].titles=playerName
- if Obj[playerName].id==3 or Obj[playerName].id==4 then
- Obj[playerName].sizeY=1
- s2=1
- else
- Obj[playerName].sizeY=Obj[playerName].size
- s2=s1
- end
- if Obj[playerName].size>=200 then
- Obj[playerName].size=140
- s1=Obj[playerName].size
- end
- s1=295-(s1/2)
- s2=325-(s2/2)
- ui.addTextArea(11, "", name, 200, 35, 400, 350, 0x324650, 0x324650, 1, true)
- ui.addTextArea(12, "<p align='center'><b><font face='soopafresh' size='24'>"..playerName.."</font></b></p>", name, 200, 35, 400, 30, 0x324650, 0x324650, 1, true)
- ui.addTextArea(13, "<p align='center'><b><font face='soopafresh' size='16'>"..data[playerName].cTitle.."</font></b></p>", name, 200, 70, 400, 25, 0x324650, 0x324650, 1, true)
- ui.addTextArea(14, "<p align='left'>"..lng[playerName][11].."<font size='9'><font color='#CB546B'>"..data[playerName].regDate.."</font></font><br><b>"..lng[playerName][12]..""..data[playerName].wins.."<br><br>"..lng[playerName][13]..""..data[playerName].loses.."<br><br>"..lng[playerName][14]..""..data[playerName].rounds.."<br><br>"..lng[playerName][15]..""..data[playerName].transforms.."<br><br>"..lng[playerName][35]..""..data[playerName].skill.."</b></p>", name, 200, 110, 220, 220, 0x324650, 0x324650, 1, true)--14 15 16 17 18 19
- --[[ui.addTextArea(14, "<p align='left'><b>Дата регистрации: <font size='9'>"..data[playerName].regDate.."</font></b></p>", name, 200, 110, 220, 20, 0x324650, 0x324650, 1, true)--15
- --ui.addTextArea(15, "<p align='left'><b>Побед: "..data[playerName].wins.."</b></p>", name, 200, 140, 200, 20, 0x324650, 0x324650, 1, true)--16
- --ui.addTextArea(16, "<p align='left'><b>Проигрышей: "..data[playerName].loses.."</b></p>", name, 200, 170, 200, 20, 0x324650, 0x324650, 1, true)--17
- --ui.addTextArea(17, "<p align='left'><b>Раундов сыграно: "..data[playerName].rounds.."</b></p>", name, 200, 200, 200, 20, 0x324650, 0x324650, 1, true)--18
- --ui.addTextArea(18, "<p align='left'><b>Превращений: "..data[playerName].transforms.."</b></p>", name, 200, 230, 200, 20, 0x324650, 0x324650, 1, true)--19]]
- ui.addTextArea(19, "<p align='center'><b>"..lng[playerName][16].."</p><p align='left'>"..getTitles(playerName, 7).."</p><p align='center'><font size='12'><a href='event:full list'>"..lng[playerName][17].."</font></a></p></b>", name, 410, 110, 190, 135, 0x324650, 0x324650, 1, true)--20 21
- ui.addTextArea(20, "<p align='center'><b><a href='event:all awards'>"..lng[playerName][18].."</a></b></p>", name, 400, 260, 200, 20, 0x324650, 0x324650, 1, true)--22
- ui.addTextArea(21, "<p align='center'><b>"..lng[playerName][19].."</b><br><font size='10' color='#A4CF9E'>"..Obj[playerName].name.."</font></p>", name, 200, 260, 190, 40, 0x324650, 0x324650, 1, true)--23
- ui.addTextArea(22, "", name, s1, s2, Obj[playerName].size, Obj[playerName].sizeY, 0xffffff, 0xffffff, 0.5, true)
- ui.addTextArea(23, "<p align='center'><b></b></p>", name, 400, 110, 1, 260, 0x405763, 0x405763, 1, true)
- ui.addTextArea(24, "<p align='center'><b></b></p>", name, 200, 255, 400, 1, 0x405763, 0x405763, 1, true)
- ui.addTextArea(25, "<p align='center'><b></b></p>", name, 200, 105, 400, 1, 0x405763, 0x405763, 1, true)
- ui.addTextArea(26, "<p align='center'><a href='event:closeProfile'><b>"..lng[playerName][20].."</b></a></p>", name, 200, 370, 400, 17, 0x324650, 0x405763, 1, true)--24
- --[[ui.addTextArea(35, "", name, 430, 280, 30, 30, 0xffffff, 0xffffff, 0.5, true)
- ui.addTextArea(36, "", name, 490, 280, 30, 30, 0xffffff, 0xffffff, 0.5, true)
- ui.addTextArea(37, "", name, 550, 280, 30, 30, 0xffffff, 0xffffff, 0.5, true)
- ui.addTextArea(38, "", name, 430, 325, 30, 30, 0xffffff, 0xffffff, 0.5, true)
- ui.addTextArea(39, "", name, 490, 325, 30, 30, 0xffffff, 0xffffff, 0.5, true)
- ui.addTextArea(40, "", name, 550, 325, 30, 30, 0xffffff, 0xffffff, 0.5, true)]]
- if playerName==name then
- ui.addTextArea(27, "", name, 25, 55, 150, 100, 0x324650, 0x324650, 1, true)
- ui.addTextArea(28, "<font size='13'><p align='center'><a href='event:help'><b><font color='#CB546B'>"..lng[playerName][21].."</font></a></font></p></b>", name, 35, 60, 130, 18, 0x324650, 0x405763, 1, true)--25
- ui.addTextArea(29, "<font size='13'><p align='center'><a href='event:store'><b>"..lng[playerName][22].."</a></font></p></b>", name, 35, 95, 130, 18, 0x324650, 0x405763, 1, true)--26
- ui.addTextArea(30, "<p align='center'><a href='event:inventory'><b>"..lng[playerName][23].."</a></font></p></b>", name, 35, 131, 130, 18, 0x324650, 0x405763, 1, true)--27
- end
- end
- function giveTitle(playerName, numb)
- table.insert(data[playerName].titles, tostring(numb))
- end
- function showTitles(playerName, name)
- ui.addPopup(10, 0, "<p align='center'>"..lng[playerName][16].."</p><p align='left'><font color='#6C77C1'>"..getTitles(playerName).."</font></p>", name, 300, 100, 200, true)--21
- end
- function showAwards(playerName, name, count)
- if count<=3 then
- ySz=60
- elseif count<=6 and count>3 then
- ySz=110
- elseif count>6 and count<=9 then
- ySz=160
- end
- ui.addTextArea(35, "", name, 300, 100, 200, ySz, 0x324650, 0x324650, 1, true)
- xtext=275
- ytext=115
- n=0
- while n<count do
- xtext=xtext+55
- if n==3 or n==6 or n==9 then
- xtext=330
- ytext=ytext+50
- end
- n=n+1
- --tfm.exec.addImage("imageName.png", "!n", xtext, ytext, name)
- ui.addTextArea(35+n, "", name, xtext, ytext, 30, 30, 0xffffff, 0xffffff, 1, true)
- end
- end
- function setObj(playerName, id, size)
- Obj[playerName].id=id
- Obj[playerName].size=size
- closeObj(playerName)
- end
- function getSkill(wins, loses, rounds)
- sk={}
- --print(48/2 + 48/50 - 0,04/10*100 + 50/100)
- LW=loses/wins
- --print(LW)
- if wins>1 and loses and rounds>=1 then
- Skill = (wins/loses + wins/rounds - LW/10) * 100 + rounds/100
- else
- Skill=0
- end
- for argument in string.gmatch(tostring(Skill), "[^%p]+") do
- table.insert(sk,argument)
- end
- Skill=tonumber(sk[1], 10)
- if Skill<=0 then
- Skill=0
- end
- return Skill
- end
- function getTitles(playerName, count)
- if count==nil then
- count=99999
- end
- n=0
- str={}
- for k, v in pairs(titles) do
- n=n+1
- if table.contains(data[playerName].titles, tostring(k))~=false then
- if n<=count then
- table.insert(str, "• "..v.."<br>")
- --print(str)
- end
- end
- end
- return table.concat(str)
- end
- function closeObj(playerName)
- if Obj[playerName].size==140 and Obj[playerName].id==4 then
- Obj[playerName].size=200
- end
- for i,id in ipairs({1,2,3,4,5,6,7,8,9,10,31,32,33,34}) do
- ui.removeTextArea(id, playerName)
- end
- end
- function closeProfile(playerName)
- Obj[playerName].sizeY=nil
- for i,id in ipairs({11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}) do
- ui.removeTextArea(id, playerName)
- end
- end
- function transform(playerName, x, y)
- tfm.exec.movePlayer(playerName, x, -185)
- obj[playerName]=tfm.exec.addShamanObject(Obj[playerName].id, x, y, 0, 0, 0, false)
- checkCoords[playerName]=true
- data[playerName].transforms=data[playerName].transforms+1
- end
- function getRegDate()
- --[[function getMonth()
- for i, k in pairs(months) do
- month=string.match(date, i)
- if month~=nil then
- month=k
- return month
- end
- end
- end
- months={["Jan"]="01",["Feb"]="02",["Mar"]="03",["Apr"]="04",["May"]="05",["Jun"]="06",["Jul"]="07",["Aug"]="08",["Sep"]="09",["Oct"]="10",["Nov"]="11",["Dec"]="12"}
- date=os.date("!*t")
- day=string.sub(date, string.find(date, "([%d]+)"))
- month1=getMonth()
- year=string.match(date, "%d%d%d%d")
- newDate=day.."/"..month1.."/"..year]]
- newDate="Err#"
- return newDate
- end
- function eventPlayerWon(playerName, timeElapsed, timeElapsedSinceRespawn)
- data[playerName].won=true
- data[playerName].wins=data[playerName].wins+1
- data[playerName].money=data[playerName].money+1
- if data[playerName].wins>=10 and table.contains(data[playerName].titles, "2")==false then
- giveTitle(playerName, 2)
- elseif data[playerName].wins>=50 and table.contains(data[playerName].titles, "3")==false then
- giveTitle(playerName, 3)
- elseif data[playerName].wins>=100 and table.contains(data[playerName].titles, "4")==false then
- giveTitle(playerName, 4)
- elseif data[playerName].wins>=150 and table.contains(data[playerName].titles, "5")==false then
- giveTitle(playerName, 5)
- elseif data[playerName].wins>=200 and table.contains(data[playerName].titles, "6")==false then
- giveTitle(playerName, 6)
- elseif data[playerName].wins>=250 and table.contains(data[playerName].titles, "7")==false then
- giveTitle(playerName, 7)
- elseif data[playerName].wins>=300 and table.contains(data[playerName].titles, "8")==false then
- giveTitle(playerName, 8)
- end
- end
- function eventPlayerDied(playerName)
- data[playerName].loses=data[playerName].loses+1
- data[playerName].won=true
- end
- function eventTextAreaCallback(id,name,callback)--1 2 3 4 6 10 17 39 54
- if callback=="sbox+plank" then
- Obj[name].id=1
- table.insert(data[name].obj, "1")
- Obj[name].id=4
- table.insert(data[name].obj, "4")
- Obj[name].size=200
- Obj[name].name=lng[name][28]--34
- closeObj(name)
- end
- if callback=="bbox+plank" then
- Obj[name].id=2
- table.insert(data[name].obj, "2")
- Obj[name].id=3
- table.insert(data[name].obj, "3")
- Obj[name].size=100
- Obj[name].name=lng[name][29]--35
- closeObj(name)
- end
- if callback=="ball" then
- if table.contains(data[name].obj, "6")~=true then
- ui.addPopup(1, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][25].."\"</font> "..lng[name][36].." 100 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 31
- else
- setObj(name, 6, 30)
- Obj[name].name=lng[name][25]--31
- end
- end
- if callback=="small box" then
- print(table.concat(data[name].obj))
- if table.contains(data[name].obj, "1")~=true then
- ui.addPopup(2, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][26].."\"</font> "..lng[name][36].." 50 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 32
- else
- setObj(name, 1, 30)
- Obj[name].name=lng[name][26]--32
- end
- end
- if callback=="big box" then
- if table.contains(data[name].obj, "2")~=true then
- ui.addPopup(3, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][27].."\"</font> "..lng[name][36].." 60 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 33
- else
- setObj(name, 2, 60)
- Obj[name].name=lng[name][27]--33
- end
- end
- if callback=="big plank" then
- if table.contains(data[name].obj, "4")~=true then
- ui.addPopup(4, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][28].."\"</font> "..lng[name][36].." 70 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 34
- else
- setObj(name, 4, 200)
- Obj[name].name=lng[name][28]--34
- end
- end
- if callback=="small plank" then
- if table.contains(data[name].obj, "3")~=true then
- ui.addPopup(5, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][29].."\"</font> "..lng[name][36].." 50 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 35
- else
- setObj(name, 3, 100)
- Obj[name].name=lng[name][29]--35
- end
- end
- if callback=="anvil" then
- if table.contains(data[name].obj, "10")~=true then
- ui.addPopup(6, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][30].."\"</font> "..lng[name][36].." 50 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 36
- else
- setObj(name, 10, 30)
- Obj[name].name=lng[name][30]--36
- end
- end
- if callback=="cannon ball" then
- if table.contains(data[name].obj, "17")~=true then
- ui.addPopup(7, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][31].."\"</font> "..lng[name][36].." 60 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 37
- else
- setObj(name, 17, 30)
- Obj[name].name=lng[name][31]--37
- end
- end
- if callback=="apple" then
- if table.contains(data[name].obj, "39")~=true then
- ui.addPopup(8, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][32].."\"</font> "..lng[name][36].." 150 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 38
- else
- setObj(name, 39, 30)
- Obj[name].name=lng[name][32]--38
- end
- end
- if callback=="icemice" then
- if table.contains(data[name].obj, "54")~=true then
- ui.addPopup(9, 1, "<p align='center'><b>"..lng[name][24].." <font color='#BABD2F'>\""..lng[name][33].."\"</font> "..lng[name][36].." 80 "..lng[name][37].."</b></p<", name, 300, 150, 200, true)--28 39
- else
- setObj(name, 54, 60)
- Obj[name].name=lng[name][33]--39
- end
- end
- if callback=="closeProfile" then
- closeProfile(name)
- Obj[name].profile=false
- end
- if callback=="inventory" then
- inventory(name)
- closeProfile(name)
- end
- if callback=="store" then
- buyObj(name)
- closeProfile(name)
- elseif callback=="closeStore" then
- closeObj(name)
- end
- if callback=="full list" then
- showTitles(Obj[name].titles, name)
- end
- if callback=="all awards" then
- end
- end
- function eventPopupAnswer(id, playerName, answer)
- if id==1 and answer=="yes" then
- if data[playerName].money>=100 then
- table.insert(data[playerName].obj, "6")
- data[playerName].money=data[playerName].money-100
- setObj(playerName, 6, 30)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][25]--31
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==2 and answer=="yes" then
- if data[playerName].money>=50 then
- table.insert(data[playerName].obj, "1")
- data[playerName].money=data[playerName].money-50
- setObj(playerName, 1, 30)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][26]--32
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==3 and answer=="yes" then
- if data[playerName].money>=50 then
- table.insert(data[playerName].obj, "2")
- data[playerName].money=data[playerName].money-50
- setObj(playerName, 2, 60)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][27]--33
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==4 and answer=="yes" then
- if data[playerName].money>=70 then
- table.insert(data[playerName].obj, "4")
- data[playerName].money=data[playerName].money-70
- setObj(playerName, 4, 200)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][28]--34
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==5 and answer=="yes" then
- if data[playerName].money>=50 then
- table.insert(data[playerName].obj, "3")
- data[playerName].money=data[playerName].money-50
- setObj(playerName, 3, 100)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][29]--35
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==6 and answer=="yes" then
- if data[playerName].money>=50 then
- table.insert(data[playerName].obj, "10")
- data[playerName].money=data[playerName].money-50
- setObj(playerName, 10, 30)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][30]--36
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==7 and answer=="yes" then
- if data[playerName].money>=60 then
- table.insert(data[playerName].obj, "17")
- data[playerName].money=data[playerName].money-60
- setObj(playerName, 17, 30)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][31]--37
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==8 and answer=="yes" then
- if data[playerName].money>=150 then
- table.insert(data[playerName].obj, "39")
- data[playerName].money=data[playerName].money-150
- setObj(playerName, 39, 30)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][32]--38
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- if id==9 and answer=="yes" then
- if data[playerName].money>=80 then
- table.insert(data[playerName].obj, "54")
- data[playerName].money=data[playerName].money-80
- setObj(playerName, 54, 60)
- buyObj(playerName)
- Obj[playerName].name=lng[playerName][33]--39
- else
- ui.addPopup(1, 0, "<p align='center'><font color='#CB546B'>"..lng[playerName][34].."</font></p>", playerName, 300, 150, 200, true)--40
- end
- end
- --ui.addPopup(1, 1, "<p align='center'><b></b></p<", playerName, x, y, 200, false)
- end
- function eventKeyboard(playerName, keyCode, down, xPosition, yPosition)
- if keyCode==32 and xPosition~=0 and yPosition~=0 and Obj[playerName].id~=nil and checkCoords[playerName]~=true and os.time() - wait[playerName] >= 1000 and tfm.get.room.playerList[playerName].isDead==false then
- if xPosition>mBorder1 and xPosition<mBorder2+10 then
- transform(playerName, xPosition, yPosition)
- wait[playerName]=os.time()
- end
- elseif keyCode==32 and xPosition~=0 and yPosition~=0 and checkCoords[playerName]==true and os.time() - wait[playerName] >= 1000 then
- x[playerName] = tfm.get.room.objectList[obj[playerName]].x
- y[playerName] = tfm.get.room.objectList[obj[playerName]].y
- tfm.exec.removeObject(obj[playerName])
- tfm.exec.movePlayer(playerName, x[playerName], y[playerName])
- x[playerName]=nil
- y[playerName]=nil
- checkCoords[playerName]=nil
- obj[playerName]=nil
- wait[playerName]=os.time()
- end
- if keyCode==80 and Obj[playerName].size~=nil then
- Obj[playerName].sizeY=nil
- openProfile(playerName, Obj[playerName].size, playerName)
- end
- end
- function eventChatCommand(playerName, msg)
- local args={}
- for argument in msg:gmatch("[^%s]+") do
- table.insert(args,argument)
- end
- if args[1]=="profile" and args[2]~=nil and data[args[2]]~=nil and args[3]==nil then
- openProfile(args[2], Obj[args[2]].size, playerName)
- end
- if args[1]=="title" and args[2]==nil then
- for k, v in pairs(data[playerName].titles) do
- print("!title "..v.." -> "..titles[tonumber(v,10)])
- end
- elseif args[1]=="title" and args[2]~=nil then
- if table.contains(data[playerName].titles, args[2])~=false then
- data[playerName].cTitle=titles[tonumber(args[2], 10)]
- end
- end
- if args[1]=="lng" and args[2]=="en" then
- lng[playerName]=EN
- elseif args[2]=="ru" then
- lng[playerName]=RU
- end
- if isAdmin(playerName)~=0 then
- elseif args[1]=="b" and args[2]~=nil and args[3]~=nil and data[args[2]]~=nil then
- data[args[2]].isBanned=args[3].." "..getRegDate()
- print("<ROSE>"..args[2].." забанен "..getRegDate().." причина: "..args[3])--50
- end
- end
- function eventNewPlayer(playerName)
- updateMap()
- if data[playerName]==nil then
- data[playerName]={}
- data[playerName].regDate=getRegDate()
- data[playerName].name=playerName
- data[playerName].wins=0
- data[playerName].loses=0
- data[playerName].rounds=0
- data[playerName].transforms=0
- data[playerName].money=874
- data[playerName].skill=getSkill(data[playerName].wins, data[playerName].loses, data[playerName].rounds)
- data[playerName].isBanned=0
- data[playerName].titles={"1"}
- data[playerName].cTitle=titles[1]
- data[playerName].awards=nil
- data[playerName].obj={}
- lng[playerName]=EN
- print(data[playerName].skill)
- print("Skill: "..getSkill(data[playerName].wins, data[playerName].loses, data[playerName].rounds))
- Obj[playerName]={}
- buyObj(playerName)
- end
- -------------------------------------------------
- data[playerName].won=true
- tfm.exec.bindKeyboard(playerName, 32, true, true)
- tfm.exec.bindKeyboard(playerName, 80, true, true)
- wait[playerName]=os.time()
- end
- function getBorders()
- mBorder1=0
- if tfm.get.room.xmlMapInfo.xml then
- --print("ok")
- if string.find(tfm.get.room.xmlMapInfo.xml, "<S>") and string.match(tfm.get.room.xmlMapInfo.xml:sub(0,string.find(tfm.get.room.xmlMapInfo.xml, "<S>")), "L=\"%d+\"") then
- mBorder2=string.match(tfm.get.room.xmlMapInfo.xml:sub(0,string.find(tfm.get.room.xmlMapInfo.xml, "<S>")), "L=\"%d+\"")
- --print(mBorder2)
- mBorder2=string.match(mBorder2, "%d+")
- mBorder2=tonumber(mBorder2, 10)
- if mBorder2<=800 then
- mBorder2=805
- end
- else
- mBorder2=805
- end
- end
- if tfm.get.room.xmlMapInfo.xml==nil then
- mBorder2=805
- end
- tfm.get.room.xmlMapInfo.xml=nil
- return mBorder2
- end
- function eventNewGame()
- if tfm.get.room.xmlMapInfo then
- getBorders()
- end
- for name, p in pairs(tfm.get.room.playerList) do
- data[name].skill=getSkill(data[name].wins, data[name].loses, data[name].rounds)
- data[name].rounds=data[name].rounds+1
- if data[name].won==true then
- data[name].won=false
- else
- data[name].loses=data[name].loses+1
- end
- wait[name]=os.time()+3000
- x[name]=nil
- y[name]=nil
- checkCoords[name]=nil
- obj[name]=nil
- end
- updateMap()
- end
- function eventLoop(tLeft, tRem)
- for name, p in pairs(tfm.get.room.playerList) do
- if obj[name]~=nil and tfm.get.room.objectList[obj[name]].y~=nil and tfm.get.room.objectList[obj[name]].x~=nil and tfm.get.room.playerList[name].isDead==false then
- --print(tfm.get.room.objectList[obj[name]].y)
- if obj[name]~=nil then
- if tfm.get.room.objectList[obj[name]].y>=405 then
- tfm.exec.killPlayer(name)
- tfm.get.room.objectList[obj[name]].y=nil
- tfm.get.room.objectList[obj[name]].x=nil
- tfm.exec.removeObject(obj[name])
- x[name]=nil
- y[name]=nil
- checkCoords[name]=nil
- obj[name]=nil
- wait[name]=os.time()
- end
- end
- if obj[name]~=nil then
- if tfm.get.room.objectList[obj[name]].x<mBorder1 then
- tfm.exec.movePlayer(name, 5, tfm.get.room.objectList[obj[name]].y)
- tfm.get.room.objectList[obj[name]].y=nil
- tfm.get.room.objectList[obj[name]].x=nil
- tfm.exec.removeObject(obj[name])
- x[name]=nil
- y[name]=nil
- checkCoords[name]=nil
- obj[name]=nil
- wait[name]=os.time()
- end
- end
- if obj[name]~=nil then
- if tfm.get.room.objectList[obj[name]].x>mBorder2 then
- tfm.exec.movePlayer(name, mBorder2-5, tfm.get.room.objectList[obj[name]].y)
- tfm.get.room.objectList[obj[name]].y=nil
- tfm.get.room.objectList[obj[name]].x=nil
- tfm.exec.removeObject(obj[name])
- x[name]=nil
- y[name]=nil
- checkCoords[name]=nil
- obj[name]=nil
- wait[name]=os.time()
- end
- end
- end
- if data[name].isBanned~=0 then
- tfm.exec.killPlayer(name)
- end
- end
- end
- for name, p in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- system.disableChatCommandDisplay("profile", true)
- system.disableChatCommandDisplay("title", true)
- tfm.exec.newGame()
- --showAwards(nil, "Bushmeister", 3)
- --print(isAdmin("Bushmeister"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement