×

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
« ‹ 125 / 160 › »
Script Requests
Onkei
« Citoyen »
1487442000000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2481
  0
Haytam a dit :
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

Code Lua

1
2
3
4
5
6
7
local text = ""

function eventChatCommand(n, cmd)
if cmd == "help" then
ui.addPopup(1, 0, text, n, 150, 100, 500, true)
end
end
Haytam
« Citoyen »
1487442660000
    • Haytam#0000
    • Profil
    • Derniers messages
    • Tribu
#2482
  0
Thanks Onkei it's work fine

i want another script that add text in chat when game start with yellow color
Saintgio
« Consul »
1487449080000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#2483
  0
Haytam a dit :
Thanks Onkei it's work fine

i want another script that add text in chat when game start with yellow color

Since tfm.exec.chatMessage is an restricted function you can use ui.setMapName() or ui.setShamanName() to displays messages.

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local mapNameTimer = 0
local time = 0

function eventNewGame()
ui.setMapName("<J>The game starts")
mapNameTimer = time/1000 + 2
end

function eventLoop(time, remaining)
local time = math.floor(time/1000)
if time == mapNameTimer then
ui.setMapName("<J>"..tfm.get.room.xmlMapInfo.author.."<BL> - "..tfm.get.room.currentMap)
end
end

tfm.exec.newGame('@4568004')
Haytam
« Citoyen »
1487450520000
    • Haytam#0000
    • Profil
    • Derniers messages
    • Tribu
#2484
  0
Saintgio i try what u add but it's nothing happen
i set image to show u what i really need

http://i.imgur.com/INpFqqz.png
Sebafrancuz
« Consul »
1487454180000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#2485
  0
Haytam a dit :
Saintgio i try what u add but it's nothing happen
i set image to show u what i really need

http://i.imgur.com/INpFqqz.png

You can't do it, it is function for Lua Team Members (tfm.exec.chatMessage() ).
Hypermousem
« Censeur »
1487499900000
    • Hypermousem#0000
    • Profil
    • Derniers messages
    • Tribu
#2486
  0
I would like to know how to make something like that:
when a player types a command, let's say "!example", a shaman object (defined in the code), for example, 1, which is small box.
So, basically, when someone types !example, a small box spawns where the player is standing.
Saintgio
« Consul »
1487502300000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#2487
  1
Hypermousem a dit :
I would like to know how to make something like that:
when a player types a command, let's say "!example", a shaman object (defined in the code), for example, 1, which is small box.
So, basically, when someone types !example, a small box spawns where the player is standing.

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
local id = 1 --Shaman object

function getPos(name)
return tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y
end

function eventChatCommand(name, command)
local x, y = getPos(name)
if command == "example" then
tfm.exec.addShamanObject(id,x,y+10)
end
end
Hypermousem
« Censeur »
1487510280000
    • Hypermousem#0000
    • Profil
    • Derniers messages
    • Tribu
#2488
  0
Saintgio a dit :
Hypermousem a dit :
I would like to know how to make something like that:
when a player types a command, let's say "!example", a shaman object (defined in the code), for example, 1, which is small box.
So, basically, when someone types !example, a small box spawns where the player is standing.

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
local id = 1 --Shaman object

function getPos(name)
return tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y
end

function eventChatCommand(name, command)
local x, y = getPos(name)
if command == "example" then
tfm.exec.addShamanObject(id,x,y+10)
end
end

Thanks! ^^
Dagaker
« Censeur »
1487526600000
    • Dagaker#3257
    • Profil
    • Derniers messages
#2489
  0
I need a script that will allow me to spawn the sham portals anywhere without the portals disappearing.
Turce1st
« Censeur »
1487599140000
    • Turce1st#4618
    • Profil
    • Derniers messages
#2490
  0
how can i create a shop
and i'm want add points when the player wins
Azox
« Citoyen »
1487600940000
    • Azox#6250
    • Profil
    • Derniers messages
#2491
  0
when i die this respawn me again and this text area apper
http://www9.0zz0.com/2017/02/20/17/966548713.png
Onkei
« Citoyen »
1487621520000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2492
  0
  • Mmmm123
  • Sodokofo
