×

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
« ‹ 124 / 160 › »
Script Requests
Kingkomand2o
« Consul »
1486722480000
    • Kingkomand2o#0000
    • Profil
    • Derniers messages
    • Tribu
#2461
  0
how to make 2 bind keyboard in one key ?
Saintgio
« Consul »
1486726680000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#2462
  0
Kingkomand2o a dit :
how to make 2 bind keyboard in one key ?

Maybe this can help

Code Lua

1
2
3
4
local name = "Kingkomand2o"
for keys, k in pairs({32,80}) do
tfm.exec.bindKeyboard(name, k, true, true)
end
Onkei
« Citoyen »
1486735260000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2463
  0
Unlocker001 a dit :
No this is a list of players name in room I don't need this
I need list of names for example
List of planet <
Earth when I click on Earth = change map to @7046447
...
Etc

Try this

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
--[[
How to add a new "name" to the list;
1. Decide what name and what code you want.
2. Once you've decided, put the following name in the format below, for this example I'll use Earth;
["Name"]
["Earth"]
3. Afterwards, you put your corresponding code like below, I'll use 7046447.
["Name"] = code
["Earth"] = 7046447
4. Don't forget to add a comma!
["Name"] = code,
["Earth"] = 7046447,
]]

local list = {
["Earth"] = 7046447,
}

local admin = {Onkei = true, Unlocker001 = true}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function showPopup(n)
if admin[n] then
ui.addTextArea(0, "<p align='center'><font size='20'><a href='event:list'>List of Names", n, 10, 20, 200, 30, 0x324650, 0x000000, 1, true)
end
end

function eventNewPlayer(n)
showPopup(n)
end

function eventTextAreaCallback(id, n, cb)
if tonumber(cb) then
tfm.exec.newGame(cb)
elseif cb == "close" then
ui.removeTextArea(0, n)
ui.removeTextArea(1, n)
showPopup(n)
else
eventChatCommand(n, cb)
end
end

function eventChatCommand(n, cmd)
if admin[n] then
if cmd == "list" or cmd:sub(1, 6) == "player" then
local str = ""
for name, code in pairs(list) do
str = str.."<a href='event:"..code.."'>"..name.."</a><br>"
end
ui.addTextArea(0, str, n, 10, 20, 200, 300, 0x324650, 0x000000, 1, true)
ui.addTextArea(1, "<p align='center'><font size='20'><a href='event:close'>X", n, 170, 290, 39, 39, 0x324650, 0x000000, 0, true)
end
end
end

main()

Dernière modification le 1486750440000
Dagaker
« Censeur »
1486747500000
    • Dagaker#3257
    • Profil
    • Derniers messages
#2464
  0
I need a code that will allow me to spawn a ground and when i step on it, it will turn me into sham.

Idk if this is possble :/

Dernière modification le 1486747560000
Onkei
« Citoyen »
1486749900000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2465
  0
Tukushii a dit :
I need a code that will allow me to spawn a ground and when i step on it, it will turn me into sham.

Idk if this is possble :/

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
local admin = {Onkei = true, Tukushii = true}
local grounds = {}

