×

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
  • /
  • Script Requests
« ‹ 148 / 160 › »
Script Requests
Themiachale
« Citoyen »
1534192860000
    • Themiachale#0000
    • Profil
    • Derniers messages
    • Tribu
#2941
  0
ehm... sorry again for disturbing for simple things but I'm so noob in scripts...

How can i change this and adding more people to the admin and let their color names be red like in this script...

a dit :
admin= "Themiachale#0000"
tfm.exec.setNameColor("Themiachale#0000", 0xC20400)

I tryed some ways that I found in this thread but they doesn't work for me... Idk why...

a dit :
admin= "Themiachale#0000", "name", "name"
tfm.exec.setNameColor("Themiachale#0000", "name", "name", 0xC20400)

a dit :
admin= {"Themiachale#0000", "name", "name"}
tfm.exec.setNameColor({"Themiachale#0000", "name", "name"}, 0xC20400)

a dit :
admin= {"Themiachale#0000" = true, "name" = true, "name" = true}
tfm.exec.setNameColor({"Themiachale#0000", "name", "name"}, 0xC20400)

I need it for let them write a chat command that is all setted up already and it works...
Sebafrancuz
« Consul »
1534199460000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#2942
  0
Themiachale a dit :
ehm... sorry again for disturbing for simple things but I'm so noob in scripts...

How can i change this and adding more people to the admin and let their color names be red like in this script...

a dit :
admin= "Themiachale#0000"
tfm.exec.setNameColor("Themiachale#0000", 0xC20400)

I tryed some ways that I found in this thread but they doesn't work for me... Idk why...

a dit :
admin= "Themiachale#0000", "name", "name"
tfm.exec.setNameColor("Themiachale#0000", "name", "name", 0xC20400)

a dit :
admin= {"Themiachale#0000", "name", "name"}
tfm.exec.setNameColor({"Themiachale#0000", "name", "name"}, 0xC20400)

a dit :
admin= {"Themiachale#0000" = true, "name" = true, "name" = true}
tfm.exec.setNameColor({"Themiachale#0000", "name", "name"}, 0xC20400)

I need it for let them write a chat command that is all setted up already and it works...

You could use loops, f.e.:
Code Lua

1
2
3
4
admin= {"Themiachale#0000", "name", "name"}
for indexes, values in next, admin do
tfm.exec.setNameColor(values, 0xC20400)
end
or
Code Lua

1
2
3
4
admin= {"Themiachale#0000", "name", "name"}
for indexes, values in next, admin do
tfm.exec.setNameColor(admin[indexes], 0xC20400)
end
or
Code Lua

1
2
3
4
admin= {"Themiachale#0000", "name", "name"}
for indexes = 1, #admin do -- #admin gets lenght of the table "admin"
tfm.exec.setNameColor(admin[indexes], 0xC20400)
end
Bolodefchoco
« Sénateur »
1534200120000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2943
  2
Themiachale a dit :
I need it for let them write a chat command that is all setted up already and it works...

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
local admins = {
["YourName#0000"] = true,
["YourName#0000"] = true,
["YourName#0000"] = true
}

eventChatCommand = function(player, cmd)
if admins[player] then -- Check if the user is an admin so the commands can work
if cmd == "command" then -- type !command
-- Do something
end
end
end
Themiachale
« Citoyen »
1534205640000
    • Themiachale#0000
    • Profil
    • Derniers messages
    • Tribu
#2944
  0
Ehm... with the new admin script now the command doesn't work...

a dit :
function eventChatCommand(name,command)
if command=="join" and p[name].spectator==true then
tfm.exec.respawnPlayer(name)
tfm.exec.movePlayer(name,400,320,false,0,0,false)
numplayers=numplayers+1
players[numplayers]=name
p[name].spectator=false
elseif command=="skip" and name==admin then
timestamp=os.time()
skip=true
end
end

I've used this script:
a dit :
admin= {"Themiachale#0000", "name", "name"}
for indexes, values in next, admin do
tfm.exec.setNameColor(values, 0xC20400)
end
Bolodefchoco
« Sénateur »
1534207500000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2945
  2
Themiachale a dit :
Ehm... with the new admin script now the command doesn't work...

a dit :
function eventChatCommand(name,command)
if command=="join" and p[name].spectator==true then
tfm.exec.respawnPlayer(name)
tfm.exec.movePlayer(name,400,320,false,0,0,false)
numplayers=numplayers+1
players[numplayers]=name
p[name].spectator=false
elseif command=="skip" and name==admin then
timestamp=os.time()
skip=true
end
end

I've used this script:
a dit :
admin= {"Themiachale#0000", "name", "name"}
for indexes, values in next, admin do
tfm.exec.setNameColor(values, 0xC20400)
end


a dit :