Mmmm123 a dit :
how can i create a shop
and i'm want add points when the player wins

This was made for somebody else and is very closely based on Shamousey's shop from a few posts ago

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
--[[
How to add a new item to the shop;
Firstly, decide what name and cost you would like to give the item. Make sure the name is descriptive.

Secondly, decide what you want the item to give you once bought.

For this example, I'll choose Meep and 25 as the name and cost of the item, and I'll evoke tfm.exec.giveMeep whenever someone buys the item.

Now, follow this layout to create your item into the shop;
{n = "ItemName", cost = costOfItem, effect = function(n) InsertCodeToDoWhateverYouWantTheItemToDoOnceBought end},
{n = "Meep", cost = 25, effect = function(n) tfm.exec.giveMeep(n) end},

And that's it!
]]

local keys = {space = 32}
local places = 0
local players = {}

local shop = {
{n = "Meep (Spacebar to use)",
cost = 25,
effect = function(n)
tfm.exec.giveMeep(n)
end,
},
{n = "Speed (Spacebar to use)",
cost = 60,
effect = function(n)
tfm.exec.bindKeyboard(n, keys.space, true, true)
end,
},
}

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

function showShop(n)
if players[n].openShop then
local shopStr = ""
for i, item in pairs(shop) do
shopStr = "<a href='event:shop_"..i.."'>["..item.cost.."] "..item.n.."</a><br>"..shopStr
end

ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:close'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
ui.addTextArea(1, "<br><br>"..shopStr, n, 250, 80, 300, 200, 0x324650, 0x5d7d90, 1, true)
ui.addTextArea(2, "<font size='14' face='Calibri'><p align='center'>Shop", n, 250, 80, 298, 20, 0x212e35, 0x5d7d90, 1, true)
ui.addTextArea(3, "<font size='16' face='Calibri'><p align='center'><a href='event:close'><v>X", n, 520, 78, 29, 29, 0x324650, 0x000000, 0, true)
else
ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:open'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
end
end

function eventNewGame()
places = 0
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
if key == keys.space then
local dir = data.isFacingRight and 1 or -1

tfm.exec.movePlayer(n, 0, 0, false, 80 * dir, 0, false)
tfm.exec.bindKeyboard(n, keys.space, true, false)
end
end

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

places = places + 1

if places == 1 then
player.coins = player.coins + 20
elseif places == 2 then
player.coins = player.coins + 15
elseif places == 3 then
player.coins = player.coins + 5
end
showShop(n)
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {
coins = 0,
openShop = false,
}
end
showShop(n)
end

function eventTextAreaCallback(id, n, cb)
local player = players[n]

if cb == "close" then
for i = 0, 3, 1 do
ui.removeTextArea(i, n)
end
player.openShop = false
elseif cb == "open" then
player.openShop = true
elseif cb:sub(1, 4) == "shop" then
local i = tonumber(cb:sub(6))
local item = shop[i]
if item.cost <= player.coins then
player.coins = player.coins - item.cost
if item.effect then item.effect(n) end
end
end
showShop(n)
end

main()

Sodokofo a dit :
when i die this respawn me again and this text area apper
http://www9.0zz0.com/2017/02/20/17/966548713.png

I added a respawn feature that you may not have wanted, so just remove some bits of the code appropriately by yourself if you don't want them.

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
local tasks = {}

function table.copy(t1)
local t2 = {}
for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function eventLoop()
local now = os.time()

for when, task in pairs(table.copy(tasks)) do
if when <= now then
task()
tasks[when] = nil
end
end
end

function eventPlayerDied(n)
local data = tfm.get.room.playerList[n]
local rand = math.random

local coords = {x = rand(data.x - 20, data.x + 20), y = rand(data.y - 20, data.y + 20)}
ui.addTextArea(0, "You'll respawn here in a moment.", n, coords.x - 100, data.y - 30, nil, 30, 0x324650, 0x000000, 0.8, true)

tasks[os.time() + 5000] = function() tfm.exec.respawnPlayer(n) tfm.exec.movePlayer(n, coords.x, coords.y) ui.removeTextArea(0, n) end;
end

Turce1st
« Censeur »
1487845380000
    • Turce1st#4618
    • Profil
    • Derniers messages
#2493
  0
