×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Lua] Peça scripts aqui!
« ‹ 7 / 9 › »
[Lua] Peça scripts aqui!
Favelada
« Consul »
1667060460000
    • Favelada#6672
    • Profil
    • Derniers messages
    • Tribu
#121
  0
queria um script que crashasse o jogo do outro ;*
Sklag
« Citoyen »
1667092320000
    • Sklag#2552
    • Profil
    • Derniers messages
    • Tribu
#122
  0
Favelada a dit :
queria um script que crashasse o jogo do outro ;*

Olá Favelada, scripts assim não são "permetidos".
Preuclides
« Consul »
1667185680000
    • Preuclides#3383
    • Profil
    • Derniers messages
    • Tribu
#123
  0
Favelada a dit :
queria um script que crashasse o jogo do outro ;*

while true do print('script assim não é permitido ta') end

só crasha o seu próprio, sem travar os amiguinhos
Aviso legal
Em minha defesa a regra de script crash só se aplica caso você derrube o jogo dos outros, mas este script derruba unicamente o jogo de quem o carregou, sem afetar os demais. Está explícito aqui que o script pode causar os problemas para si mesmo. Vejamos o que o Termos e Condições de Uso afirma:
Artigo 16 inciso J a dit :
16. Módulos; [...] São módulos proibidos:
(j) Com o objetivo de interromper o Serviço ou o Site ou que afete negativamente ou proibir outros usuários de desfrutar o site, os Jogos ou qualquer outro aspecto do Serviço.

Na interpretação do meu advogado, no anterior artigo do ToS da Atelier801, fica vedada a utilização de módulos Lua que "afetem negativamente" a terceiros, e não a si mesmo. Sendo que "si mesmo" refere-se ao usuário que carrega o script no cafofo e "terceiros" refere-se aos outros jogadores presentes na sala em que o script foi carregado.

Dernière modification le 1667187120000
Gabriel
« Citoyen »
1668018900000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#124
  0
Alguem apaga isso pra mim
Gabriel
« Citoyen »
1668019320000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#125
  0
Asaf0202 a dit :
Como posso escrever em cores no chat com qualquer comando? Enquanto isso, os zeladores não ajudam com os comandos da lua, eles limpam apartamentos ou casas.

Ai mano os outros podem ver mas não aparece no chat apenas em uma textarea que vai aparecer
MAS VOCÊ CONSEGUE MUDAR AS CORES DA LETRA
COMANDOS: !sua mensagem
Seja feliz!!


Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- Aonde você define seu adm

local adm = "Gabriel#8201"
local adm2 = "Marcos198888#7952"
local nome = " ["..""..name.."] " -- aqui tu pode mudar para o nome que quiser isso ai é oque vai aparecer tipo [PlayerName] "..name" Serve para pegar o player que digitou
ui.addTextArea(1, "Chat V1.0 By: Gabriel#8201, Marcos198888#7952", nil, 0, 375, 795, nil, 0x000000, 0xFFFFFF, 1, true)

-- Disabilitar coisas do mapa

tfm.exec.disableAutoNewGame(false)

-- Mensagem que vai aparecer na text areafunction eventChatCommand(name, c)
function eventChatCommand(name, c)
if name == adm then
ui.updateTextArea(1, nome..""..c, nil, 0, 375, 795, nil, 0x000000, 0xFFFFFF, 1, true)
if c == "exit" then
system.exit()
end
end
if name == adm2 then
ui.updateTextArea(1, nome..""..c, nil, 0, 375, 795, nil, 0x000000, 0xFFFFFF, 1, true)
end
end

system.disableChatCommandDisplay(nil, hide)

Dernière modification le 1668019800000
Gabriel
« Citoyen »
1668019680000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#126
  0
Alguem me ajuda Como faço para add uma mensagem ou alguma coisa em uma TABELA?
Preuclides
« Consul »
1668019980000
    • Preuclides#3383
    • Profil
    • Derniers messages
    • Tribu
#127
  0
Gabriel a dit :
Alguem me ajuda Como faço para add uma mensagem ou alguma coisa em uma TABELA?

Code Lua

1
2
local foo = {}
table.insert(foo, 'mensagem ou alguma coisa')
Gabriel
« Citoyen »
1668020520000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#128
  0
Preuclides a dit :
Gabriel a dit :
Alguem me ajuda Como faço para add uma mensagem ou alguma coisa em uma TABELA?