admin= {["Themiachale#0000"]=true, ["name#0000"]=true, ["name#0000"]=true}
function eventChatCommand(name,command)
if command=="join" and p[name].spectator==true then
tfm.exec.respawnPlayer(name)
tfm.exec.movePlayer(name,400,320,false,0,0,false)
numplayers=numplayers+1
players[numplayers]=name
p[name].spectator=false
elseif command=="skip" and admin[name] then
timestamp=os.time()
skip=true
end
end

Dernière modification le 1534207560000
Themiachale
« Citoyen »
1534211340000
    • Themiachale#0000
    • Profil
    • Derniers messages
    • Tribu
#2946
  0
a dit :

admin= {["Themiachale#0000"]=true, ["name#0000"]=true, ["name#0000"]=true}
function eventChatCommand(name,command)
if command=="join" and p[name].spectator==true then
tfm.exec.respawnPlayer(name)
tfm.exec.movePlayer(name,400,320,false,0,0,false)
numplayers=numplayers+1
players[numplayers]=name
p[name].spectator=false
elseif command=="skip" and admin[name] then
timestamp=os.time()
skip=true
end
end

Thanks so much.
Kerberos
« Censeur »
1534334340000
    • Kerberos#4278
    • Profil
    • Derniers messages
    • Tribu
#2947
  0
Is it possible to change map's gravity with lua? And if it is possible, how can I do?
Bolodefchoco
« Sénateur »
1534336500000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2948
  3
Kerberos a dit :
Is it possible to change map's gravity with lua? And if it is possible, how can I do?

You can load a map, get its XML, insert the gravity you want in it and load the XML
Kerberos
« Censeur »
1534339380000
    • Kerberos#4278
    • Profil
    • Derniers messages
    • Tribu
#2949
  0
Bolodefchoco a dit :
Kerberos a dit :
Is it possible to change map's gravity with lua? And if it is possible, how can I do?

You can load a map, get its XML, insert the gravity you want in it and load the XML

Thank you so much *-*
Boxofkrain
« Censeur »
1534621080000
    • Boxofkrain#0000
    • Profil
    • Derniers messages
    • Tribu
#2950
  1
I'm creating tribe house password script and I don't know how to put to the array all the new players.
Script:

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
admin = ""
password = ""
waiting = {}

function eventChatCommand(nick, com)
if com:sub(1, 7)=="setpass" and admin==nick or admin=="" then
admin = nick
password = com:sub(9)
print("[LOG] Password set successfully")
elseif com=="deletepass" and admin==nick and password~="" then
password = ""
print("[LOG] Password deleted successfully")
elseif com=="showpass" and admin==nick and password~="" then
print("[LOG] Password: ")
elseif admin==nick or admin=="" then
print("[LOG] Unknown command")
end
end

function eventNewPlayer(nick)
if password~="" then
ui.addTextArea(0, "", nick, -500, -400, 2000, 1400, 0x6a7495)
ui.addPopup(1, 2, "Password:", nick, 270, 150, 250, 100)
end
end

function eventPopupAnswer(id, nick, answer)
if id==1 and password~="" and answer==password then
ui.removeTextArea(0, nick)
print("[LOG] Player has joined the tribe house")
elseif id==1 and password~="" and answer~=password then
ui.addPopup(1, 2, "Password:", nick, 270, 150, 250, 100)
end
end

Example: Player1 sets the password and he is admin. Player2 wants to enter tribe house but he must enter the password. And I want to teleport Player2 every 500ms with eventLoop(). And this isn't problem but there are Player3, Player4 and Player5 and they should teleport every 500ms too. I tried to save new player in "waiting" array but something is wrong.

Second thing: how can I concatenate text with variables? I tried + and , operator but it doesn't work. print("Password: " + password). How can I get this effect with LUA?

Sorry if I posted in wrong thread but I couldn't find better one.
sry for my english
Bolodefchoco
« Sénateur »
1534623120000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2951
  4
Hey, your EN is not bad :P
I suggest you to put the players in a set (indexes, not values).

Code Lua

1
2
3
4
5
6
7
8
9
10
waiting = { }

eventNewPlayer = function(player)
waiting[player] = true
end

function eventPopupAnswer(id, nick, answer)
if id==1 and password~="" and answer==password then
-- Implement the line below
waiting[nick] = nil

And, to teleport them:

Code Lua

1
2
3
4
5
eventLoop = function()
for player in next, waiting do
tfm.exec.movePlayer(player, 100, 200)
end
end


To concatenate in Lua we use the operator .. . Yes, two dots.

Code Lua

1
2
local password = "test"
print("Password: " .. password)
Boxofkrain
« Censeur »
1534623540000
    • Boxofkrain#0000
    • Profil
    • Derniers messages
    • Tribu