Onkei a dit :
[#Mmmm123]
Mmmm123 a dit :
how can i create a shop
and i'm want add points when the player wins

This was made for somebody else and is very closely based on Shamousey's shop from a few posts ago

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
--[[
How to add a new item to the shop;
Firstly, decide what name and cost you would like to give the item. Make sure the name is descriptive.

Secondly, decide what you want the item to give you once bought.

For this example, I'll choose Meep and 25 as the name and cost of the item, and I'll evoke tfm.exec.giveMeep whenever someone buys the item.

Now, follow this layout to create your item into the shop;
{n = "ItemName", cost = costOfItem, effect = function(n) InsertCodeToDoWhateverYouWantTheItemToDoOnceBought end},
{n = "Meep", cost = 25, effect = function(n) tfm.exec.giveMeep(n) end},

And that's it!
]]

local keys = {space = 32}
local places = 0
local players = {}

local shop = {
{n = "Meep (Spacebar to use)",
cost = 25,
effect = function(n)
tfm.exec.giveMeep(n)
end,
},
{n = "Speed (Spacebar to use)",
cost = 60,
effect = function(n)
tfm.exec.bindKeyboard(n, keys.space, true, true)
end,
},
}

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

function showShop(n)
if players[n].openShop then
local shopStr = ""
for i, item in pairs(shop) do
shopStr = "<a href='event:shop_"..i.."'>["..item.cost.."] "..item.n.."</a><br>"..shopStr
end

ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:close'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
ui.addTextArea(1, "<br><br>"..shopStr, n, 250, 80, 300, 200, 0x324650, 0x5d7d90, 1, true)
ui.addTextArea(2, "<font size='14' face='Calibri'><p align='center'>Shop", n, 250, 80, 298, 20, 0x212e35, 0x5d7d90, 1, true)
ui.addTextArea(3, "<font size='16' face='Calibri'><p align='center'><a href='event:close'><v>X", n, 520, 78, 29, 29, 0x324650, 0x000000, 0, true)
else
ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:open'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
end
end

function eventNewGame()
places = 0
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
if key == keys.space then
local dir = data.isFacingRight and 1 or -1

tfm.exec.movePlayer(n, 0, 0, false, 80 * dir, 0, false)
tfm.exec.bindKeyboard(n, keys.space, true, false)
end
end

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

places = places + 1

if places == 1 then
player.coins = player.coins + 20
elseif places == 2 then
player.coins = player.coins + 15
elseif places == 3 then
player.coins = player.coins + 5
end
showShop(n)
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {
coins = 0,
openShop = false,
}
end
showShop(n)
end

function eventTextAreaCallback(id, n, cb)
local player = players[n]

if cb == "close" then
for i = 0, 3, 1 do
ui.removeTextArea(i, n)
end
player.openShop = false
elseif cb == "open" then
player.openShop = true
elseif cb:sub(1, 4) == "shop" then
local i = tonumber(cb:sub(6))
local item = shop[i]
if item.cost <= player.coins then
player.coins = player.coins - item.cost
if item.effect then item.effect(n) end
end
end
showShop(n)
end

main()

[/#Mmmm123]

[#Sodokofo]
Sodokofo a dit :
when i die this respawn me again and this text area apper
http://www9.0zz0.com/2017/02/20/17/966548713.png

I added a respawn feature that you may not have wanted, so just remove some bits of the code appropriately by yourself if you don't want them.

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
local tasks = {}

function table.copy(t1)
local t2 = {}
for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function eventLoop()
local now = os.time()

for when, task in pairs(table.copy(tasks)) do
if when <= now then
task()
tasks[when] = nil
end
end
end

function eventPlayerDied(n)
local data = tfm.get.room.playerList[n]
local rand = math.random

local coords = {x = rand(data.x - 20, data.x + 20), y = rand(data.y - 20, data.y + 20)}
ui.addTextArea(0, "You'll respawn here in a moment.", n, coords.x - 100, data.y - 30, nil, 30, 0x324650, 0x000000, 0.8, true)

tasks[os.time() + 5000] = function() tfm.exec.respawnPlayer(n) tfm.exec.movePlayer(n, coords.x, coords.y) ui.removeTextArea(0, n) end;
end

[/#Sodokofo]

Hello my friend can you made shop when the player
Win he collect some money ,-,
And add this
Meep 250 $
Double jump 750 $
Fly 20 seconds 1200 $
Around with mouse 2000 $
And all once in the round


And thank you y
Onkei - chan
Onkei
« Citoyen »
1487850060000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2494
  0
Mmmm123 a dit :
Hello my friend can you made shop when the player
Win he collect some money ,-,
And add this
Meep 250 $
Double jump 750 $
Fly 20 seconds 1200 $
Around with mouse 2000 $
And all once in the round

And thank you y
Onkei - chan

This gives the winner (the first player in the hole) 500 coins every round, I'm not sure what you mean by Around with mouse so I didn't add it

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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
--[[
How to add a new item to the shop;
Firstly, decide what name and cost you would like to give the item. Make sure the name is descriptive.

Secondly, decide what you want the item to give you once bought.

For this example, I'll choose Meep and 25 as the name and cost of the item, and I'll evoke tfm.exec.giveMeep whenever someone buys the item.

Now, follow this layout to create your item into the shop;
{n = "ItemName", cost = costOfItem, effect = function(n) InsertCodeToDoWhateverYouWantTheItemToDoOnceBought end},
{n = "Meep", cost = 25, effect = function(n) tfm.exec.giveMeep(n) end},

And that's it!
]]

local keys = {space = 32, up = 38, w = 87}
local places = 0
local players = {}
local tasks = {}

local settings = {
pointsGottenFromWinning = 500,

upKeys = {[keys.up] = true, [keys.w] = true},
}

local shop = {
{n = "Meep (Spacebar)",
cost = 250,
effect = function(n)
tfm.exec.giveMeep(n)
end,
},
{n = "Double Jump (Double-click up/w)",
cost = 750,
effect = function(n)
tfm.exec.bindKeyboard(n, keys.up, true, true)
tfm.exec.bindKeyboard(n, keys.w, true, true)
end,
},
{n = "Fly for 20s (Spamclick Spacebar)",
cost = 1200,
effect = function(n)
tfm.exec.bindKeyboard(n, keys.space, true, true)
tasks[os.time() + 20 * 1000] = function() tfm.exec.bindKeyboard(n, keys.space, true, false) end;
end,
},
}

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

function showShop(n)
if players[n].openShop then
local shopStr = ""
for i, item in pairs(shop) do
shopStr = "<a href='event:shop_"..i.."'>["..item.cost.."] "..item.n.."</a><br>"..shopStr
end

ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:close'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
ui.addTextArea(1, "<br><br>"..shopStr, n, 250, 80, 300, 200, 0x324650, 0x5d7d90, 1, true)
ui.addTextArea(2, "<font size='14' face='Calibri'><p align='center'>Shop", n, 250, 80, 298, 20, 0x212e35, 0x5d7d90, 1, true)
ui.addTextArea(3, "<font size='16' face='Calibri'><p align='center'><a href='event:close'><v>X", n, 520, 78, 29, 29, 0x324650, 0x000000, 0, true)
else
ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:open'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
end
end

function table.copy(t1)
local t2 = {}
for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function eventNewGame()
places = 0
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
if key == keys.space then
tfm.exec.movePlayer(n, 0, 0, false, 0, -60, false)
elseif settings.upKeys[key] then
if data.isJumping then
tfm.exec.movePlayer(n, 0, 0, false, 0, -60, false)
data.isJumping = false

tfm.exec.bindKeyboard(n, keys.up, true, false)
tfm.exec.bindKeyboard(n, keys.w, true, false)
end
data.isJumping = true
end
end

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

places = places + 1

if places == 1 then
player.coins = player.coins + settings.pointsGottenFromWinning
elseif places == 2 then
player.coins = player.coins + settings.pointsGottenFromWinning - 5
elseif places == 3 then
player.coins = player.coins + settings.pointsGottenFromWinning - 10
end
showShop(n)
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {
coins = 0,
openShop = false,
}
end
showShop(n)
end

function eventLoop()
local now = os.time()

for when, task in pairs(table.copy(tasks)) do
if when <= now then
task()
tasks[when] = nil
end
end
end

function eventTextAreaCallback(id, n, cb)
local player = players[n]

if cb == "close" then
for i = 0, 3, 1 do
ui.removeTextArea(i, n)
end
player.openShop = false
elseif cb == "open" then
player.openShop = true
elseif cb:sub(1, 4) == "shop" then
local i = tonumber(cb:sub(6))
local item = shop[i]
if item.cost <= player.coins then
player.coins = player.coins - item.cost
if item.effect then item.effect(n) end
end
end
showShop(n)
end

main()
Turce1st
« Censeur »
1487863020000
    • Turce1st#4618
    • Profil
    • Derniers messages
#2495
  0
Onkei a dit :
Mmmm123 a dit :
Hello my friend can you made shop when the player
Win he collect some money ,-,
And add this
Meep 250 $
Double jump 750 $
Fly 20 seconds 1200 $
Around with mouse 2000 $
And all once in the round

And thank you y
Onkei - chan

This gives the winner (the first player in the hole) 500 coins every round, I'm not sure what you mean by Around with mouse so I didn't add it

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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
--[[
How to add a new item to the shop;
Firstly, decide what name and cost you would like to give the item. Make sure the name is descriptive.

Secondly, decide what you want the item to give you once bought.

For this example, I'll choose Meep and 25 as the name and cost of the item, and I'll evoke tfm.exec.giveMeep whenever someone buys the item.

Now, follow this layout to create your item into the shop;
{n = "ItemName", cost = costOfItem, effect = function(n) InsertCodeToDoWhateverYouWantTheItemToDoOnceBought end},
{n = "Meep", cost = 25, effect = function(n) tfm.exec.giveMeep(n) end},

And that's it!
]]

local keys = {space = 32, up = 38, w = 87}
local places = 0
local players = {}
local tasks = {}

local settings = {
pointsGottenFromWinning = 500,

upKeys = {[keys.up] = true, [keys.w] = true},
}

local shop = {
{n = "Meep (Spacebar)",
cost = 250,
effect = function(n)
tfm.exec.giveMeep(n)
end,
},
{n = "Double Jump (Double-click up/w)",
cost = 750,
effect = function(n)
tfm.exec.bindKeyboard(n, keys.up, true, true)
tfm.exec.bindKeyboard(n, keys.w, true, true)
end,
},
{n = "Fly for 20s (Spamclick Spacebar)",
cost = 1200,
effect = function(n)
tfm.exec.bindKeyboard(n, keys.space, true, true)
tasks[os.time() + 20 * 1000] = function() tfm.exec.bindKeyboard(n, keys.space, true, false) end;
end,
},
}

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

function showShop(n)
if players[n].openShop then
local shopStr = ""
for i, item in pairs(shop) do
shopStr = "<a href='event:shop_"..i.."'>["..item.cost.."] "..item.n.."</a><br>"..shopStr
end

ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:close'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
ui.addTextArea(1, "<br><br>"..shopStr, n, 250, 80, 300, 200, 0x324650, 0x5d7d90, 1, true)
ui.addTextArea(2, "<font size='14' face='Calibri'><p align='center'>Shop", n, 250, 80, 298, 20, 0x212e35, 0x5d7d90, 1, true)
ui.addTextArea(3, "<font size='16' face='Calibri'><p align='center'><a href='event:close'><v>X", n, 520, 78, 29, 29, 0x324650, 0x000000, 0, true)
else
ui.addTextArea(0, "<font size='12' face='Wingdings'><p align='center'><a href='event:close'><rose><a href='event:open'>z <font size='12' face='Calibri'>"..players[n].coins, n, 10, 30, 60, 19, 0x212e35, 0x5d7d90, 0.5, true)
end
end

function table.copy(t1)
local t2 = {}
for k, v in pairs(t1) do
t2[k] = v
end
return t2
end

function eventNewGame()
places = 0
end

function eventKeyboard(n, key, down, x, y)
local data = tfm.get.room.playerList[n]
if key == keys.space then
tfm.exec.movePlayer(n, 0, 0, false, 0, -60, false)
elseif settings.upKeys[key] then
if data.isJumping then
tfm.exec.movePlayer(n, 0, 0, false, 0, -60, false)
data.isJumping = false

tfm.exec.bindKeyboard(n, keys.up, true, false)
tfm.exec.bindKeyboard(n, keys.w, true, false)
end
data.isJumping = true
end
end

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

places = places + 1

if places == 1 then
player.coins = player.coins + settings.pointsGottenFromWinning
elseif places == 2 then
player.coins = player.coins + settings.pointsGottenFromWinning - 5
elseif places == 3 then
player.coins = player.coins + settings.pointsGottenFromWinning - 10
end
showShop(n)
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {
coins = 0,
openShop = false,
}
end
showShop(n)
end

function eventLoop()
local now = os.time()

for when, task in pairs(table.copy(tasks)) do
if when <= now then
task()
tasks[when] = nil
end
end
end

function eventTextAreaCallback(id, n, cb)
local player = players[n]

if cb == "close" then
for i = 0, 3, 1 do
ui.removeTextArea(i, n)
end
player.openShop = false
elseif cb == "open" then
player.openShop = true
elseif cb:sub(1, 4) == "shop" then
local i = tonumber(cb:sub(6))
local item = shop[i]
if item.cost <= player.coins then
player.coins = player.coins - item.cost
if item.effect then item.effect(n) end
end
end
showShop(n)
end

main()

thank you i'm added the around but i'm need
when click (h) shot this
but he don't very fast and when he touch the mice it's kill mice
Massi
« Consul »
1488044220000
    • Massi#0095
    • Profil
    • Derniers messages
    • Tribu
#2496
  0
how can i made welcome textarea :p
Nihatsune
« Citoyen »
1488046860000
    • Nihatsune#1106
    • Profil
    • Derniers messages
    • Tribu
#2497
  0
Give me script Profile pls?
!stats me
or
!profile me
Intasmg
« Citoyen »
1488047100000
    • Intasmg#0000
    • Profil
    • Derniers messages
    • Tribu
#2498
  0
Unlocker001 a dit :
how can i made welcome textarea :p

Code Lua

1
2
3
function eventNewPlayer(name)
ui.addTextArea (0, "Your welcome message here", name, 200, 300)
end
Onkei
« Citoyen »
1488049440000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2499
  0
Fulgermacuin a dit :
Give me script Profile pls?
!stats me
or
!profile me

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
local places = 0
local players = {}

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

function tfm.get.room.shaman()
for n, data in pairs(tfm.get.room.playerList) do
if data.isShaman then return n end
end
return nil
end

function eventNewGame()
places = 0
end

function eventPlayerWon(n)
local player = players[n]
places = places + 1

if places == 1 then
player.stats.Firsts = player.stats.Firsts + 1
end
player.stats.Cheese = player.stats.Cheese + 1

local shaman = tfm.get.room.shaman()
local player2 = players[shaman]
player2.stats.Saves = player2.stats.Saves + 1
end

function eventPlayerDied(n)
players[n].stats.Deaths = players[n].stats.Deaths + 1
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {
stats = {
Saves = 0,
Firsts = 0,
Cheese = 0,
Deaths = 0,
},
}
end

eventChatCommand(n, "stats")
end

function eventChatCommand(n, cmd)
local arg = {}
for args in cmd:gmatch("[^%s]+") do
table.insert(arg, args:lower())
end

if arg[1] == "stats" then
local player = players[n]
local n2 = arg[2] and tostring(arg[2]) or n
if n2 ~= "" and players[n2] then
player = players[n2]
end

local str = ""
for stat, num in pairs(player.stats) do
str = str..""..stat.." - "..num.."<br>"
end

ui.addPopup(1, 0, "<font size='15' face='Calibri'><p align='center'>Stats for <b>"..n2.."</b></p><br>"..str, n, 250, 100, 300, true)
elseif arg[1] == "profile" then
local n2 = arg[2]
eventChatCommand(n, "stats "..n2)
end
end

main()

Dernière modification le 1488049860000
Kingkomand2o
« Consul »
1488086220000
    • Kingkomand2o#0000
    • Profil
    • Derniers messages
    • Tribu
#2500
  0
How can i put more than 1 language in the script
Example :
!lang en
to submit the English language ?
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 125 / 160 › »
© Atelier801 2018

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

Version 1.27