Code Lua

1
2
local foo = {}
table.insert(foo, 'mensagem ou alguma coisa')

Obrigado, Me ajudou muito
Gabriel
« Citoyen »
1668021600000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#129
  0
Alguem sabe oque tem de errado aqui?
eu sabia fazer script fiquei 1 ano sem fazer esqueci tudo

Eu quero pegar a mensagem que o player colocou tipo !teste ai ele envia para a tabela e a textarea obtem esse texto


Code Lua

1
2
3
4
5
6
7
8
9
10
11
local msg = {}
table.insert(msg, " CHAT")

ui.addTextArea(1," CHAT", nil, 250, 100, 300, 250, 0x000000, 0xFFFFFF, 1, true)

function eventChatCommand(name, c)
if c == ""..c then
table.insert(msg, c)
ui.updateTextArea(1,"["..name.."]".." "..msg, nil, 250, 100, 300, 250, 0x000000, 0xFFFFFF, 1, true)
end
end

Dernière modification le 1668021660000
Gabriel
« Citoyen »
1668027840000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#130
  0
Como tira aquele tempo de quando tu entra no mapa Aquele q aparece 3, 2 ,1
Preuclides
« Consul »
1668041580000
    • Preuclides#3383
    • Profil
    • Derniers messages
    • Tribu
#131
  0
Gabriel a dit :
Alguem sabe oque tem de errado aqui?
eu sabia fazer script fiquei 1 ano sem fazer esqueci tudo

Eu quero pegar a mensagem que o player colocou tipo !teste ai ele envia para a tabela e a textarea obtem esse texto


Code Lua

1
2
3
4
5
6
7
8
9
10
11
local msg = {}
table.insert(msg, " CHAT")

ui.addTextArea(1," CHAT", nil, 250, 100, 300, 250, 0x000000, 0xFFFFFF, 1, true)

function eventChatCommand(name, c)
if c == ""..c then
table.insert(msg, c)
ui.updateTextArea(1,"["..name.."]".." "..msg, nil, 250, 100, 300, 250, 0x000000, 0xFFFFFF, 1, true)
end
end

eu usei o "table.insert" mas "foo[#foo+1]" é mais simples

olha se esse código funciona, não o testei

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
local msg = {"                                 CHAT"}

local atualizarTextArea = function(id, str)
ui.addTextArea(id, str, nil, 250, 100, 300, 250, 0x000000, 0xFFFFFF, 1, true)
end

atualizarTextArea(1, table.concat(msg, "\n"))

eventChatCommand = function(name, c)
msg[#msg+1] = string.format("[%s] %s", name, c)
atualizarTextArea(1, table.concat(msg, "\n"))
end

Dernière modification le 1669844160000
Gabriel
« Citoyen »
1668363060000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#132
  0
Como faço para remover um player de uma tabela que eu mesmo fiz tipo
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
players = {}

for all in pairs(tfm.get.room.playerList) do
table.insert(players, all)
end

eventNewPlayer = function(name)
table.insert(players, name)
end

eventPlayerLeft = function(name)
-- ai aqui quero saber como faço para tirar o player da tabela quando ele sair do module(cafofo)
end
Gabriel
« Citoyen »
1669835820000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#133
  0
Boladepelo a dit :
aaa criaram tópico novo :)
belo tópico!
eu gostaria de pedir um script onde iriam sair corações pelo mapa (aqueles efeitos de corações quando você entra na toca)

Se ainda estiver esperando seu script está aqui, haha
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
tfm.exec.newGame(0) -- Começar um novo jogo
-- Se quiser como um mapa seu coloca "Code do mapa"
function effect() -- Criando a função de efeito
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
end

eventLoop = function() -- Um Loop
effect() -- Chamando a função das particulas
end -- Fechando o Loop

Dernière modification le 1669835940000
Sklag
« Citoyen »
1669999740000
    • Sklag#2552
    • Profil
    • Derniers messages
    • Tribu
#134
  0
Gabriel a dit :
Boladepelo a dit :
aaa criaram tópico novo :)
belo tópico!
eu gostaria de pedir um script onde iriam sair corações pelo mapa (aqueles efeitos de corações quando você entra na toca)

Se ainda estiver esperando seu script está aqui, haha
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
tfm.exec.newGame(0) -- Começar um novo jogo
-- Se quiser como um mapa seu coloca "Code do mapa"
function effect() -- Criando a função de efeito
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
end

eventLoop = function() -- Um Loop
effect() -- Chamando a função das particulas
end -- Fechando o Loop

Uma sugestão você poderia usar um for para isso e nesse caso e desnecessario fazer uma função seria mais simples fazer so um eventLoop

Code Lua

1
2
3
4
5
eventLoop = function()
for i = 1,12 do
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil)
end
end
Gabriel
« Citoyen »
1670005440000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#135
  0
Sklag a dit :
Gabriel a dit :
Boladepelo a dit :
aaa criaram tópico novo :)
belo tópico!
eu gostaria de pedir um script onde iriam sair corações pelo mapa (aqueles efeitos de corações quando você entra na toca)

Se ainda estiver esperando seu script está aqui, haha
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
tfm.exec.newGame(0) -- Começar um novo jogo
-- Se quiser como um mapa seu coloca "Code do mapa"
function effect() -- Criando a função de efeito
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil) -- Apague se quiser diminuir as particulas
end

eventLoop = function() -- Um Loop
effect() -- Chamando a função das particulas
end -- Fechando o Loop

Uma sugestão você poderia usar um for para isso e nesse caso e desnecessario fazer uma função seria mais simples fazer so um eventLoop

Code Lua

1
2
3
4
5
eventLoop = function()
for i = 1,12 do
tfm.exec.displayParticle(30, math.random(10, 790), math.random(50, 390), 0, 0, 0, 0, nil)
end
end

Ok, Obrigado pela sugestão

Dernière modification le 1670005500000
Gabriel
« Citoyen »
1670132340000
    • Gabriel#8201
    • Profil
    • Derniers messages
    • Tribu
#136
  0
Hallonin a dit :
~Gostaria de fazer um pedido de script~

O script que eu queria é que os jogadores irão nascer em um mapa plano normal, e daí irá aparecer uma mensagem na tela dizendo
Uma zona segura vai aparecer em.
(O tempo que eu escolher). A mensagem deve aparecer no meio da tela só que lá encima. Então depois que a zona segura aparecer ela irá aparecer em uma forma de bola como se fosse a de shaman no modo divino. Então depois que acabar o tempo irá aparecer outra mensagem dizendo que A zona segura vai diminuir em. (O tempo que eu escolher novamente). Quando esse tempo acabar irá aparecer outra mensagem dizendo que A zona segura está diminuindo. Se o jogador ficar fora da zona ele irá tomar dano, caso for possível adicionar uma caixa de xp com a vida do jogador ao lado seria melhor ainda. E depois que a mensagem dizendo que a zona está diminuindo irá aparecer a mesma mensagem dizendo que a zona vai diminuir em um certo tempo e assim se repete tudo normalmente, caso a zona ela diminuir toda e os jogadores ficarem fora dela eles começariam a tomar dano o jogador que morrer primeiro e o que fica vivo ganha automaticamente, e assim se inicia uma nova partida.

Olha foi o maximo que consegui fazer blz? qual quer coisa pode fala comigo que eu coloco ou qual quer bug erro é só você fala
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.newGame(0)


local p = 0
local vivo = 0

-- coisas para modificar se quiser diminuir o tempo

local prox = 5 -- se quiser diminuir o tempo para aparecer
local px = 5 -- coloca o mesmo do tempo acima ^
local delay = 1 -- Se quiser almenta o delay
local dl = 1 -- coloca o mesmo que colocou no delay

-- Configuração da Kill Zone

local killY = 10
local killX = 0
local killMaxY = 400
local killMaxX = 0

local killX2 = 800
local killMaxY2 = 400
local killMaxX2 = 800
local tam = 0

-- Função para aparecer a safe

for name, player in pairs(tfm.get.room.playerList) do
p = p +1
end