local settings = {
groundHeight = 40,
groundWidth = 40,
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function isOnGround(n, ground)
local data = tfm.get.room.playerList[n]

local yCoordinateToStandOn = (ground.y - settings.groundHeight / 2) - 15
local diff = math.abs(yCoordinateToStandOn - data.y)
if (data.x > ground.x - settings.groundWidth / 2) and (data.x < ground.x + settings.groundWidth / 2) and (diff < 2) then return true end

return false
end

local removeRect = tfm.exec.removePhysicObject
function rect(id, x, y, w, h, c)
tfm.exec.addPhysicObject(
id,
x,
y,
{type = 12,
width = w,
height = h,
color = c or 0x324650,
friction = 0.2,
restitution = 0.3,
foreground = false}
)
end

function eventNewGame()
grounds = {}
end

function eventMouse(n, x, y)
local data = tfm.get.room.playerList[n]
local ground = {id = data.id, x = x, y = y, show = true}

rect(data.id, x, y, settings.groundHeight, settings.groundWidth)
table.insert(grounds, ground)
end

function eventLoop(passed, left)
for i, ground in pairs(grounds) do
if ground.show then
for n, data in pairs(tfm.get.room.playerList) do
if admin[n] and data.id == ground.id and isOnGround(n, ground) then
tfm.exec.setShaman(n)

removeRect(ground.id)
ground.show = false
break
end
end
end
end
end

function eventNewPlayer(n)
if admin[n] then
system.bindMouse(n, true)
end
end

main()

Dernière modification le 1486750380000
Dagaker
« Censeur »
1486755360000
    • Dagaker#3257
    • Profil
    • Derniers messages
#2466
  0
Onkei a dit :
Tukushii a dit :
I need a code that will allow me to spawn a ground and when i step on it, it will turn me into sham.

Idk if this is possble :/

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
local admin = {Onkei = true, Tukushii = true}
local grounds = {}

local settings = {
groundHeight = 40,
groundWidth = 40,
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function isOnGround(n, ground)
local data = tfm.get.room.playerList[n]

local yCoordinateToStandOn = (ground.y - settings.groundHeight / 2) - 15
local diff = math.abs(yCoordinateToStandOn - data.y)
if (data.x > ground.x - settings.groundWidth / 2) and (data.x < ground.x + settings.groundWidth / 2) and (diff < 2) then return true end

return false
end

local removeRect = tfm.exec.removePhysicObject
function rect(id, x, y, w, h, c)
tfm.exec.addPhysicObject(
id,
x,
y,
{type = 12,
width = w,
height = h,
color = c or 0x324650,
friction = 0.2,
restitution = 0.3,
foreground = false}
)
end

function eventNewGame()
grounds = {}
end

function eventMouse(n, x, y)
local data = tfm.get.room.playerList[n]
local ground = {id = data.id, x = x, y = y, show = true}

rect(data.id, x, y, settings.groundHeight, settings.groundWidth)
table.insert(grounds, ground)
end

function eventLoop(passed, left)
for i, ground in pairs(grounds) do
if ground.show then
for n, data in pairs(tfm.get.room.playerList) do
if admin[n] and data.id == ground.id and isOnGround(n, ground) then
tfm.exec.setShaman(n)

removeRect(ground.id)
ground.show = false
break
end
end
end
end
end

function eventNewPlayer(n)
if admin[n] then
system.bindMouse(n, true)
end
end

main()

Can you make it like a click so when you spawn it than you click on it?
Onkei
« Citoyen »
1486760760000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2467
  0
Tukushii a dit :
Can you make it like a click so when you spawn it than you click on it?

I don't really understand what you mean, could you elaborate?
Dagaker
« Censeur »
1486761240000
    • Dagaker#3257
    • Profil
    • Derniers messages
#2468
  0
Onkei a dit :
Tukushii a dit :
Can you make it like a click so when you spawn it than you click on it?

I don't really understand what you mean, could you elaborate?

I want the sham thing to appear when i click on the ground.
Onkei
« Citoyen »
1486762860000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2469
  0
Tukushii a dit :
I want the sham thing to appear when i click on the ground.

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
local admin = {Onkei = true, Tukushii = true}
local grounds = {}

local settings = {
groundHeight = 40,
groundWidth = 40,
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function isOnGround(n, ground)
local data = tfm.get.room.playerList[n]

local yCoordinateToStandOn = (ground.y - settings.groundHeight / 2) - 15
local diff = math.abs(yCoordinateToStandOn - data.y)
if (data.x > ground.x - settings.groundWidth / 2) and (data.x < ground.x + settings.groundWidth / 2) and (diff < 2) then return true end

return false
end

local removeRect = tfm.exec.removePhysicObject
function rect(id, x, y, w, h, c)
tfm.exec.addPhysicObject(
id,
x,
y,
{type = 12,
width = w,
height = h,
color = c or 0x324650,
friction = 0.2,
restitution = 0.3,
foreground = false}
)
end

function eventNewGame()
grounds = {}
end

function eventMouse(n, x, y)
local data = tfm.get.room.playerList[n]
local ground = {id = data.id, x = x, y = y, show = true}

rect(data.id, x, y, settings.groundWidth, settings.groundHeight)
ui.addTextArea(data.id, "<font size='30' face='Wingdings'><a href='event:"..data.id.."'>v", n, x - 15, y - 15, settings.groundHeight, settings.groundWidth, 0x324650, 0x000000, 0, true)
table.insert(grounds, ground)
end

function eventTextAreaCallback(id, n, cb)
local data = tfm.get.room.playerList[n]

for i, ground in pairs(grounds) do
if ground.show and id == ground.id then
if admin[n] and data.id == ground.id and isOnGround(n, ground) then
tfm.exec.setShaman(n)

removeRect(ground.id)
ui.removeTextArea(ground.id, n)
ground.show = false
break
end
end
end
end

function eventNewPlayer(n)
if admin[n] then
system.bindMouse(n, true)
end
end

main()
Yolohackers
« Citoyen »
1486823100000
    • Yolohackers#0000
    • Profil
    • Derniers messages
    • Tribu
#2470
  0
Can i get a lua where i can throw 10 snowballs in front of me like in ratapult but with snowball while pressing "E"
Onkei
« Citoyen »
1486825440000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2471
  0
Yolohackers a dit :
Can i get a lua where i can throw 10 snowballs in front of me like in ratapult but with snowball while pressing "E"

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
local keys = {space = 32, left = 37, right = 39, a = 65, d = 68, e = 69, q = 81}
local players = {}

local settings = {
throwKeys = {[keys.e] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function setKeys(n)
for i, key in pairs(keys) do
tfm.exec.bindKeyboard(n, key, true, true)
end
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
local player = players[n]
if not data.isDead then
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
end
end
end

function eventNewPlayer(n)
players[n] = {direction = 1}
setKeys(n)
end

main()
Dramacorn
« Consul »
1486836480000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#2472
  0
Dramatotala a dit :
Dramatotala a dit :
Hi, I'm looking for a script that you can give powers gender Mice
admin: dramatotala and kmaaz when one of them write! Powers x have the power to give or spawn objects! y fly fly (like utility for example)


Please i need !!
Haytam
« Citoyen »
1486843560000
    • Haytam#0000
    • Profil
    • Derniers messages
    • Tribu
#2473
  0
a dit :

looking for a good script to life bar when you hit the balls, objects and other things shaman to drop you a certain number of 0 to par of life and life is attempted die

I made some assumptions that you wanted the object to only damage you if they were moving

please you can fix that for me i want when i shot you white snowball i make damage
i use script but Health go down when i shot enemy i want when i shot enemy i make he's Health go down not me
this is my script


local defaultMaxHealth = 100
local defaultObjectDamage = 2

local players = {}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function pythag(x1, y1, x2, y2, r)
local x = x2 - x1
local y = y2 - y1
local r = r + r
return x * x + y * y < r * r
end

function showHealthBar(n)
local player = players[n]

local healthLen = math.floor(tonumber(player.health) * (250 / defaultMaxHealth))
if healthLen < 80 then healthLen = 80 elseif healthLen > 250 then healthLen = 250 end

ui.addTextArea(0, "", n, 10, 25, 250, 20, 0x324650, 0x89a7f5, 0.7, true)
ui.addTextArea(1, "<p align='center'>"..player.health.." Health", n, 10, 25, healthLen, 20, 0x171918, 0x171918, 0.5, true)
end

function eventLoop()
for i, object in pairs(tfm.get.room.objectList) do
for n, data in pairs(tfm.get.room.playerList) do
if pythag(object.x, object.y, data.x, data.y, 50) and (math.abs(object.vx) > 2 or math.abs(object.vy) > 2) then
local player = players[n]
if player then
player.health = player.health - defaultObjectDamage
-- player.health = player.health - math.abs(object.vx) - math.abs(object.vy) - defaultObjectDamage

if player.health <= 0 then tfm.exec.killPlayer(n) end
showHealthBar(n)
end
end
end
end
end

function eventNewGame()
for n in pairs(tfm.get.room.playerList) do
eventPlayerRespawn(n)
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {health = defaultMaxHealth}
end
showHealthBar(n)
end

function eventPlayerDied(n)
players[n].health = 0
showHealthBar(n)
end

function eventPlayerRespawn(n)
players[n].health = defaultMaxHealth
showHealthBar(n)
end

main()

local keys = {space = 32, left = 37, right = 39, a = 65, d = 68, e = 69, q = 81}
local players = {}

local settings = {
throwKeys = {[keys.e] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function setKeys(n)
for i, key in pairs(keys) do
tfm.exec.bindKeyboard(n, key, true, true)
end
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
local player = players[n]
if not data.isDead then
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
end
end
end

function eventNewPlayer(n)
players[n] = {direction = 1}
setKeys(n)
end

main()

function eventPlayerDied(n)
local i=0
local n
for pname,player in pairs(tfm.get.room.playerList) do
if not player.isDead then
i=i+1
n=pname
end
end
if i==0 then
tfm.exec.newGame(maps[math.random(#maps)])
elseif i==1 then
tfm.exec.setGameTime(5)
tfm.exec.giveCheese(n)
tfm.exec.playerVictory(n)
tfm.exec.setUIShamanName("Get ready..")
tfm.exec.setUIMapName("pow's wars")

end
end
Onkei
« Citoyen »
1486902960000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2474
  0
  • Haytam
  • Dramatotala
Haytam a dit :
please you can fix that for me i want when i shot you white snowball i make damage
i use script but Health go down when i shot enemy i want when i shot enemy i make he's Health go down not me
this is my script

I didn't test this very much, so tell me if you're having issues

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
local defaultMaxHealth = 100
local defaultObjectDamage = 2

local keys = {space = 32, left = 37, right = 39, a = 65, d = 68, e = 69, q = 81}
local players = {}
local objects = {}

local settings = {
throwKeys = {[keys.e] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function pythag(x1, y1, x2, y2, r)
local x = x2 - x1
local y = y2 - y1
local r = r + r
return x * x + y * y < r * r
end

function setKeys(n)
for i, key in pairs(keys) do
tfm.exec.bindKeyboard(n, key, true, true)
end
end

function showHealthBar(n)
local player = players[n]

local healthLen = math.floor(tonumber(player.health) * (250 / defaultMaxHealth))
if healthLen < 80 then healthLen = 80 elseif healthLen > 250 then healthLen = 250 end

ui.addTextArea(0, "", n, 10, 25, 250, 20, 0x324650, 0x89a7f5, 0.7, true)
ui.addTextArea(1, "<p align='center'>"..player.health.." Health", n, 10, 25, healthLen, 20, 0x171918, 0x171918, 0.5, true)
end

function eventNewGame()
for n in pairs(tfm.get.room.playerList) do
eventPlayerRespawn(n)
end
ui.setShamanName("Get ready..")
ui.setMapName("pow's wars")
end

function eventLoop()
for i, object in pairs(tfm.get.room.objectList) do
local id = object.id
if objects[id] and not objects[id].didDamage then
for n, data in pairs(tfm.get.room.playerList) do
if objects[id].spawner ~= n and pythag(object.x, object.y, data.x, data.y, 50) and (math.abs(object.vx) > 2 or math.abs(object.vy) > 2) then
local player = players[n]
if player then
player.health = player.health - defaultObjectDamage
-- player.health = player.health - math.abs(object.vx) - math.abs(object.vy) - defaultObjectDamage

if player.health <= 0 then tfm.exec.killPlayer(n) end
showHealthBar(n)
objects[id].didDamage = true
end
end
end
end
end
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
local player = players[n]
if not data.isDead then
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.throwKeys[key] then
local id = tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
objects[id] = {spawner = n, didDamage = false}
end
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {health = defaultMaxHealth, direction = 1}
end
setKeys(n)
showHealthBar(n)
end

function eventPlayerDied(n)
players[n].health = 0
showHealthBar(n)

local num, pn = 0, ""
for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead then
pn = n
num = num + 1
end
end
if num == 1 then
tfm.exec.setGameTime(5)
tfm.exec.giveCheese(pn)
tfm.exec.playerVictory(pn)
elseif num == 0 then
tfm.exec.newGame(maps[math.random(#maps)])
end
end

function eventPlayerRespawn(n)
players[n].health = defaultMaxHealth
showHealthBar(n)
end

main()

Dramatotala a dit :
Dramatotala a dit :
Dramatotala a dit :
Hi, I'm looking for a script that you can give powers gender Mice
admin: dramatotala and kmaaz when one of them write! Powers x have the power to give or spawn objects! y fly fly (like utility for example)


Please i need !!

Lua can't discriminate between genders soo....
This script uses Hakureimouse's very old object spawner thingamabob that's no longer available.

Here's the list of commands you can use from this script;
!powers [n], !unpowers [n], !fly, !help, ![object name] [dimensions].

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
local admin = {Onkei = true, Dramatotala = true, Kmaaz = true}
local miniAdmin = {}
local players = {}

local objects = {
["small box"] = {id = 1, size = 29},
["large box"] = {id = 2, size = 60},
["ball"] = {id = 6, size = 29},
["anvil"] = {id = 10, size = 30},
["cannon"] = {id = 17, size = 29},
["bomb"] = {id = 23, size = 29},
["balloon"] = {id = 28, size = 30},
["snow"] = {id = 34, size = 12},
["apple"] = {id = 39, size = 29},
["sheep"] = {id = 40, size = 30},
["frozen mouse"] = {id = 54, size = 61},
["cloud"] = {id = 57, size = 60},
["bubble"] = {id = 59, size = 34},
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function eventKeyboard(n, key, down, x, y)
if key == 32 and players[n].canFly then
tfm.exec.movePlayer(n, 0, 0, true, 0, -50, false)
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {canFly = false}
end
tfm.exec.bindKeyboard(n, 32, true, true)
end

function eventChatCommand(n, cmd)
if admin[n] then
if cmd:sub(1, 6) == "powers" then
local x = cmd:sub(8)
miniAdmin[x] = true
elseif cmd:sub(1, 8) == "unpowers" then
local x = cmd:sub(8)
miniAdmin[x] = false
end
end

if admin[n] or miniAdmin[n] then
if cmd == "fly" then
players[n].canFly = not players[n].canFly
elseif cmd == "help" then
local objectsString = "";
for o in pairs(objects) do
objectsString = objectsString .. o .. ", ";
end
objectsString = objectsString:sub(1,-3);

ui.addPopup (1,0,
"<p align='center'><b>Object Spawner by Hakureimouse<b></p><br>"..
"<p>Objects available: " .. objectsString .. ".</p><br>"..
"<p>Syntax: !objectName WIDTHxHEIGHT<p><br>"..
"<p>Examples: !small box 8x6, !apple 5x5, !balloon 20x2</p><br>"..
"<p>If total objects in a single spawn > 450, objects won't spawn, anticrashing measures</p>",
n, 200, 120, 400);
else
local object;
for s in pairs(objects) do
if cmd:find(s, 1, true) == 1 then
object = s;
break
end
end

if object == nil then return end
local objectLen = object:len();
if cmd:sub(objectLen + 1, objectLen + 1) ~= " " then return end
local parameter = cmd:sub(objectLen + 2);

local width;
local height;

for w, h in parameter:gmatch("(%d+)x(%d+)") do
width = w;
height = h;
end

if width == nil or height == nil then return end
if width * height > 450 then return end

local size = objects[object].size;
local x0 = tfm.get.room.playerList[n].x + 30 + size;
local y0 = tfm.get.room.playerList[n].y + 20 - size/2;

for j = 0, size * (height - 1), size do
for i = 0, size * (width - 1), size do
tfm.exec.addShamanObject(objects[object].id, x0 + i, y0 - j);
end
end
end
end
end

main()


Dernière modification le 1486905240000
Yolohackers
« Citoyen »
1486913940000
    • Yolohackers#0000
    • Profil
    • Derniers messages
    • Tribu
#2475
  0
Onkei a dit :
Yolohackers a dit :
Can i get a lua where i can throw 10 snowballs in front of me like in ratapult but with snowball while pressing "E"

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
local keys = {space = 32, left = 37, right = 39, a = 65, d = 68, e = 69, q = 81}
local players = {}

local settings = {
throwKeys = {[keys.e] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function setKeys(n)
for i, key in pairs(keys) do
tfm.exec.bindKeyboard(n, key, true, true)
end
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
local player = players[n]
if not data.isDead then
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
end
end
end

function eventNewPlayer(n)
players[n] = {direction = 1}
setKeys(n)
end

main()

Thanks
Yolohackers
« Citoyen »
1486914060000
    • Yolohackers#0000
    • Profil
    • Derniers messages
    • Tribu
#2476
  0
Can i get a script Where any mice or objects gets attracted to me like a magnet?
Onkei
« Citoyen »
1486928760000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2477
  0
Yolohackers a dit :
Can i get a script Where any mice or objects gets attracted to me like a magnet?

This isn't very realistic but it does the trick

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
local magnet = "Yolohackers"

local settings = {
maxVX = 150,
maxVY = 150,
}

function getSpeed(data, data2)
local abs = math.abs

local direction = {x = 1, y = 1}
if data.x < data2.x then direction.x = -1 end
if data.y < data2.y then direction.y = -1 end

local speed = {
x = abs(data.x - data2.x) / 3,
y = abs(data.y - data2.y) / 3,
}
if speed.x > settings.maxVX then speed.x = settings.maxVX end
if speed.y > settings.maxVY then speed.y = settings.maxVY end
speed.x = speed.x * direction.x
speed.y = speed.y * direction.y

return speed
end

function eventLoop()
local data = tfm.get.room.playerList[magnet]

if not data.isDead then
-- Players
for attracted, data2 in pairs(tfm.get.room.playerList) do
if attracted ~= magnet then
local speed = getSpeed(data, data2)
tfm.exec.movePlayer(attracted, 0, 0, false, speed.x, speed.y, true)
end
end

-- Objects
for attracted, data2 in pairs(tfm.get.room.objectList) do
local speed = getSpeed(data, data2)
tfm.exec.moveObject(data2.id, 0, 0, false, speed.x, speed.y, true)
end
end
end


Also this gave me an idea to make this simple mini-game

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
local magnet = ""
local timeLeft = 0

local settings = {
maxVX = 150,
maxVY = 150,
}

function getSpeed(data, data2)
local abs = math.abs

local direction = {x = 1, y = 1}
if data.x < data2.x then direction.x = -1 end
if data.y < data2.y then direction.y = -1 end

local speed = {
x = abs(data.x - data2.x) / 3,
y = abs(data.y - data2.y) / 3,
}
if speed.x > settings.maxVX then speed.x = settings.maxVX end
if speed.y > settings.maxVY then speed.y = settings.maxVY end
speed.x = speed.x * direction.x
speed.y = speed.y * direction.y

return speed
end

function main()
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableMinimalistMode(true)
tfm.exec.disablePhysicalConsumables(true)

ui.addBotText("A reverse magnet effect is applied onto the shaman each round! Bring the cheese to the hole safely!", nil)
newGame()
end

function newGame()
tfm.exec.newGame("#V")
end

local tfm_exec_newGame = tfm.exec.newGame
function tfm.exec.newGame(map)
if map == "#V" then
local vanilla = {}
for num = 0, 143 do
table.insert(vanilla, num)
end
for num = 200, 210 do
table.insert(vanilla, num)
end
tfm_exec_newGame(vanilla[math.random(#vanilla)])
else
tfm_exec_newGame(map)
end
end

function ui.addBotText(text, n)
ui.addTextArea(100, "<v>[~Soupbot]<n> "..text, n, 6, 380, nil, 30, 0x324650, 0x171918, 0.7, true)
end

function eventNewGame()
local selected = {n = "", score = 0}
for n, data in pairs(tfm.get.room.playerList) do
if data.score >= selected.score then
selected.n = n
selected.score = data.score
end
end

magnet = selected.n
tfm.exec.setShaman(magnet)

ui.setShamanName("<rose> "..magnet)
ui.addBotText("You must bring the mice to the cheese and the hole safely! A reverse magnet is applied onto you!", magnet)
end

function eventPlayerDied(n)
local num, n2 = 0, ""
for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead then num = num + 1 n2 = n end
end
if n == magnet or num <= 1 then
if timeLeft > 5 then tfm.exec.setGameTime(5) end
ui.addBotText("The shaman and the mice has failed this round!", nil)
end
end

function eventPlayerWon(n)
if n ~= magnet then
local num = 0
for n, data in pairs(tfm.get.room.playerList) do
if not data.isDead then num = num + 1 end
end
if num == 1 then
ui.addBotText("The shaman and the mice has succeeded this round!", nil)
ui.addBotText("You have succeeded! Go in the hole!", magnet)
end
elseif timeLeft > 5 then
tfm.exec.setGameTime(5)
end
end

function eventLoop(passed, left)
local data = tfm.get.room.playerList[magnet]

if data and not data.isDead then
for attracted, data2 in pairs(tfm.get.room.playerList) do
if attracted ~= magnet then
local speed = getSpeed(data, data2)
tfm.exec.movePlayer(attracted, 0, 0, false, speed.x, speed.y, true)
end
end
end

if left <= 0 then
newGame()
end

timeLeft = left / 1000
end

main()

Dernière modification le 1486930680000
Heniyengui
« Citoyen »
1487372100000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#2478
  0
Hello, I need some help. I want the player to be able to use the !join command only once. So that if count = 3 and you already did !join then count still = 3 .... Here's the code:
a dit :
count = 0
players = {}
function eventChatCommand(playerName,message)
if message=="join" and count < 10 then
table.insert(players,playerName)
count = count + 1
end
end
Onkei
« Citoyen »
1487373180000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2479
  0
Heniyengui a dit :
Hello, I need some help. I want the player to be able to use the !join command only once. So that if count = 3 and you already did !join then count still = 3 .... Here's the code:

Code Lua

1
2
3
4
5
6
7
8
9
count = 0
players = {}

function eventChatCommand(playerName, message)
if message == "join" and count < 10 and not players[n] then
count = count + 1
players[n] = true
end
end
Haytam
« Citoyen »
1487441760000
    • Haytam#0000
    • Profil
    • Derniers messages
    • Tribu
#2480
  0
Hello
i wanna code that when some one say !help in chat text pop open
i want to text visible only who say !help in chat
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 124 / 160 › »
© Atelier801 2018

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

Version 1.27