Recopilación de códigos Lua |
Thunderbolt « Citoyen » 1609233600000
| 1 | ||
Cancelar el uso de consumibles: ★ tfm.exec.disablePhysicalConsumables() Convertir ratón en una oveja: ★ function eventChatCommand (player, command) local args = {} for arg in command:gmatch ("[^%s]+") do table.insert (args, arg) end if args[1] == "oveja" and args[2] == "todos" then for name,mouse in pairs(tfm.get.room.playerList) do tfm.exec.killPlayer (name) tfm.exec.addShamanObject (40, mouse.x, mouse.y) end elseif args[1] == "oveja" and tfm.get.room.playerList[capitalize(args[2])] then local mouse = tfm.get.room.playerList[capitalize(args[2])] tfm.exec.killPlayer (capitalize(args[2])) tfm.exec.addShamanObject (40, mouse.x, mouse.y) end end function capitalize (word) return string.upper (word:sub(1,1)) .. string.lower (word:sub(2)); end Ejemplo: !Oveja thunderbolt#3823 Invocar objetos al hacer click: ★ local user = " " DENTRO DE LAS COMILLAS COLOCAS TU NOMBRE DE USUARIO local object = Y AQUÍ COLOCAS LA ID DEL OBJETO system.bindMouse(user); function eventMouse(name, x, y) tfm.exec.addShamanObject(object, x, y) end Que no toque mas chaman automáticamente: ★ tfm.exec.disableAutoShaman (true) Respawnear después de 3 segundos: ★ function eventPlayerDied(name) tfm.exec.respawnPlayer(name) end Lanzar flechas: ★local settings = { map = "0", ammo = 6, force = 50, recoil = 10, maxObjects = 30, ammoTicks = 2, } local players = {} local objects = {} function main() objects = queue.new() tfm.exec.disableAutoScore(false) tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoNewGame(true) tfm.exec.newGame(settings.map) end function eventNewGame() tfm.exec.setGameTime(0, true) players = {} for name in pairs(tfm.get.room.playerList) do initPlayer(name) end end function initPlayer(name) players[name] = {ammo = 0} ui.addTextArea(0, "", name, 10, 30, settings.ammo * 15, 20, 0x010101, 0x000000, 0.5) system.bindMouse(name, true) end function eventMouse(name, x, y) local player = players[name] if player and player.ammo > 0 then -- remove one ammo ui.removeTextArea(player.ammo * 2 - 1, name) ui.removeTextArea(player.ammo * 2, name) player.ammo = player.ammo - 1 local roomPlayer = tfm.get.room.playerList[name] -- calculate angle between player and click local dx = x - roomPlayer.x local dy = y - roomPlayer.y local angle = math.atan2(dy, dx) -- calculate speeds to direct arrow and always have the same total speed local vx = math.cos(angle) local vy = math.sin(angle) -- spawn arrow and add to queue queue.insert(objects, tfm.exec.addShamanObject(35, roomPlayer.x + 20 * vx, roomPlayer.y + 20 * vy, angle*180/math.pi, settings.force * vx, settings.force * vy, false)) local recoil = -vx * settings.recoil -- workaround to avoid argument exception bug if recoil <= -1 or recoil >= 1 then tfm.exec.movePlayer(name, 0, 0, true, recoil, 0, true) end -- remove first arrow when there are too many if objects.size > settings.maxObjects then tfm.exec.removeObject(queue.remove(objects)) end end end local loopCount = 0 function eventLoop() -- loopCount resets after a certain amount if loopCount == 0 then ammo() end loopCount = (loopCount + 1) % settings.ammoTicks end function ammo() for name, player in pairs(players) do local ammo = player.ammo if ammo < settings.ammo then -- add one ammo player.ammo = ammo + 1 ui.addTextArea(ammo * 2 + 1, "", name, 14 + ammo * 15, 39, 3, 3, 0x990000, 0x990000, 1) ui.addTextArea(ammo * 2 + 2, "", name, 15 + ammo * 15, 40, 1, 1, 0xff0000, 0xcc0000, 1) end end end function eventNewPlayer(name) initPlayer(name) tfm.exec.respawnPlayer(name) end function eventPlayerDied(name) tfm.exec.respawnPlayer(name) end function eventPlayerWon(name) tfm.exec.respawnPlayer(name) end -- simple queue for performance, much faster than system table queues, can contain nils queue = {} function queue.new() return { tail = nil, head = nil, size = 0 } end function queue.insert(self, v) local i = { value = v, next = nil } if self.tail and self.head then self.tail.next = i else self.head = i end self.tail = i self.size = self.size + 1 end function queue.peek(self) if self.head then return self.head.value else error("queue is empty") end end function queue.remove(self) local r = queue.peek(self) self.head = self.head.next if not self.head then tail = nil end self.size = self.size - 1 return r end main() Presionando tecla arriba te conviertes en caja: ★ players={} function returnMouseCount() count=0 for player in pairs(tfm.get.room.playerList) do if(tfm.get.room.playerList[player].isDead==false) then count=count+1 elseif(players[player].id) then count=count+1 end end return count end function eventLoop(time,remaining) returnMouseCount() if(remaining<=0 or count==0) then newRound() end playerList=tfm.get.room.playerList end function eventNewPlayer(name) tfm.exec.bindKeyboard(name,87,true,true) tfm.exec.bindKeyboard(name,88,true,true) players[name]={timestamp=os.time()} end function eventKeyboard(name,key,down,x,y) if players[name].timestamp < os.time()-800 then if(key==87 and playerList[name].isDead==false) then tfm.exec.killPlayer(name) local id=tfm.exec.addShamanObject(1,x,y) players[name]={id=id,x=x,y=y} elseif(key==88 and playerList[name].isDead==false) then tfm.exec.killPlayer(name) local id=tfm.exec.addShamanObject(1,x,y) players[name]={id=id,x=x,y=y} else if(players[name].x and players[name].y and players[name].id) then local id=players[name].id tfm.exec.respawnPlayer(name) players[name].x=tfm.get.room.objectList[id].x players[name].y=tfm.get.room.objectList[id].y if(players[name].x==0) then tfm.exec.killPlayer(name) else tfm.exec.movePlayer(name,players[name].x,players[name].y) end tfm.exec.removeObject(id) players[name].id=nil end end players[name].timestamp=os.time() end end function main() tfm.exec.disableAutoNewGame(true) tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoShaman(true) for name,player in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end end main () Dando click das chispazos: ★ for p,player in pairs(tfm.get.room.playerList) do system.bindMouse(p, true) end function eventMouse(p, x, y) tfm.exec.displayParticle(10, x, y, 0, 0, 0, 0) end for name in pairs (tfm.get.room.playerList) do system.bindMouse (name); end function eventMouse (playerName, x, y) tfm.exec.addShamanObject (24, x, y); end Teleport click: ★ for name,player in pairs(tfm.get.room.playerList) do system.bindMouse(name) end function eventMouse(name, x, y) tfm.exec.movePlayer(name, x, y, false, 0, 1, false) end Teleport click individual: ★ system.bindMouse("Thunderbolt#3823") DENTRO DE LAS COMILLAS COLOCAS TU NOMBRE DE USUARIO function eventMouse(name, x, y) tfm.exec.movePlayer(name, x, y, false, 0, 1, false) end Al agacharse lanzar chispa: ★ for name,player in pairs(tfm.get.room.playerList) do tfm.exec.bindKeyboard(name,83,true,true) tfm.exec.bindKeyboard(name,40,true,true) end function eventKeyboard(name,key,down,x,y) if key==83 or key==40 then tfm.exec.addShamanObject(24,x,y,0,0,0,false) end end Cuando un raton entra al hole, se lo felicita: ★ function eventPlayerWon(name) ui.addTextArea(0, ""..name.." ha ganado el first! Bien hecho :D!", nil, 5, 50, nil, nil, nil, nil, nil) end Dar queso: ★ tfm.exec.giveCheese("Playername") DENTRO DE LAS COMILLAS COLOCAR TU NOMBRE DE USUARIO Dar meep: ★ tfm.exec.giveMeep("Playername") DENTRO DE LAS COMILLAS COLOCAR TU NOMBRE DE USUARIO Dar meep a todos: ★ for name,player in pairs(tfm.get.room.playerList) do tfm.exec.giveMeep(name) end Convertirse en vampiro: ★ tfm.exec.setVampirePlayer("Playername") DENTRO DE LAS COMILLAS COLOCAS TU NOMBRE DE USUARIO Convertir a todos en vampiro: ★ for name,player in pairs(tfm.get.room.playerList) do tfm.exec.setVampirePlayer(name) end Dernière modification le 1609234740000 |
Thunderbolt « Citoyen » 1609233780000
| 0 | ||
PD: obviamente ninguno de esos códigos son míos, simplemente quise recopilar para quienes quieran usarlos |