function safe()
if (prox <= 0) then
almenta()
diminui()
prox = px
else
end
end
-- verificar se você está dentro dela
function verifica()
for k, v in pairs(tfm.get.room.playerList) do
if (v.x >= killX) and (v.x <= killMaxX) then
if (v.y >= killY) and (v.y <= killMaxY) then
tfm.exec.killPlayer(k)
end
end
end
end
-- verificar denovo
function verifica2()
for k, v in pairs(tfm.get.room.playerList) do
if (v.x <= killX2) and (v.x >= killMaxX2) then
if (v.y >= killY) and (v.y <= killMaxY) then
tfm.exec.killPlayer(k)
end
end
end
end
-- almentar a safe
function almenta()
killMaxX = killMaxX +10
ui.addTextArea(-2, "", name, killX, killY, killMaxX, killMaxY, 0xFF0404, 0xFF0404, 0.50, false)
end
-- almentar a outra safe
function diminui()
killMaxX2 = killMaxX2 -10
tam = tam +10
ui.addTextArea(-1, "", name, killMaxX2, killY, tam, killMaxY, 0xFF0404, 0xFF0404, 0.50, false)
end
-- tempo que aparece na tela
function TextArea()
ui.addTextArea(-3, "<font size='25'>"..prox, name, 380, 30, nil, nil, 0x000000, 0xFF0404, 0.50, false)
end
-- Delay para abaixar o tempo
function a()
if (delay == 0) then
prox = prox -1
delay = dl
else
delay = delay -1
end
end
-- Repetição de todo o codigo acima
eventLoop = function()
TextArea() -- Atualizando a textarea
safe() -- Atualizando a safe
verifica() -- Atualizando a verificação
verifica2() -- atualizando a outra verificação
a() -- Diminuindo o tempo
end

eventNewPlayer = function()
p = p +1
end

eventPlayerLeft = function()
p = p -1
end

function reset()
killY = 10
killX = 0
killMaxY = 400
killMaxX = 0

killX2 = 800
killMaxY2 = 400
killMaxX2 = 800
tam = 0
delay = 1
prox = 5
ui.addTextArea(-1, "", name, killMaxX2, killY, tam, killMaxY, 0xFF0404, 0xFF0404, 0.50, false)
ui.addTextArea(-2, "", name, killX, killY, killMaxX, killMaxY, 0xFF0404, 0xFF0404, 0.50, false)
end

eventPlayerDied = function(name)
tfm.exec.setUIShamanName(name.." morreu.")
p = p -1
if (p == 1) then
for all in pairs(tfm.get.room.playerList) do
tfm.exec.giveCheese(all)
tfm.exec.playerVictory(all)
tfm.exec.respawnPlayer(all)
reset()
end
elseif (p <= 0) then
for all in pairs(tfm.get.room.playerList) do
tfm.exec.killPlayer(all)
reset()
for i=1,20 do
tfm.exec.respawnPlayer(all)
end
end
end
end


Facilitei sua vida um poco de copiar isso tudo tem 2 links
(ATENÇÃO TEM VEZES QUE O NAVEGADOR TRADUZ A SCRIPT PARA PT-BR OLHA ANTES DE COPIAR E COLOCA PARA MOSTRA ORIGINAL PARA NÃO DA ERRO NA SCRIPT)
Esse AQUI que não é so o script

Ou Esse AQUI que é só o script para da CTRL + A, CTRL + C

Dernière modification le 1670132700000
Samm
« Citoyen »
1675032360000
    • Samm#7926
    • Profil
    • Derniers messages
    • Tribu
#137
  0
peço um script de sorteios mas sem os pisos que ficam mudando de cor ao fundo quando algum player ganha, pois isso faz sumir as imagens do mapa (que é customizado para a minha tribo atual) ent ja q eu n sei mexer em lua algm q sabe poderia remover apenas a parte que geral pisos coloridos ao fundo? vou tentar deixar o script do sorteio aqui pra editarem :)
( tem q pagar pra algm fazer o script pra mim? estou com 200cc no inventario, mas por favor, cobrem barato)
-- Gerenciador de sorteios
-- Escrito por Ninguem

adm = "Samm#7926"
nome = "TESTE (NÃO VALE NADA)"
mapa = [[@7925699]]

participante = {}
inicio = false
fim = false
qtd = 0
fast = 0

