Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- builder = "Wassimevicw"
- admin = ""
- data={}
- toDespawn={}
- function randomPlyers(k)
- ttt={}
- for n in pairs(tfm.get.room.playerList) do
- if n ~= k then
- table.insert(ttt,n)
- end
- end
- return ttt[math.random(#ttt)]
- end
- function newBuilder(nn)
- point_x=nil
- point_y=nil
- builder=nn
- builderTime=os.time()
- ui.setShamanName (builder)
- for n in pairs(tfm.get.room.playerList)do
- if n ~= builder and n ~= admin then
- tfm.exec.setNameColor(n,0xFFA700)
- end
- end
- tfm.exec.setNameColor(builder,0x008DFE)
- tfm.exec.setNameColor(admin,0x86FF00)
- end
- function refrechBuilder()
- ui.setShamanName (builder)
- for n in pairs(tfm.get.room.playerList)do
- if n ~= builder and n ~= admin then
- tfm.exec.setNameColor(n,0xFFA700)
- end
- end
- tfm.exec.setNameColor(builder,0x008DFE)
- tfm.exec.setNameColor(admin,0x86FF00)
- end
- newBuilder(builder)
- look = 0
- tableK={}
- p={}
- builderTime=os.time()
- --[[
- 0 = wood
- 1 = ice
- 2 = tramp
- 3 = lava
- 4 = choc
- ]]
- custom = false
- fric = 0.3 -- friction
- res = 0.2 -- restitution
- col = nil -- color
- hei = 10 -- height
- fric_stored = 0
- res_stored = 0
- col_stored = nil
- point_x=nil
- point_y=nil
- gNum = 0
- for n in pairs (tfm.get.room.playerList) do
- for _,v in pairs({32, 8, 49, 50, 51, 52, 53, 54,70,0,2}) do
- tfm.exec.bindKeyboard(n, v, true, true)
- end
- system.bindMouse(n, true)
- data[n]={time=0,pointR=1,pointL=1,timeS=0}
- p[n]={right=false, left=false}
- tfm.exec.setPlayerScore (n,0,false)
- end
- function eventNewPlayer(n)
- for _,v in pairs({32, 8, 49, 50, 51, 52, 53, 54,70,0,2}) do
- tfm.exec.bindKeyboard(n, v, true, true)
- end
- refrechBuilder()
- data[n]={time=0,pointR=1,pointL=1,timeS=0}
- p[n]={right=false, left=false}
- system.bindMouse(n, true)
- end
- tfm.exec.disableAutoScore(true)
- system.disableChatCommandDisplay("height", true)
- system.disableChatCommandDisplay("custom", true)
- function eventMouse(name, x, y)
- if name == builder then
- tfm.exec.displayParticle(9, x, y, 0, 0, 0, 0)
- if point_x == nil then
- point_x = x
- point_y = y
- else
- makeGround(x,y,length(point_x,point_y,x,y), angle(point_x, point_y,x,y))
- end
- elseif name == admin then
- tfm.exec.displayParticle(37,tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y,0,0,0,0)
- tfm.exec.movePlayer(name,x,y,false,0,0,false)
- tfm.exec.displayParticle(36,x,y,0,0,0,0)
- end
- end
- function eventNewGame()
- gNum = 0
- point_x=nil
- point_y=nil
- end
- function eventChatCommand(name, cmd)
- local args = {}
- for arg in cmd:gmatch("%S+") do
- table.insert(args, arg)
- end
- if args[1] == "custom" then
- ui.addPopup(1, 2, "Restitution:", name, 726, 20, 70)
- system.bindMouse(builder, false)
- point_x=nil
- point_y=nil
- col=nil
- look = 12
- elseif args[1] == "height" then
- if args[2] then
- hei = tonumber(args[2]) or 0
- end
- end
- if args[1] == "random" and name == admin then
- ui.addPopup(1, 0, "تم إزالة الشامان منك بسبب استخادمك للحبس", builder, 350, 170, 188,true)
- tfm.exec.killPlayer(builder)
- newBuilder(randomPlyers(builder))
- end
- if args[1] == "mod" and name == admin then
- admin = args[2]
- refrechBuilder()
- end
- end
- function eventPopupAnswer(id, name, answer)
- if id == 1 then
- res = tonumber(answer)
- ui.addPopup(2, 2, "Friction:", name, 726, 20, 70)
- elseif id == 2 then
- fric = tonumber(answer)
- ui.addPopup(3, 2, "Colour eg. FF0000 (if left blank it will be invisible):", name, 646, 20, 150)
- elseif id == 3 then
- if answer:len() > 5 then
- col = '0x'..answer
- end
- ui.addPopup(4, 1, "Would you like to add this to a hotkey (6)?", name, 551, 20, 245)
- elseif id == 4 then
- if answer == "yes" then
- fric_stored = fric
- res_stored = res
- col_stored = col
- custom = true
- end
- system.bindMouse(builder, true)
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if key==2 then
- p[name].right=true
- p[name].left=false
- elseif key==0 then
- p[name].right=false
- p[name].left=true
- end
- if key == 70 and data[name].time < os.time()-5000 and name ~= builder then
- if p[name].right then
- tfm.exec.displayParticle(26,x+20,y)
- tfm.exec.displayParticle(26,x+30,y)
- tfm.exec.displayParticle(26,x+40,y)
- tfm.exec.displayParticle(26,x+50,y)
- tfm.exec.movePlayer(name,0,0,true,150,0,false)
- else
- tfm.exec.displayParticle(26,x-20,y)
- tfm.exec.displayParticle(26,x-30,y)
- tfm.exec.displayParticle(26,x-40,y)
- tfm.exec.displayParticle(26,x-50,y)
- tfm.exec.movePlayer(name,0,0,true,-100,0,false)
- end
- data[name].time=os.time()
- end
- if key == 32 then
- if name == builder then
- for i=1,#tableK do
- tfm.exec.removePhysicObject(tableK.id)
- table.remove(tableK)
- end
- else
- RADIUS=50
- if ((tfm.get.room.playerList[builder].x >= x-(RADIUS/2) and tfm.get.room.playerList[builder].x <= x+(RADIUS/2)) and (tfm.get.room.playerList[builder].y >= y-(RADIUS/2) and tfm.get.room.playerList[builder].y <= y+(RADIUS/2))) and builderTime < os.time()-6000 then
- tfm.exec.killPlayer(builder)
- newBuilder(name)
- end
- end
- end
- if name == builder then
- if key == 8 then
- tfm.exec.removePhysicObject(gNum)
- gNum = gNum - 1
- elseif key == 49 then
- look = 0
- fric = 0.3
- res = 0.2
- col = nil
- elseif key == 50 then
- look = 1
- fric = 0
- res = 0.2
- col = nil
- elseif key == 51 then
- look = 2
- fric = 0
- res = 1.2
- col = nil
- elseif key == 52 then
- look = 3
- fric = 0
- res = 20
- col = nil
- elseif key == 53 then
- look = 4
- fric = 20
- res = 0.2
- col = nil
- elseif key == 54 then
- if custom then
- look = 12
- fric = fric_stored
- res = res_stored
- col = col_stored
- end
- end
- end
- end
- function makeGround(x,y,length,ang)
- gNum = gNum + 1
- final_x = ((x + point_x)/2)
- final_y = ((y + point_y)/2)
- tfm.exec.addPhysicObject(gNum, final_x, final_y, {type=look or 0, width=length, height = hei, angle=ang, color = col ,friction=fric or 0.3, restitution=res or 0.2})
- table.insert(tableK,{id=gNum,time=os.time()})
- point_x=nil
- point_y=nil
- end
- function eventLoop()
- for i=1,#tableK do
- if tableK ~= nil then
- if tableK.time < os.time()-8000 then
- tfm.exec.removePhysicObject(tableK.id)
- table.remove(tableK,i)
- end
- end
- end
- if data[builder].timeS < os.time()-5000 then
- tfm.exec.setPlayerScore (builder,math.random(50),true)
- data[builder].timeS=os.time()
- end
- end
- function length(x1, y1, x2, y2)
- lx = (x2 - x1)^2
- ly = (y2 - y1)^2
- return math.sqrt(lx+ly)
- end
- function angle(x1, y1, x2, y2)
- lx = x2 - x1
- ly = y2 - y1
- return math.deg(math.atan2(ly,lx))
- end
- function eventPlayerLeft(name)
- if name == builder then
- newBuilder(randomPlyers(name))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement