×

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
« ‹ 13 / 33 › »
Lua Snippets
Zutto
« Citoyen »
1380483300000
    • Zutto#4451
    • Profil
    • Derniers messages
    • Tribu
#241
  0
function eventNewPlayer(name)
tfm.exec.bindKeyboard(name,32,true,true)
end

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

function eventKeyboard(name,key,down,x,y)
if key==32 then
tfm.exec.movePlayer(name,0,0,true,0,-50,false)
end
end


fly = true

function eventNewGame()
for p in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard(p, 32, true, true)
end
end

function eventKeyboard(p, key)
if fly and key == 32 then
tfm.exec.movePlayer(p, 0, 0, true, 0, -50, true)
end
end

function eventChatCommand(p, c)
if c == "fly" then
fly = not fly
end
end
____________________________________________

!fly = don't fly

=D
Shamousey
« Consul »
1380483420000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#242
  0
[•] Init Error : [string "transformice.lua"]:15: 'end' expected (to close 'if' at line 2)

This error message doesn't mean you just need to add an "end" on the last line of your code, it tells you exactly what line you need to close. In your code, for example...

a dit :
function eventChatCommand(name,command)
if command=="fly" then
function eventNewPlayer(name)
tfm.exec.bindKeyboard(name,32,true,true)
end

You need to end both eventChatCommand and the "if command==" line.

a dit :
function eventChatCommand(name,command)
if command=="fly" then
end
end
function eventNewPlayer(name)
tfm.exec.bindKeyboard(name,32,true,true)
end

Although of course you never specified anything for it to do.
Manacer
« Citoyen »
1380483540000
    • Manacer#0000
    • Profil
    • Derniers messages
    • Tribu
#243
  0
Shamousey a dit :
[•] Init Error : [string "transformice.lua"]:15: 'end' expected (to close 'if' at line 2)

This error message doesn't mean you just need to add an "end" on the last line of your code, it tells you exactly what line you need to close. In your code, for example...
You need to end both eventChatCommand and the "if command==" line.
Although of course you never specified anything for it to do.

No error, and fly don't work :/
Shamousey
« Consul »
1380483660000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#244
  0
Manacer a dit :
No error, and fly don't work :/

I only quoted part of the code to show what was wrong, not the entire thing.
Byenamo
« Citoyen »
1380484860000
    • Byenamo#0000
    • Profil
    • Derniers messages
    • Tribu
#245
  0
Where and error?
a dit :


function eventNewPlayer(name)
for i,key in ipairs({32}) do
tfm.exec.bindKeyboard(name,key,true,true)
end
end

function eventKeyboard(name,key,down,x,y)
if key==32 then
tfm.exec.movePlayer(name,0,0,true,0,-50,true)
end
end

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

function eventNewPlayer(name)
for i,key in ipairs({66}) do
tfm.exec.bindKeyboard(name,key,true,true)
end
end

function eventKeyboard(name,key,down,x,y)
if key==66 then
tfm.exec.setVampirePlayer(name)
end
end

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


.
Jordy
« Consul »
1380485340000
    • Jordy#0015
    • Profil
    • Derniers messages
    • Tribu
#246
  0
Byenamo a dit :
Where and error?

.

Might help if you also post the error message.
Manacer
« Citoyen »
1380485460000
    • Manacer#0000
    • Profil
    • Derniers messages
    • Tribu
#247
  0
Thank !
Tini
« Sénateur »
1380485580000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#248
  0
Please shaman, a command (« ! ») for cheese.
a dit :
admins = {"Tinittee"}
function eventPopupAnswer(id,player,answer)
if id==1 then
tfm.exec.giveCheese(answer)
end
end

The "admins ={"NAME"}...only for me.
a dit :
Sorry, bad english
Byenamo
« Citoyen »
1380485580000
    • Byenamo#0000
    • Profil
    • Derniers messages
    • Tribu
#249
  0
Jordynl a dit :
Might help if you also post the error message.

not catch the fly
Adelkiii
« Citoyen »
1380485880000
    • Adelkiii#0000
    • Profil
    • Derniers messages
#250
  0
I help with a problem, I can not make maps with put category P1 :[
Epicshawty
« Citoyen »
1380486000000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#251
  0
Tinittee a dit :
Please shaman, a command (« ! ») for cheese.

The "admins ={"NAME"}...only for me.

Mort only works for regular players. You can add more admins if you want.
a dit :

function eventChatCommand(p,c)
if p=="Tinittee" or p=="Epicshawty" then
if c=="1" then
tfm.exec.giveCheese(p)
end
end

if c=="mort" then
tfm.exec.killPlayer(p)
end
end

This should work out for you. !1 only works for you or me. While others cant do !1 they can do !mort.

( p means player and c means command)
Tini
« Sénateur »
1380486360000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#252
  0
!cheese?
I can't :(
ctrl +c and ctrl + v, but...fail
Epicshawty
« Citoyen »
1380486360000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#253
  0
Tinittee a dit :
!cheese?
I can't :(
ctrl +c and ctrl + v, but...fail

Do !1 instead of !cheese.
Adelkiii
« Citoyen »
1380486600000
    • Adelkiii#0000
    • Profil
    • Derniers messages
#254
  0
Adelkiii a dit :
I help with a problem, I can not make maps with put category P1 :[

help please
Epicshawty
« Citoyen »
1380486900000
    • Epicshawty#0000
    • Profil
    • Derniers messages
    • Tribu
#255
  0
Adelkiii a dit :
help please

this should help you VVV
a dit :

tfm.exec.disableAutoNewGame(true)
function eventLoop(currentTime,timeRemaining)
if timeRemaining <= 1000 then
tfm.exec.newGame("#1")
end
end

Replace P with #.
#1 = P1, #3 = P3 etc,.
Yteiz
« Citoyen »
1380487680000
    • Yteiz#0000
    • Profil
    • Derniers messages
    • Tribu
#256
  0
How can I have more than one key?
Shamousey
« Consul »
1380487920000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#257
  0
Bind multiple keys, and have multiple if statements depending on different keys.

a dit :
tfm.exec.bindKeyboard("Shamousey",69,true,true)
tfm.exec.bindKeyboard("Shamousey",32,true,true)

function eventKeyboard(name,key,down,x,y)
if key==69 then
print("You pressed E.)
elseif key==32 then
print("You pressed space.")
end
end

 
Yteiz
« Citoyen »
1380488040000
    • Yteiz#0000
    • Profil
    • Derniers messages
    • Tribu
#258
  0
can give a complete example?
Shamousey
« Consul »
1380488040000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#259
  0
I just did.
Manacer
« Citoyen »
1380488280000
    • Manacer#0000
    • Profil
    • Derniers messages
    • Tribu
#260
  0
Shamousey a dit :
I just did.

Shamousey please can you give the code utility (help 2 page)
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 13 / 33 › »
© Atelier801 2018

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

Version 1.27