×

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 Snippets
« ‹ 31 / 33 › »
Lua Snippets
Rolico
« Citoyen »
1479751380000
    • Rolico#0000
    • Profil
    • Derniers messages
#601
  0
x1 script pls?
Hosual
« Consul »
1479758160000
    • Hosual#0000
    • Profil
    • Derniers messages
    • Tribu
#602
  0
Im sorry, can you paste here code for fly for all?
function eventNewPlayer(nick)
for keys, k in pairs({0,2}) do
tfm.exec.bindKeyboard(nick, k, true, true)
end
end

function eventLoop()
for nick,player in pairs(tfm.get.room.playerList) do
x=tfm.get.room.playerList[nick].x
y=tfm.get.room.playerList[nick].y
end
end

for nick,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(nick)
end

function eventKeyboard(nick,key)
if key==0 then
tfm.exec.movePlayer(nick,0,0,false,-70,0,false)
tfm.exec.displayParticle(29,x-5,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x-10,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x-15,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x-20,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x-25,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x-30,y,0,0,0,0,nick)
else
tfm.exec.displayParticle(29,x+5,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x+10,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x+15,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x+20,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x+25,y,0,0,0,0,nick)
tfm.exec.displayParticle(29,x+30,y,0,0,0,0,nick)
if key==2 then
tfm.exec.movePlayer(nick,0,0,false,70,0,false)
end
end
end


and for this admin, i don't want spam all mice in tribe D:
for name,player in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard(name, 70, true, true)
tfm.exec.bindKeyboard(name, 71, true, true)
end
x = 0
y = 0
function eventKeyboard(name, key, down, x, y)
if key == 70 then
tfm.exec.movePlayer(name,0,-25,true,0,0,true)
tfm.exec.addShamanObject(104, x, y, 0, 0, 0, false)
elseif key == 71 then
tfm.exec.addShamanObject(104, x, y, 0, 0, 0, true)
end
end

Dernière modification le 1479758640000
Sar33aj
« Citoyen »
1488241680000
    • Sar33aj#0000
    • Profil
    • Derniers messages
#604
  0
Uhhhh... what is lua??
Sebafrancuz
« Consul »
1488298920000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#605
  0
Sar33aj a dit :
Uhhhh... what is lua??

It is programming language (Wow, nobody knows it):
More info.
Shamousey
« Consul »
1494124200000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#606
  3
http://image.prntscr.com/image/266fb3b29bdc4acc99abc0e6aec94239.png

I've thrown together a quick script to be able to use a skill upon pressing a key, which may have a cooldown before it can be re-used. This script animates a progress bar so you can see when a skill will be ready to use again.

https://gist.github.com/ImLiam/6c55e4b5204be055afb8ba0f43783cf4
Laderik
« Censeur »
1494133740000
    • Laderik#0000
    • Profil
    • Derniers messages
#607
  0
Shamousey a dit :

I hope to try it soon! Seems smart :'
Supreme
« Citoyen »
1495921620000
    • Supreme#1307
    • Profil
    • Derniers messages
    • Tribu
#608
  0
how can i spawn thing ? when im in fancorp lua ?
Shafeeeq
« Citoyen »
1499049960000
    • Shafeeeq#0000
    • Profil
    • Derniers messages
    • Tribu
#609
  0
i dont understand what this all does someone please help me (or means)
Honorabilis
« Consul »
1499074800000
    • Honorabilis#0000
    • Profil
    • Derniers messages
    • Tribu
#610
  0
Edited.

Dernière modification le 1499074860000
Hot_choco
« Citoyen »
1501413540000
    • Hot_choco#0000
    • Profil
    • Derniers messages
    • Tribu
#611
  0
I have a question! Can anyone explain the Team command to me? (Sorry Im so dumb)

