×

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
« ‹ 18 / 33 › »
Lua Snippets
Gonzahook
« Citoyen »
1380678600000
    • Gonzahook#0000
    • Profil
    • Derniers messages
#341
  0
I need help with this script, i just need to add like, a callers table so instead of adding, name == "Gonzahook" i just put the table value in there,


function eventChatCommand(name, cmd)
local cmd_args = {}
for arg in cmd:gmatch("%S+") do
table.insert(cmd_args, arg)
end
if cmd_args[1] == "kill" then
tfm.exec.killPlayer(cmd_args[2])
elseif cmd_args[1] == "cheese" then
tfm.exec.giveCheese(cmd_args[2])
--etc..
end
end
Shamousey
« Consul »
1380680700000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#342
  0
Firstly define your table.

a dit :
admins = {"Gonzahook","Shamousey"}

Then loop through it, and check if the value of the item in the table is the same as the name in eventChatCommand.

a dit :
for _,n in pairs(admins) do
if name==n then
--Commands
end
end

 
Gonzahook
« Citoyen »
1380837480000
    • Gonzahook#0000
    • Profil
    • Derniers messages
#343
  0
Shamousey as i didn't learn about tables so much, how would you insert the cmd_args[2] into the table admins?
Makinit
« Citoyen »
1380837840000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#344
  0
Shamousey a dit :
Firstly define your table.
Then loop through it, and check if the value of the item in the table is the same as the name in eventChatCommand.
 

I suggest using this for better performance:
example a dit :
admins = {Someone = true, Someoneelse = true}
if admins[name] then
--do stuff
end
--add admin:
--admins[name] = true
--remove admin:
--admins[name] = nil
Mikuhl
« Citoyen »
1380838620000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#345
  0
Makinit a dit :
I suggest using this for better performance:

Oh dang, you go gurl. Tell that Shamoo whos boss!
Bengalstar
« Citoyen »
1380843360000
    • Bengalstar#0000
    • Profil
    • Derniers messages
#346
  0
does anyone know why this won't work?

tfm.exec.disableAfkDeath()

error: [•] tfm.exec.disableAfkDeath : argument 1 can't be NIL.

does it have to do with the "()" part or..
Shamousey
« Consul »
1380844020000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#347
  0
You need to put either true or false as the argument.
Bengalstar
« Citoyen »
1380846960000
    • Bengalstar#0000
    • Profil
    • Derniers messages
#348
  0
Shamousey a dit :
You need to put either true or false as the argument.

ok ty shamoo
Championrs
« Citoyen »
1380872400000
    • Championrs#0000
    • Profil
    • Derniers messages
#349
  0
How to:
Make baloon go certain directions
Play a map automatically when lua script is entered
Makinit
« Citoyen »
1380874980000
    • Makinit#0095
    • Profil
    • Derniers messages
    • Tribu
#350
  0
Championrs a dit :
Make baloon go certain directions

Use xSpeed in moveObject:
balloon = tfm.exec.addShamanObject(28, 400, 300)
tfm.exec.moveObject(balloon, 0, 0, true, 50, 0, false) --right
tfm.exec.moveObject(balloon, 0, 0, true, -50, 0, false) --left

Championrs a dit :
Play a map automatically when lua script is entered

Use tfm.exec.newGame in the main scope: outisde any functions.
Alishakouri
« Citoyen »
1380876240000
    • Alishakouri#0000
    • Profil
    • Derniers messages
    • Tribu
#351
  0
i would like a tribe war with lua
Shamousey
« Consul »
1380898140000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#352
  0
Alishakouri a dit :
i would like a tribe war with lua

Several people are already working on tribewar style minigames, just wait ;)
Antoooshka
« Citoyen »
1380898800000
    • Antoooshka#0000
    • Profil
    • Derniers messages
#353
  0
a dit :
tfm.exec.addImage(String imageName, String target, Int xPosition, Int yPosition)

Example of use
Shamousey
« Consul »
1380899040000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#354
  0
a dit :
tfm.exec.addImage("QwIRrbu.png","$Shamousey",-15,-30)

Bare in mind that this function is only available for Lua Team members.
Abdeltif
« Citoyen »
1380904140000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#355
  0
I need an inderstandable intro please in this
a dit :

function eventChatCommand(playerName, cmd)
if cmd == "apm" then
tfm.exec.moveObject(apple, x, y)
end
end

I need a complex commande as "!apm x y" like : !amp 50 50
About the apple and stuff that you may say it's not like thatto use "tfm.exec.moveObject" i took care about it(apple = tfm.exec...)
So ... Help
Hophipmice
« Citoyen »
1380904140000
    • Hophipmice#0000
    • Profil
    • Derniers messages
    • Tribu
#356
  0
I sewar down apple was 39 and not apple...
Abdeltif
« Citoyen »
1380904320000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#357
  0
Hophipmice a dit :
I sewar down apple was 39 and not apple...

Did any one listen ._. they don't use Objext id like that but answear me please i will quote !
I need an inderstandable intro please in this

a dit :

function eventChatCommand(playerName, cmd)
if cmd == "apm" then
tfm.exec.moveObject(apple, x, y)
end
end

I need a complex commande as "!apm x y" like : !amp 50 50
Orb
« Censeur »
1380905340000
    • Orb#0095
    • Profil
    • Derniers messages
    • Tribu
#358
  0
I need an example of
a dit :
eventTextAreaCallback(Int textAreaId, String playerName, String callback)

please ^^
Abdeltif
« Citoyen »
1380907860000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#359
  0
Here is an exapmple of popup with commandes and the coolest is you won't worry for text closing and commande won't be show for others !
do !pop text for text
a dit :
function eventChatCommand(name, cmd)
if cmd:sub(0,3) == "pop" then
ui.addPopup(2, 0, cmd:sub(5), NIL, 50, 50, 600)
end
end
system.disableChatCommandDisplay("popup", true)

.
Bengalstar
« Citoyen »
1380928200000
    • Bengalstar#0000
    • Profil
    • Derniers messages
#360
  0
i'm too lazy to do this but can someone switch the FFA coding with spirits instead of cannons? ty
i mean not on that thread can someone give me the code though instead of me having to go through everything and switching it to spirits
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 18 / 33 › »
© Atelier801 2018

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

Version 1.27