Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------- System --------------------
- _, nickname = pcall(nil)
- local admin = string.match(nickname, "(.-)%.")
- for _, v in next, {'AutoShaman', 'AutoNewGame', 'AutoTimeLeft', 'PhysicalConsumables','AutoScore','MortCommand','MinimalistMode'} do
- tfm.exec['disable' .. v]()
- end
- system.disableChatCommandDisplay()
- ------------------------------------------------
- local info = {_time = 0,_map_time = 300,_start_time = 10,_click = false,_last = false,_winner = nil,_interval = 2}
- local config = {_object = 34,_radius = 50,_force = 4,_velocity = 7}
- local player = {}
- local alive = {}
- local map = {'@7639406','@7639469','@7639505'}
- local random_map = true
- local current_map = 1
- hypo = function(x,y) return ((x)^2 + (y)^2)^0.5 end
- reverse = function(ad,op,r)
- return math.floor(op < 0 and math.deg(math.acos(ad / r)) or 360 - math.deg(math.acos(ad / r)))
- end
- click_switch = function(activate)
- for name,value in next, tfm.get.room.playerList do system.bindMouse(name,activate) end
- end
- eventNewGame = function()
- info._time = 0
- info._last = false
- info._winner = nil
- click_switch(false)
- alive = {}
- for name,value in next, tfm.get.room.playerList do player[name] = {_time = 0} tfm.exec.setNameColor(name,'0xC2C2DA') end
- tfm.exec.setGameTime(info._map_time,true)
- tfm.exec.snow(10000,999999999999999)
- ui.setMapName('<CH>Snowball War</CH>')
- end
- eventMouse = function(name,x,y)
- if player[name] and player[name]._time < info._time then
- local p = tfm.get.room.playerList[name]
- local ang = reverse(x - p.x,y - p.y,hypo(x - p.x,y - p.y))
- local ad = (math.cos(math.rad(ang)) * config._radius)
- local op = (math.sin(math.rad(ang)) * config._radius)
- tfm.exec.addShamanObject(config._object,p.x + ad,p.y - op,-ang,(ad / config._force),(-op / config._force))
- player[name]._time = (info._time + info._interval)
- end
- end
- change_map = function()
- alive = {}
- for name,value in next, tfm.get.room.playerList do
- if not value.isDead then
- alive[#alive + 1] = name
- end
- end
- if #alive <= 1 then info._last = true info._winner = alive[1] ui.setMapName('<CH>Snowball War</CH> <G>|</G> '..(info._winner and '<N>Vencedor: </N><A:ACTIVE>'..info._winner..'</A:ACTIVE> ' or '<N>Sem vencedores</N> ')) tfm.exec.setGameTime(10,true) info._click = false click_switch(false) tfm.exec.setNameColor(info._winner,'0xC2C2DA') end
- end
- eventLoop = function(ct,tl)
- info._time = (info._time + 0.5)
- if info._time > 3 and tl < 0 then
- current_map = (current_map + 1 > #map and 1 or current_map + 1)
- tfm.exec.newGame(map[(random_map and math.random(1,#map) or current_map)])
- end
- if info._time <= info._start_time then ui.addTextArea(1,'<p align="center"><b><font size="40"><N>'..(info._time < info._start_time and math.ceil(info._start_time - info._time) or 0)..'</N></font></b></p>',nil,370,30,60,60,'0x1','0x1',0.7,true) end
- if info._time > info._start_time and not info._last then
- if not info._click then info._click = true click_switch(true) ui.removeTextArea(1) end
- for name,value in next, tfm.get.room.playerList do
- tfm.exec.movePlayer(name,0,0,true,0,0,true)
- if player[name] and player[name]._time < info._time then tfm.exec.setNameColor(name,'0xE9E654') else tfm.exec.setNameColor(name,'0xC2C2DA') end
- if value.vx > config._velocity or value.vx < -config._velocity or value.vy > (config._velocity + 10) or value.vy < -(config._velocity + 10) and info._click then
- tfm.exec.killPlayer(name)
- end
- end
- end
- if not info._last then change_map() end
- end
- start = function()
- current_map = 1
- tfm.exec.newGame(map[(random_map and math.random(1,#map) or current_map)])
- end
- start()
Add Comment
Please, Sign In to add comment