red={}
blue={}
function makeTeams()
local playerList={}
for name,player in pairs(tfm.get.room.playerList) do
table.insert(playerList,name)
end
for i=1,#playerList,1 do
local index=math.random(#playerList)
local name=playerList[index]
if i%2==0 then
table.insert(red,name)
else
table.insert(blue,name)
end
table.remove(playerList,index)
end
end
Onkei
« Citoyen »
1501432980000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#612
  0
Hot_choco a dit :

I have a question! Can anyone explain the Team command to me? (Sorry Im so dumb)

Not sure if this explanation is clear enough. If you want more than 2 teams, a different algorithm will be required !!


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
red = {}
blue = {}

function makeTeams()
--[[
Create a table to store all the player names (as an array).

Storing using an array means players can be accessed by an index number
(e.g. playerList[1] will give a player's name)

This will be useful as we can easily select a random player by using the
math.random function to get a random number between 0 and the size of the
array (#playerList).
]]
local playerList = {}
for name, player in pairs(tfm.get.room.playerList) do
table.insert(playerList, name)
end

for i = 1, #playerList, 1 do
--[[
Select a random player from the playerList table.

Note: i is the loop control variable, if it's equal to the size of
the array (#playerList), the for loop will stop and the code below will
stop executing.
]]
local index = math.random(#playerList)
local name = playerList[index]

--[[
i % 2 means getting the remainder of i after it's divided by 2.
All even numbers will have a modulo of 0 as it's divisible by 2,
all odd numbers will have a modulo of 1.

This is convenient as there are only 2 teams; Red or Blue. If i
is even, the random player selected will goto the red team and
vice versa.
]]
if i % 2 == 0 then
table.insert(red, name)
else
table.insert(blue, name)
end
--[[
After the player is added to a team's table, s/he is removed from the
playerList table so s/he won't get selected again.
]]
table.remove(playerList, index)
end
end
Eleven
1505066940000
    • Eleven#6534
    • Profil
    • Derniers messages
#613
[Modéré par Wangan, raison : Please speak English on the EN forums.]
Ocean_dreamy
« Citoyen »
1515576480000
    • Ocean_dreamy#7062
    • Profil
    • Derniers messages
#614
  0
thanks but how do you teleport people? is that a thing or its not possible
Ocean_dreamy
« Citoyen »
1515655680000
    • Ocean_dreamy#7062
    • Profil
    • Derniers messages
#615
  0
Hello i got a question.

is there a teleporting Lua code and pls can you tell me how to spawn in a map
Onkei
« Citoyen »
1515672000000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#616
  0
Joy06 a dit :
Hello i got a question.

is there a teleporting Lua code and pls can you tell me how to spawn in a map


Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
local teleporter = "Joy06"
local tpCoords = {}

function eventMouse(n, x, y)
ui.addPopup(1, 2, "Who would you like to teleport to that location?", n, 15, 25, 200, true)
tpCoords = {x, y}
end

function eventPopupAnswer(id, n, ans)
if tfm.get.room.playerList[ans] then
tfm.exec.movePlayer(ans, tpCoords[1], tpCoords[2])
end
end

function eventNewPlayer(n)
if n == teleporter then
system.bindMouse(n, true)
end
end

eventNewPlayer(teleporter)
Ocean_dreamy
« Citoyen »
1516525260000
    • Ocean_dreamy#7062
    • Profil
    • Derniers messages
#617
  0
Shamousey
Can you please help me how to clear objects after the shooting is done

Thanks!
Overjoy06
« Citoyen »
1517017320000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#618
  0
How do you add a text message then when you click it, it will put to another message called "Walljumping"
Bolodefchoco
« Sénateur »
1517079360000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#619
  0
Overjoy06 a dit :
How do you add a text message then when you click it, it will put to another message called "Walljumping"

Code Lua

1
2
3
4
5
6
7
ui.addTextArea(0, "<a href='event:clicked'>text message</a>", nil, 200, 200)

eventTextAreaCallback = function(i, n, c)
if c == "clicked" then
ui.addTextArea(0, "Walljumping", n, 200, 200)
end
end
Overjoy06
« Citoyen »
1517126760000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#620
  0
Guys is there a script that there is a text then when you click it, it will spawn a map.
Also how do you put messages? like 5 of them.
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 31 / 33 › »
© Atelier801 2018

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

Version 1.27