function eventTextAreaCallback(id, p, cmd)
if cmd == "entrada" then
ui.addTextArea(0, "<p align='center'>Participando", p, 200, 370, 400, 20, 1, 0x00ff00, 0.8,false)
entrada(p, #participante + 1)
elseif cmd == "inicio" then
ui.addPopup(0, 2, "<p align='center'>Quantidade de sorteados", p, 300, 200, 200, false)
elseif cmd == "novo" then
novo()
end
end

function eventNewPlayer(p)
if not inicio and not fim then
ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", p, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, p, 5, 40, 795, 40, 1, 1, 0.8, false)
end
end

function eventPopupAnswer(id, p, cmd)
if tonumber(cmd, 10) then
if tonumber(cmd, 10) >= 1 and tonumber(cmd, 10) <= #participante then
ui.removeTextArea(0, nil)
ui.removeTextArea(-1, nil)
qtd = tonumber(cmd, 10)
fast = math.random(5,15)
inicio = true
end
end
end

function participando(p)
for i, v in pairs(participante) do
if v == p then
return true
end
end
return false
end

function entrada(p, num)
if not participando(p) then
participante[num] = p
ui.addTextArea(num, "<p align='center'>" .. p, nil, ((num-1)%8)*100+5, math.floor((num-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
end
end

function novo()
for i=1, #participante do
ui.removeTextArea(i, nil)
table.remove(participante, 1)
end
ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
tfm.exec.removePhysicObject(0)
fim = false
end

function sorteio(tipo)
local lista = {}
local sorteado = 0
for i=1, #participante do
lista = i
end
local rand = 0
for i, v in pairs(participante) do
ui.addTextArea(i, "<p align='center'>" .. v, nil, ((i-1)%8)*100+5, math.floor((i-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
end
for i=1, qtd do
sorteado = math.random(#lista)
rand = lista[sorteado]
table.remove(lista, sorteado)
if tipo == "quase" then
ui.addTextArea(rand, "<p align='center'><font color='#ffff00'>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0xffff00, 0.8, false)
elseif tipo == "final" then
ui.addTextArea(rand, "<p align='center'><font color='#00ff00'><b>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0x00ff00, 0.8, false)
end
end
end

function eventLoop()
if inicio then
if fast > 0 then
sorteio("quase")
fast = fast - 1
else
sorteio("final")
inicio = false
fim = true
ui.addTextArea(-1, "<p align='center'><a href='event:novo'>Novo sorteio", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
end
end
if fim then
tfm.exec.addPhysicObject(0, 400, 200, {type=12,color=math.random(0x666666, 0x777777), miceCollision=false, width=800, height=400})
for i=1, 50 do
tfm.exec.displayParticle(math.random(21,24), math.random(1,800), 20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
end
end
end

tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoNewGame(true)
math.randomseed(os.time())
tfm.exec.newGame(mapa)
ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, nil, 5, 40, 795, 40, 1, 1, 0.8, false)
tfm.exec.setUIMapName("Script de sorteios")
Preuclides
« Consul »
1675141140000
    • Preuclides#3383
    • Profil
    • Derniers messages
    • Tribu
#138
  0
@Samm fiz um aqui, espero q goste:
(eu ainda estou terminando esse script, mas já está usável)

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
---@autor Avuhcie#0000
---@descrição script de sorteio
---@créditos Ninguem#0095 pela versão anterior e pela função nineSlicedRect

--otimizações
local tfm, ui, coroutine, string, table, math = tfm, ui, coroutine, string, table, math
math.randomseed(math.random()*os.time()*math.random()+math.exp(math.random()))

--edite aqui
local mapa = '@7923684'
local ganhadoresNumero = 1
local premio = 'Algum prêmio título'

--gera o adm do script de acordo com quem o carregou
local chefe = (debug.traceback()):match('(%w*%#%d+)')

--desativa umas coisas
do local desativar = {'AutoShaman', 'AutoNewGame', 'AutoTimeLeft', 'AfkDeath', 'AutoScore'}
for i=1, #desativar do
tfm.exec['disable'..desativar[i]]()
end
end

local participantes = {}
local ganhadores = {}

local fatias = {
{img="17f85ff6afb.png", w=28, h=29},
{img="17f86018555.png", w=8, h=29},
{img="17f8601f67b.png", w=28, h=29},
{img="17f860256e6.png", w=28, h=4},
{img="17f8602b3f0.png", w=8, h=4},
{img="17f86038225.png", w=28, h=4},
{img="17f8603de5f.png", w=28, h=29},
{img="17f86043b4a.png", w=8, h=29},
{img="17f86049374.png", w=28, h=29}
}

local function nineSlicedRect(source, target, targetPlayer, x, y, width, height) --por Ninguem#0095
return {
tfm.exec.addImage (source[1].img, target, x, y, targetPlayer, 1, 1),
tfm.exec.addImage (source[2].img, target, x+source[1].w, y, targetPlayer, (width-source[1].w-source[3].w)/source[2].w, 1),
tfm.exec.addImage (source[3].img, target, x+width-source[3].w, y, targetPlayer, 1, 1),
tfm.exec.addImage (source[4].img, target, x, y+source[1].h, targetPlayer, 1, (height-source[1].h-source[7].h)/source[4].h),
tfm.exec.addImage (source[5].img, target, x+source[1].w, y+source[1].h, targetPlayer, (width-source[1].w-source[3].w)/source[2].w, (height-source[1].h-source[7].h)/source[4].h),
tfm.exec.addImage (source[6].img, target, x+width-source[6].w, y+source[1].h, targetPlayer, 1, (height-source[1].h-source[7].h)/source[4].h),
tfm.exec.addImage (source[7].img, target, x, y+height-source[7].h, targetPlayer, 1, 1),
tfm.exec.addImage (source[8].img, target, x+source[7].w, y+height-source[8].h, targetPlayer, (width-source[1].w-source[3].w)/source[2].w, 1),
tfm.exec.addImage (source[9].img, target, x+width-source[9].w, y+height-source[9].h, targetPlayer, 1, 1)
}
end

local tabelaTamanho = function(tabela)
local tamanho = 0
for k in next, tabela do tamanho = tamanho+1 end
return tamanho
end

local dados = function()
local _dados = {}
local info = {
['Prêmio'] = premio,
['Número de participantes'] = tabelaTamanho(participantes),
['Organizador'] = chefe
}
if tabelaTamanho(participantes) == 0 then
if premio:len() > 16 then
--nem eu sei o que tá acontecendo nessa conta
nineSlicedRect(fatias, '!1', nil, 0, 20, 87+(math.sqrt(premio:len()*math.exp(6.73)*premio:len()/25))-math.sqrt(math.pi/128)/21+(premio:len()*1.28), 74)
else
nineSlicedRect(fatias, '!1', nil, 0, 20, 207, 74)
end
end
for k, v in next, info do
_dados[#_dados+1] = '<font color="#FDFDFE" size="13" face="Trebuchet MS"><b>'..k..'</b>: '..v
end
return _dados
end

---@textAreas
--[[
1 = dados
2 = participar
3 = abrir participantes
4 = participantes
5 = iniciar
]]

local idEspecial = { --executa algo quando uma textarea é chamada
[2] = function(alvo)
nineSlicedRect(fatias, '!1', alvo, 0, 342, 207, 56)
ui.addTextArea(-2, '<font size="16"><a href="event:entrar">ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ</a></font>', alvo, 10, 362, nil, nil, 0x0, 0x0, 1, true)
end,
[5] = function(alvo)
nineSlicedRect(fatias, '!1', alvo, 0, 92, 207, 56)
ui.addTextArea(-5, '<font size="16"><a href="event:iniciar">ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ</a></font>', alvo, 10, 112, nil, nil, 1, 1, 0, true)
end

}

--pra não dar erro qnd chamar nil
setmetatable(idEspecial, {__index = function() return function() end end})

local textAreas = function(id, alvo, textoAuxiliar)
local textoAuxiliar = textoAuxiliar or ''
local cor = {'9400D3','4B0082','0000FF', '00FFFF', '00FF00', 'FFFF00', 'FF7F00', 'FF0000', 'FF0382'}
return ({
{1, table.concat(dados(), '\n'), alvo, 10, 30, nil, nil, 0x0, 0x0, 1, true},
{2, '<p align="center">'..textoAuxiliar..'</p>', alvo, 15, 362, 180, nil, 0x0, 0x0, 1, true},
{3, '<p align="center">'..textoAuxiliar..'</p>', alvo, 15, 362, 180, nil, 0x0, 0x0, 1, true},
{4, '<p align="center">'..textoAuxiliar..'</p>', alvo, 15, 362, 180, nil, 0x0, 0x0, 1, true},
{5, textoAuxiliar, alvo, 15, 112, 180, nil, 0x0, 0x0, 1, true},
{6, '<font color="#FDFDFE" size="16" face="Lucida Console"><font color="#ED67EA" size="22" face="Trebuchet MS"><p align="center"><b>GANHADOR(ES):</b></p></font>\n<p align="center">'..table.concat(ganhadores, '<b>, </b>'), alvo, 208+25, 108+18, 536, nil, -1, tonumber('0x'..cor[math.random(#cor)]), 1, true},
})[id]
end

local carregarTextArea = function(id, alvo, textoAuxiliar, ...)
ui.addTextArea(table.unpack(textAreas(id, alvo, textoAuxiliar)))
idEspecial[id](alvo)
if ... then
local argumentos = {...}
for i=1, #argumentos do
ui.addTextArea(table.unpack(textAreas(argumentos[i], alvo)))
end
end
end

local removerTextArea = function(id, alvo, ...)
ui.removeTextArea(id, alvo)
if ... then
local argumentos = {...}
for i=1, #argumentos do
ui.removeTextArea(argumentos[i], alvo)
end
end
end

local selecionar = function(tabela)
local aleatorio = math.random(1, tabelaTamanho(tabela))
local contagem = 1
for k in next, tabela do
if contagem == aleatorio then
return k
end
contagem = contagem+1
end
end

local _modo = 'nenhum'

local callback = {
entrar = function(nome)
participantes[nome] = true
carregarTextArea(1)
carregarTextArea(2, nome, '<font size="14" face="Trebuchet MS" color="#FFD700"><b>Participando!</b></font>')
removerTextArea(-2, nome)
end,
iniciar = function()
_modo = 'inicio'
carregarTextArea(2, nil, '<font size="14" face="Trebuchet MS" color="#55557A"><b>Sorteio em andamento...</b></font>')
carregarTextArea(5, chefe, '<p align="center"><font color="#55557A" size="14" face="Trebuchet MS"><b>Iniciar</b></font></p>')
removerTextArea(-5, nil, '', -2)
end
}

local primeiraVez = true
local particula = {1, 2, 9, 21, 22, 23, 24, 29, 31, 33, 34, 39, 43}
local particulaFEscolhida = particula[math.random(#particula)]
local confetes = {21, 22, 23, 24}

local sorteiozinho = coroutine.create(function()
while true do
if _modo == 'inicio' then
if tabelaTamanho(participantes) < 14 then
for k in next, participantes do
if math.random(0, 100) > 40/tabelaTamanho(participantes) then
local ratoX = tfm.get.room.playerList[k].x
local ratoY = tfm.get.room.playerList[k].y
local particulaEscolhida = particula[math.random(#particula)]
for i=1, 360/4, 4 do
tfm.exec.displayParticle(particulaEscolhida, ratoX+(math.sin(math.rad(i*4))*36)-(5), ratoY+(math.cos(math.rad(i*4))*36)-(5), -((math.sin(math.rad(i*4))*36)-(5))/32, -((math.cos(math.rad(i*4))*36)-(5))/32)
end
end
end
else
for k in next, participantes do
if math.random(0, 100) > 40/tabelaTamanho(participantes) then
local ratoX = tfm.get.room.playerList[k].x
local ratoY = tfm.get.room.playerList[k].y
local particulaEscolhida = particula[math.random(#particula)]
for i=1, 360/8, 8 do
tfm.exec.displayParticle(particulaEscolhida, ratoX+(math.sin(math.rad(i*8))*36)-(5), ratoY+(math.cos(math.rad(i*8))*36)-(5), -((math.sin(math.rad(i*8))*36)-(5))/32, -((math.cos(math.rad(i*8))*36)-(5))/32)
end
end
end
end
elseif _modo == 'final' then
if primeiraVez then
primeiraVez = false
for i=1, ganhadoresNumero do
ganhadores[#ganhadores+1] = selecionar(participantes)
end
carregarTextArea(2, nil, '<font size="14" face="Trebuchet MS" color="#ED67EA"><b>Finalizado!</b></font>')
removerTextArea(-2, nil)
for i=1, #ganhadores do
tfm.exec.giveCheese(ganhadores[i])
end
end
carregarTextArea(6)
do
for i=1, 64 do
tfm.exec.displayParticle(confetes[math.random(#confetes)], math.random(800), 18, math.abs(math.sin(math.random(90, 120)))/4, math.abs(math.cos(math.random(90, 120)))/4, math.abs(math.asin(math.random(90, 120)))/4, math.abs(math.sin(math.random(90, 120)))/4)
end
if #ganhadores < 14 then
for i=1, #ganhadores do
local ratoX = tfm.get.room.playerList[ganhadores[i]].x
local ratoY = tfm.get.room.playerList[ganhadores[i]].y
for i=1, 360/4, 4 do
tfm.exec.displayParticle(particulaFEscolhida, ratoX+(math.sin(math.rad(i*4))*48)-(2), ratoY+(math.cos(math.rad(i*4))*48)-(2), ((math.sin(math.rad(i*4))*48)-(5))/32, ((math.cos(math.rad(i*4))*48)-(5))/32)
tfm.exec.displayParticle(particulaFEscolhida, ratoX+(math.sin(math.rad(i*4))*36)-(2), ratoY+(math.cos(math.rad(i*4))*36)-(2), ((math.sin(math.rad(i*4))*36)-(5))/32, ((math.cos(math.rad(i*4))*36)-(5))/32)
tfm.exec.displayParticle(particulaFEscolhida, ratoX+(math.sin(math.rad(i*4))*24)-(2), ratoY+(math.cos(math.rad(i*4))*24)-(2), ((math.sin(math.rad(i*4))*24)-(5))/32, ((math.cos(math.rad(i*4))*24)-(5))/32)
end
end
elseif #ganhadores < 25 then
for i=1, #ganhadores do
local ratoX = tfm.get.room.playerList[ganhadores[i]].x
local ratoY = tfm.get.room.playerList[ganhadores[i]].y
for i=1, 360/6, 6 do
tfm.exec.displayParticle(particulaFEscolhida, ratoX+(math.sin(math.rad(i*6))*36)-(2), ratoY+(math.cos(math.rad(i*6))*36)-(2), ((math.sin(math.rad(i*6))*36)-(5))/32, ((math.cos(math.rad(i*6))*36)-(5))/32)
tfm.exec.displayParticle(particulaFEscolhida, ratoX+(math.sin(math.rad(i*6))*24)-(2), ratoY+(math.cos(math.rad(i*6))*24)-(2), ((math.sin(math.rad(i*6))*24)-(5))/32, ((math.cos(math.rad(i*6))*24)-(5))/32)
end
end
else
for i=1, #ganhadores do
local ratoX = tfm.get.room.playerList[ganhadores[i]].x
local ratoY = tfm.get.room.playerList[ganhadores[i]].y
for i=1, 360/8, 8 do
tfm.exec.displayParticle(particulaFEscolhida, ratoX+(math.sin(math.rad(i*8))*24)-(6), ratoY+(math.cos(math.rad(i*8))*24)-(6), ((math.sin(math.rad(i*4))*24)-(5))/32, ((math.cos(math.rad(i*2))*24)-(5))/32)
end
end
end
end
end
coroutine.yield()
end
end)

do local tempoPercorrido = 0
eventLoop = function()
coroutine.resume(sorteiozinho)
if tempoPercorrido == 5 then --depois de 5 segundos selecioando
_modo = 'final'
elseif _modo == 'inicio' then
tempoPercorrido = tempoPercorrido+0.5
end
end
end


eventTextAreaCallback = function(id, nome, evento)
callback[evento](nome)
end

eventPlayerDied = function(nomeDoJogador)
tfm.exec.respawnPlayer(nomeDoJogador)
end

eventNewPlayer = function(nomeDoJogador)
tfm.exec.respawnPlayer(nomeDoJogador)
carregarTextArea(1, nomeDoJogador)
carregarTextArea(2, nomeDoJogador, '<font size="14" face="Trebuchet MS" color="#00FF7F"><b>Clique para participar!</b></font>')
end

eventPlayerWon = function(nomeDoJogador)
tfm.exec.respawnPlayer(nomeDoJogador)
end

tfm.exec.newGame(mapa)

carregarTextArea(1)
carregarTextArea(2, nil, '<font size="14" face="Trebuchet MS" color="#00FF7F"><b>Clique para participar!</b></font>')
carregarTextArea(5, chefe, '<p align="center"><font color="#FDFDFE" size="14" face="Trebuchet MS"><b>Iniciar</b></font></p>')

Dernière modification le 1675141260000
Tenisongamer
« Citoyen »
1675267020000
    • Tenisongamer#6538
    • Profil
    • Derniers messages
#139
  0
Queria um script pra fazer tipo um bot pra minha tribo . . .
Preuclides
« Consul »
1675268460000
    • Preuclides#3383
    • Profil
    • Derniers messages
    • Tribu
#140
  0
Tenisongamer a dit :
Queria um script pra fazer tipo um bot pra minha tribo . . .

não tem como pedir esse tipo de coisa :P
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Lua] Peça scripts aqui!
« ‹ 7 / 9 › »
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27