#2952
  0
^
Thank you very much! :)
Sxeg
« Citoyen »
1534628880000
    • Sxeg#0000
    • Profil
    • Derniers messages
    • Tribu
#2953
  0
I want a double shaman on a map Pls need
Bolodefchoco
« Sénateur »
1534630980000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2954
  2
Sxeg a dit :
I want a double shaman on a map Pls need

To have two shamans in your map it must be P8 or P32.

To do so in lua: (i didn't test tho)
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
local getTwoRandomPlayers = function()
local players = { }
for k, v in next, tfm.get.room.playerList do
players[#players + 1] = k
end

if #players < 3 then
return players
else
local twoPlayers = { true, true }

local name
for i = 1, 2
repeat
name = players[math.random(#players)]
until not twoPlayers[name]
twoPlayers[name] = true
end

return twoPlayers
end
end

eventNewGame = function()
local twoPlayers = getTwoRandomPlayers()
for player in next, twoPlayers do
tfm.exec.setShaman(player)
end
end
Zekabatcannnnnh
« Citoyen »
1534668420000
    • Zekabatcannnnnh#8961
    • Profil
    • Derniers messages
#2955
  0
---i dont need anymore---

Dernière modification le 1534686120000
Awesomz
« Citoyen »
1534765320000
    • Awesomz#2736
    • Profil
    • Derniers messages
    • Tribu
#2956
  0
How can i make a text that can appear just to the player that pressed a button?
Bolodefchoco
« Sénateur »
1534768800000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2957
  4
Awesomz a dit :
How can i make a text that can appear just to the player that pressed a button?

Code Lua

1
2
3
4
5
6
7
ui.addTextArea(0, "<a href='event:button'>click", nil)

eventTextAreaCallback = function(i, n, c)
if c == "button" then
ui.addTextArea(0, "text", n)
end
end
Mutluerkek
« Citoyen »
1534785180000
    • Mutluerkek#8315
    • Profil
    • Derniers messages
    • Tribu
#2958
  0
Hi

i need help

i want this code ground's there are 10 seccond's remove and come back but same ground's have miceCollision
and i can't this help me Pls THX :3

Code a dit :


ayar={timer=0}
function eventNewGame()
ayar.timer=0
mapxml=tfm.get.room.xmlMapInfo.xml

end

tfm.exec.newGame("@7496887")
function eventLoop(n,n)

ayar.timer=ayar.timer+0.5

if ayar.timer==10 then
eventSil()
end

if ayar.timer==20 then
eventGetir()
ayar.timer=0
end
print(ayar.timer)
end

function eventSil()
for i=0,300,1 do
tfm.exec.removePhysicObject(i)
end
end

function eventGetir()
numb1 = 0
numb2 = 0
for pipis in mapxml:gmatch('<S(.-)/>') do
wrt = {}
jbd = pipis:match('P="(.-)"')
for w in (jbd..","):gmatch("([^,]*),") do
table.insert(wrt , w)
end
if wrt[1] == "1" then
opdyn = true
elseif wrt[1] == "0" then
opdyn = false
end
myx = pipis:match('X="(.-)"')
myy = pipis:match('Y="(.-)"')
myh = pipis:match('H="(.-)"')
myl = pipis:match('L="(.-)"')
myt = pipis:match('T="(.-)"')
myo = pipis:match('o="(.-)"')
myc = pipis:match('c="(.-)"')

print(jbd..myx..myy..myh..myl..myt)
print(myo)

type3 = {
type = myt,
friction = wrt[3],
restitution = wrt[4],
dynamic = opdyn,
color = "0x"..myo,
mass = wrt[2],
angle = wrt[5],
width = myl,
height = myh
}

type4 = {
type = myt,
friction = wrt[3],
restitution = wrt[4],
dynamic = opdyn,
color = "0x"..myo,
mass = wrt[2],
angle = wrt[5],
width = myl,
height = myh,
miceCollision=false
}

if not myc=="nil" then
tfm.exec.addPhysicObject(numb1,myx,myy,type4)
end

if myc=="nil" then
tfm.exec.addPhysicObject(numb2,myx,myy,type3)
end

numb1 = numb1 + 1
numb2 = numb2 + 1
end
end


not : already i want only colorful ground's

Dernière modification le 1534785240000
Bolodefchoco
« Sénateur »
1534791540000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2959
  3
I have no idea about what you want ^
Honorabilis
« Consul »
1534806540000
    • Honorabilis#0000
    • Profil
    • Derniers messages
    • Tribu
#2960
  0
Bolodefchoco a dit :
I have no idea about what you want ^

Ummm, I think, it's like... Per 10 secs a ground's collision mechanics will be changed...
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 148 / 160 › »
© Atelier801 2018

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

Version 1.27