×

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
  • /
  • Cereri scripturi
« ‹ 9 / 10 › »
Cereri scripturi
Wazt
« Citoyen »
1496482200000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#161
  0
Fulgermacuin a dit :
există vreo comandă în care dacă scrii de ex !mesaj să apară un uiaddTextaArea dar cu ce mesaj vrei tu
gen ?:

!mesaj salut și să apară salut
!mesaj bună și să apară bună

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function eventChatCommand(playerName, command)
--arg[1] comanda
--arg[n] (n > 1) restul textului

--separă comanda
local arg = {}
for argument in command:gmatch("[^%s]+") do
table.insert(arg, argument)
end

if arg[1] == "mesaj" then
local message = ""
--reface propoziția
for index, word in pairs(arg) do
if index > 1 then
message = message .. " " .. word
end
end
ui.addTextArea(0, message, playerName, 5, 20, nil, nil, nil, nil, 1, false)
end
end
Prisonmaxx
« Censeur »
1496491920000
    • Prisonmaxx#0000
    • Profil
    • Derniers messages
    • Tribu
#162
  0
Fulgermacuin a dit :
există vreo comandă în care dacă scrii de ex !mesaj să apară un uiaddTextaArea dar cu ce mesaj vrei tu
gen ?:

!mesaj salut și să apară salut
!mesaj bună și să apară bună

.. te referi la !omo?
Nihatsune
« Citoyen »
1496501520000
    • Nihatsune#1106
    • Profil
    • Derniers messages
    • Tribu
#163
  1
Wazt a dit :
Fulgermacuin a dit :
există vreo comandă în care dacă scrii de ex !mesaj să apară un uiaddTextaArea dar cu ce mesaj vrei tu
gen ?:

!mesaj salut și să apară salut
!mesaj bună și să apară bună

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function eventChatCommand(playerName, command)
--arg[1] comanda
--arg[n] (n > 1) restul textului

--separă comanda
local arg = {}
for argument in command:gmatch("[^%s]+") do
table.insert(arg, argument)
end

if arg[1] == "mesaj" then
local message = ""
--reface propoziția
for index, word in pairs(arg) do
if index > 1 then
message = message .. " " .. word
end
end
ui.addTextArea(0, message, playerName, 5, 20, nil, nil, nil, nil, 1, false)
end
end

Ai putea cva gen ca pe !omo?
Să pui click și să apară mesajul
Dramacorn
« Consul »
1496502120000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#164
  2
Fulgermacuin a dit :
Wazt a dit :
Fulgermacuin a dit :
există vreo comandă în care dacă scrii de ex !mesaj să apară un uiaddTextaArea dar cu ce mesaj vrei tu
gen ?:

!mesaj salut și să apară salut
!mesaj bună și să apară bună

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function eventChatCommand(playerName, command)
--arg[1] comanda
--arg[n] (n > 1) restul textului

--separă comanda
local arg = {}
for argument in command:gmatch("[^%s]+") do
table.insert(arg, argument)
end

if arg[1] == "mesaj" then
local message = ""
--reface propoziția
for index, word in pairs(arg) do
if index > 1 then
message = message .. " " .. word
end
end
ui.addTextArea(0, message, playerName, 5, 20, nil, nil, nil, nil, 1, false)
end
end

Ai putea cva gen ca pe !omo?
Să pui click și să apară mesajul

name="Dramatotala"
active=true;omo=""system.bindMouse(name,true)system.disableChatCommandDisplay("omo")function eventChatCommand(a,b)if b:match("omo")and a==name then active=true;omo=b:sub(4)end end;function eventMouse(a,c,d)if active then ui.addTextArea(0,"<font size='40'>"..omo,nil,c,d,400,0,0x0,0x0,0,false)active=false
end
end

Schimba numele meu cu al tau
Nihatsune
« Citoyen »
1496502960000
    • Nihatsune#1106
    • Profil
    • Derniers messages
    • Tribu
#165
  0
Dramatotala a dit :
Fulgermacuin a dit :
Wazt a dit :
Fulgermacuin a dit :
există vreo comandă în care dacă scrii de ex !mesaj să apară un uiaddTextaArea dar cu ce mesaj vrei tu
gen ?:

!mesaj salut și să apară salut
!mesaj bună și să apară bună

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function eventChatCommand(playerName, command)
--arg[1] comanda
--arg[n] (n > 1) restul textului

--separă comanda
local arg = {}
for argument in command:gmatch("[^%s]+") do
table.insert(arg, argument)
end

if arg[1] == "mesaj" then
local message = ""
--reface propoziția
for index, word in pairs(arg) do
if index > 1 then
message = message .. " " .. word
end
end
ui.addTextArea(0, message, playerName, 5, 20, nil, nil, nil, nil, 1, false)
end
end

Ai putea cva gen ca pe !omo?
Să pui click și să apară mesajul

name="Dramatotala"
active=true;omo=""system.bindMouse(name,true)system.disableChatCommandDisplay("omo")function eventChatCommand(a,b)if b:match("omo")and a==name then active=true;omo=b:sub(4)end end;function eventMouse(a,c,d)if active then ui.addTextArea(0,"<font size='40'>"..omo,nil,c,d,400,0,0x0,0x0,0,false)active=false
end
end

Schimba numele meu cu al tau

Mersi.
Dar să fie pentru toți playerii?
Gen nu doar eu
Wazt
« Citoyen »
1496504100000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#166
  0
Fulgermacuin a dit :
Dramatotala a dit :
Fulgermacuin a dit :
Wazt a dit :
Fulgermacuin a dit :
există vreo comandă în care dacă scrii de ex !mesaj să apară un uiaddTextaArea dar cu ce mesaj vrei tu
gen ?:

!mesaj salut și să apară salut
!mesaj bună și să apară bună

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function eventChatCommand(playerName, command)
--arg[1] comanda
--arg[n] (n > 1) restul textului

--separă comanda
local arg = {}
for argument in command:gmatch("[^%s]+") do
table.insert(arg, argument)
end

if arg[1] == "mesaj" then
local message = ""
--reface propoziția
for index, word in pairs(arg) do
if index > 1 then
message = message .. " " .. word
end
end
ui.addTextArea(0, message, playerName, 5, 20, nil, nil, nil, nil, 1, false)
end
end

Ai putea cva gen ca pe !omo?
Să pui click și să apară mesajul

name="Dramatotala"
active=true;omo=""system.bindMouse(name,true)system.disableChatCommandDisplay("omo")function eventChatCommand(a,b)if b:match("omo")and a==name then active=true;omo=b:sub(4)end end;function eventMouse(a,c,d)if active then ui.addTextArea(0,"<font size='40'>"..omo,nil,c,d,400,0,0x0,0x0,0,false)active=false
end
end

Schimba numele meu cu al tau

Mersi.
Dar să fie pentru toți playerii?
Gen nu doar eu

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

local command = "mesaj"
system.disableChatCommandDisplay(command)

function eventNewPlayer(playerName)
details[playerName] = {state = false, message =""}
system.bindMouse(playerName, true)
end

function eventChatCommand(playerName, cmd)
if cmd:sub(1, #command) == command then
details[playerName].state = true
details[playerName].message = cmd:sub(#command + 2)
end
end

function eventMouse(playerName, x, y)
if details[playerName].state == true then
ui.addTextArea(0, details[playerName].message, playerName, x, y, nil, nil, nil, nil, 1, false)
details[playerName].state = false
end
end

for name, player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end
Dramacorn
« Consul »
1496594700000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#167
  2
Cum adaug profil unui joc?
Si care este scriptul ca atunci cand sunt 2 echipe si echipa red moare cei de la blue iau win toti si gen ar intra in gaura

Dernière modification le 1496596800000
Wazt
« Citoyen »
1496599200000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#168
  0
Dramatotala a dit :

Si care este scriptul ca atunci cand sunt 2 echipe si echipa red moare cei de la blue iau win toti si gen ar intra in gaura

Sursă.

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
--[[
[Tutorial] Adding teams to your games by Onkei.
]]

local teams = {
Blue = {
playerList = {},
color = "0x2323bf"
},

Red = {
playerList = {},
color = "0xbf2323"
},
}

function eventPlayerDied(name)
local aliveTeams = {}

for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
if not tfm.get.room.playerList[n].isDead then
table.insert(aliveTeams, team)
break
end
end
end

if #aliveTeams == 1 then
local aliveTeam = teams[aliveTeams[1]]
for i, n in pairs(aliveTeam.playerList) do
if not tfm.get.room.playerList[n].isDead then
tfm.exec.giveCheese(n)
tfm.exec.playerVictory(n)
end
end

tfm.exec.setGameTime(5)
elseif #aliveTeams == 0 then
tfm.exec.newGame(maps[math.random(#maps)])
end
end

function manageTeams()
for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
tfm.exec.setNameColor(n, data.color)
end
end
end

function seperatePlayers()
for team, data in pairs(teams) do
data.playerList = {}
end

local playersLeft = {}

for n in pairs(tfm.get.room.playerList) do
table.insert(playersLeft, n)
end

while (#playersLeft > 0) do
local smallestTeam = {playerList = {"Onkei", "Random Guy", "Another Guy", "More Guys", "Johnny Cash"}}
for team, data in pairs(teams) do
if #data.playerList < #smallestTeam.playerList then
smallestTeam = teams[team]
end
end

local randomIndex = math.random(#playersLeft)
local randomPlayer = playersLeft[randomIndex]
table.insert(smallestTeam.playerList, randomPlayer)
table.remove(playersLeft, randomIndex)
end
end

function eventNewGame()
seperatePlayers()
manageTeams()
end

Edit:
Dramatotala a dit :
Cum adaug profil unui joc?

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
--[[
Code: wazt
Basic profile layout for minigames.
]]

local profile = {}

function eventNewPlayer(playerName)
--totalCheese - times you got the cheese (with or without getting inside the hole)
profile[playerName] = {
wins = 0,
totalCheese = 0,
deaths = 0,
displayed = 0
}
ui.addTextArea(0, "<a href='event:profile'>Profile</a>", playerName, 5, 25, nil, nil, nil, nil, 1, false)
end

function eventTextAreaCallback(textAreaId, playerName, eventName)
if eventName == "profile" then
profile[playerName].displayed = profile[playerName].displayed * (-1) + 1
if profile[playerName].displayed == 1 then
ui.updateTextArea(0, "<a href='event:profile'>Profile</a>\n\nWins: " .. profile[playerName].wins .. ";\nTotal cheese: " .. profile[playerName].totalCheese .. ";\nDeaths: " .. profile[playerName].deaths .. ".", playerName)
else
ui.updateTextArea(0, "<a href='event:profile'>Profile</a>", playerName)
end
end
end

function eventPlayerGetCheese(playerName)
profile[playerName].totalCheese = profile[playerName].totalCheese + 1
end

function eventPlayerWon(playerName)
profile[playerName].wins = profile[playerName].wins + 1
end

function eventPlayerDied(playerName)
profile[playerName].deaths = profile[playerName].deaths + 1
end

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

Dernière modification le 1496602260000
Dramacorn
« Consul »
1496647980000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#169
  2
De ce nu merge sa adaug doar partea aceea de la scriptul cu echipe??
si de ce numai merge win team in viata cand adaug cel cu profil?
Wazt
« Citoyen »
1496650080000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#170
  0
Dramatotala a dit :
De ce nu merge sa adaug doar partea aceea de la scriptul cu echipe??

Merge, doar că trebuie să începi o nouă rundă.

Dramatotala a dit :
si de ce numai merge win team in viata cand adaug cel cu profil?

Nu merge cum trebuie pentru că există două funcții cu numele eventPlayerDied(...), mereu va fi folosită ultima.
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
--[[
[Tutorial] Adding teams to your games by Onkei.
]]

tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoNewGame(true)

local maps = {521833, 401421, 541917, 541928, 541936, 541943, 527935, 559634, 559644, 888052, 878047, 885641, 770600, 770656, 772172, 891472, 589736, 589800, 589708, 900012, 901062, 754380, 901337, 901411, 907870, 910078, 1190467, 1252043, 1124380, 1016258, 1252299, 1255902, 1256808, 986790, 1285380, 1271249, 1255944, 1255983, 1085344, 1273114, 1276664, 1279258, 1286824, 1280135, 1280342, 1284861, 1287556, 1057753, 1196679, 1288489, 1292983, 1298164, 1298521, 1293189, 1296949, 1308378, 1311136, 1314419, 1314982, 1318248, 1312411, 1312589, 1312845, 1312933, 1313969, 1338762, 1339474, 1349878, 1297154, 644588, 1351237, 1354040, 1354375, 1362386, 1283234, 1370578, 1306592, 1360889, 1362753, 1408124, 1407949, 1407849, 1343986, 1408028, 1441370, 1443416, 1389255, 1427349, 1450527, 1424739, 869836, 1459902, 1392993, 1426457, 1542824, 1533474, 1561467, 1563534, 1566991, 1587241, 1416119, 1596270, 1601580, 1525751, 1582146, 1558167, 1420943, 1466487, 1642575, 1648013, 1646094, 1393097, 1643446, 1545219, 1583484, 1613092, 1627981, 1633374, 1633277, 1633251, 1585138, 1624034, 1616785, 1625916, 1667582, 1666996, 1675013, 1675316, 1531316, 1665413, 1681719, 1699880, 1688696, 623770, 1727243, 1531329, 1683915, 1689533, 1738601, 3756146, 912118, 3326933, 3722005, 3566478, 1456622, 1357994, 1985670, 1884075, 1708065, 1700322, 2124484, 3699046, 2965313, 4057963, 4019126, 3335202, 2050466}

local teams = {
Blue = {
playerList = {},
color = "0x2323bf"
},

Red = {
playerList = {},
color = "0xbf2323"
},
}

-----------------------

--[[
Code: wazt
Basic profile layout for minigames.
]]

local profile = {}

function eventNewPlayer(playerName)
--totalCheese - times you got the cheese (with or without getting inside the hole)
profile[playerName] = {
wins = 0,
totalCheese = 0,
deaths = 0,
displayed = 0
}
ui.addTextArea(0, "<a href='event:profile'>Profile</a>", playerName, 5, 25, nil, nil, nil, nil, 1, false)
end

function eventTextAreaCallback(textAreaId, playerName, eventName)
if eventName == "profile" then
profile[playerName].displayed = profile[playerName].displayed * (-1) + 1
if profile[playerName].displayed == 1 then
ui.updateTextArea(0, "<a href='event:profile'>Profile</a>\n\nWins: " .. profile[playerName].wins .. ";\nTotal cheese: " .. profile[playerName].totalCheese .. ";\nDeaths: " .. profile[playerName].deaths .. ".", playerName)
else
ui.updateTextArea(0, "<a href='event:profile'>Profile</a>", playerName)
end
end
end

function eventPlayerGetCheese(playerName)
profile[playerName].totalCheese = profile[playerName].totalCheese + 1
end

function eventPlayerWon(playerName)
profile[playerName].wins = profile[playerName].wins + 1
end

--------------------

function eventPlayerDied(name)

profile[name].deaths = profile[name].deaths + 1 --part of basic profile script

local aliveTeams = {}

for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
if not tfm.get.room.playerList[n].isDead then
table.insert(aliveTeams, team)
break
end
end
end

if #aliveTeams == 1 then
local aliveTeam = teams[aliveTeams[1]]
for i, n in pairs(aliveTeam.playerList) do
if not tfm.get.room.playerList[n].isDead then
tfm.exec.giveCheese(n)
tfm.exec.playerVictory(n)
end
end

tfm.exec.setGameTime(5)
elseif #aliveTeams == 0 then
tfm.exec.newGame(maps[math.random(#maps)])
end
end

function manageTeams()
for team, data in pairs(teams) do
for i, n in pairs(data.playerList) do
tfm.exec.setNameColor(n, data.color)
end
end
end

function seperatePlayers()
for team, data in pairs(teams) do
data.playerList = {}
end

local playersLeft = {}

for n in pairs(tfm.get.room.playerList) do
table.insert(playersLeft, n)
end

while (#playersLeft > 0) do
local smallestTeam = {playerList = {"Onkei", "Random Guy", "Another Guy", "More Guys", "Johnny Cash"}}
for team, data in pairs(teams) do
if #data.playerList < #smallestTeam.playerList then
smallestTeam = teams[team]
end
end

local randomIndex = math.random(#playersLeft)
local randomPlayer = playersLeft[randomIndex]
table.insert(smallestTeam.playerList, randomPlayer)
table.remove(playersLeft, randomIndex)
end
end

function eventLoop(time, remaining)
if remaining <= 0 then
tfm.exec.newGame(maps[math.random(#maps)])
end
end

function eventNewGame()
seperatePlayers()
manageTeams()
end

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

tfm.exec.newGame(maps[math.random(#maps)])
Ylir
« Censeur »
1505051700000
    • Ylir#0000
    • Profil
    • Derniers messages
    • Tribu
#171
  1
2 Truths, 1 Lie
https://i.imgur.com/hUw2E3B.png
Soarecii aleg din cele 3 declaratii date de shaman pe aceea pe care o considera ei falsa. Cel care ghiceste primul pe cea falsa este pus in locul shamanului si el, la randul lui, da alte 3 declaratii.
https://i.imgur.com/L7mBpX8.png
Ideea jocului e simpla dar presupun ca e foarte complicat sa faci scriptul iar eu nu stiu nimic legat despre asta. As fii foarte recunoscator celui care reuseste sa-l faca. Pozele sunt puse pentru a intelege mai bine despre cum ar trebui sa functioneze jocul.


EDIT: aici este mapa in caz ca vrea sa o foloseasca

Dernière modification le 1505052240000
Mikazeya
« Citoyen »
1505067960000
    • Mikazeya#6311
    • Profil
    • Derniers messages
    • Tribu
#172
  1
Prea greu chiar și pentru mine. http://img.atelier801.com/a924f17d.pnghttp://img.atelier801.com/a324f17d.pnghttp://img.atelier801.com/ada4f17d.png
Wazt
« Citoyen »
1505077800000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#173
  1
Ylir a dit :
2 Truths, 1 Lie
https://i.imgur.com/hUw2E3B.png
Soarecii aleg din cele 3 declaratii date de shaman pe aceea pe care o considera ei falsa. Cel care ghiceste primul pe cea falsa este pus in locul shamanului si el, la randul lui, da alte 3 declaratii.
https://i.imgur.com/L7mBpX8.png
Ideea jocului e simpla dar presupun ca e foarte complicat sa faci scriptul iar eu nu stiu nimic legat despre asta. As fii foarte recunoscator celui care reuseste sa-l faca. Pozele sunt puse pentru a intelege mai bine despre cum ar trebui sa functioneze jocul.


EDIT: aici este mapa in caz ca vrea sa o foloseasca

Cod
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
--[[
Code: Wazt
Start date: 10/09/2017
Last updated: 11/09/2017
Version: 1.0

Request: http://atelier801.com/topic?f=6&t=802315&p=9#m171

Messages:
welcome - welcome message,
setup - message for the shaman when a new round begins
change - error message when trying to change your answer
shaman - error message when trying to answer as shaman
correct - congratulations message
skip - appears when the shaman skips the round
afk - displayed when setupTime ran out
left - sent when the shaman leaves the room
trueSentence1/2 - appears on the first 2 popups
falseSentence - appears on the last popup
]]

local shaman = "Wazt" --used to set the first shaman
local maps = {0} --maps used
local setupTime = 45 --seconds to get all 3 sentences up
local setupStage = 0 --used to skip the round if setupTime runs out
local backgroundColor, borderColor, textColor, selectedAnswerColor = 0x0D242C, 0x254659, "#00A1A1", "#A1A100"
local playerDetails = {}
local sentences = {}
local messages = {
welcome = "<VP>Welcome to 2 Truths, 1 Lie!",
setup = "<VP>You have <ROSE>" .. setupTime .. " seconds<VP> to get the sentences up!",
change = "<R>You can't change your answer!",
shaman = "<R>You're the shaman, you can't answer!",
correct = "<VP> found the lie!",
skip = "<VP>The shaman skipped the round!",
afk = "<VP>The shaman is afk, a new round begins in <ROSE>5 seconds<VP>!",
left = "<VP>The shaman left, a new round begins in <ROSE>5 seconds<VP>!",
trueSentence1 = "True sentence no. 1:",
trueSentence2 = "True sentence no. 2:",
falseSentence = "False sentence:",
}

local function randomMap()
return maps[math.random(#maps)]
end

local function randomShaman()
local players = {}
for playerName, player in pairs(tfm.get.room.playerList) do
if playerName ~= shaman then
table.insert(players, playerName)
end
end
local randomNumber = math.random(#players)
return players[randomNumber]
end

local function sendMessage(playerName, message)
ui.updateTextArea(0, message, playerName)
end

local function prepareSentences(playerName)
ui.addPopup(1, 2, "<p align='center'>" .. messages.trueSentence1 .. "</p>", playerName, 300, 200, 200)
end

local function displaySentences()
for it = 1, 3 do
local randomNumber = math.random(3)
local auxSentence = {
text = sentences[it].text,
correct = sentences[it].correct
}
sentences[it] = {
text = sentences[randomNumber].text,
correct = sentences[randomNumber].correct
}
sentences[randomNumber] = {
text = auxSentence.text,
correct = auxSentence.correct
}
end
for it = 1, 3 do
ui.addTextArea(it, "<p align='center'><a href='event:" .. tostring(sentences[it].correct) .. "'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></a></p>", nil, 100, 60 + 50 * (it - 1), 600, nil, backgroundColor, borderColor)
end
end

local function removeTrueSentences()
for it = 1, 3 do
if sentences[it].correct then
ui.removeTextArea(it)
else
for playerName, player in pairs(tfm.get.room.playerList) do
if playerDetails[playerName].answer == "false" then
ui.updateTextArea(it, "<p align='center'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
else
ui.updateTextArea(it, "<p align='center'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
end
end
end
end

tfm.exec.setGameTime(5)
end

function eventPopupAnswer(id, playerName, answer)
if playerName == shaman then
if id == 1 then
sentences[id] = {
text = answer,
correct = true
}
setupStage = 2
ui.addPopup(2, 2, "<p align='center'>" .. messages.trueSentence2 .. "</p>", playerName, 300, 200, 200)
elseif id == 2 then
sentences[id] = {
text = answer,
correct = true
}
ui.addPopup(3, 2, "<p align='center'>" .. messages.falseSentence .. "</p>", playerName, 300, 200, 200)
else
sentences[id] = {
text = answer,
correct = false
}
displaySentences()
end
else
--sendMessage(playerName, messages.passed)
end
end

function eventTextAreaCallback(id, playerName, callback)
if playerName == shaman then
sendMessage(playerName, messages.shaman)
else
if not playerDetails[playerName].answered then
playerDetails[playerName].answer = callback
playerDetails[playerName].answered = true
ui.updateTextArea(id, "<p align='center'><a href='event:" .. tostring(sentences[id].correct) .. "'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[id].text .."</B></font></a></p>", playerName)
if callback == "false" then
sendMessage(nil, "<J>" .. playerName .. messages.correct)
removeTrueSentences()
shaman = playerName
end
else
sendMessage(playerName, messages.change)
end
end
end

function eventChatCommand(playerName, cmd)
if (cmd == "skip") and (playerDetails[playerName].isShaman) then
shaman = randomShaman()
sendMessage(nil, messages.skip)
tfm.exec.setGameTime(5)
end
end

function eventPlayerDied(playerName)
tfm.exec.respawnPlayer(playerName)
end

function eventNewPlayer(playerName)
ui.addTextArea(0, messages.welcome, playerName, 15, 370, nil, nil, backgroundColor, borderColor)
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end

function eventPlayerLeft(playerName)
if playerName == shaman then
shaman = randomShaman()
sendMessage(nil, messages.left)
tfm.exec.setGameTime(5)
end
end

function eventNewGame()
tfm.exec.setUIMapName("2 Truths, 1 Lie")
for playerName, player in pairs(tfm.get.room.playerList) do
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end
playerDetails[shaman].isShaman = true
tfm.exec.setShaman(shaman)
ui.setShamanName(shaman)
sendMessage(shaman, messages.setup)
prepareSentences(shaman)
setupStage = 1
end

function eventLoop(time, remaining)
if (time > setupTime * 1000) and (setupStage == 1) then
sendMessage(nil, messages.afk)
tfm.exec.setGameTime(5)
elseif remaining <= 0 then
tfm.exec.newGame(randomMap())
end
end

local function start()
system.disableChatCommandDisplay("skip", true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame(randomMap())

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

start()

Dernière modification le 1505119860000
Ylir
« Censeur »
1505120880000
    • Ylir#0000
    • Profil
    • Derniers messages
    • Tribu
#174
  0
Wazt a dit :
Ylir a dit :
2 Truths, 1 Lie
https://i.imgur.com/hUw2E3B.png
Soarecii aleg din cele 3 declaratii date de shaman pe aceea pe care o considera ei falsa. Cel care ghiceste primul pe cea falsa este pus in locul shamanului si el, la randul lui, da alte 3 declaratii.
https://i.imgur.com/L7mBpX8.png
Ideea jocului e simpla dar presupun ca e foarte complicat sa faci scriptul iar eu nu stiu nimic legat despre asta. As fii foarte recunoscator celui care reuseste sa-l faca. Pozele sunt puse pentru a intelege mai bine despre cum ar trebui sa functioneze jocul.


EDIT: aici este mapa in caz ca vrea sa o foloseasca

Cod
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
--[[
Code: Wazt
Start date: 10/09/2017
Last updated: 11/09/2017
Version: 1.0

Request: http://atelier801.com/topic?f=6&t=802315&p=9#m171

Messages:
welcome - welcome message,
setup - message for the shaman when a new round begins
change - error message when trying to change your answer
shaman - error message when trying to answer as shaman
correct - congratulations message
skip - appears when the shaman skips the round
afk - displayed when setupTime ran out
left - sent when the shaman leaves the room
trueSentence1/2 - appears on the first 2 popups
falseSentence - appears on the last popup
]]

local shaman = "Wazt" --used to set the first shaman
local maps = {0} --maps used
local setupTime = 45 --seconds to get all 3 sentences up
local setupStage = 0 --used to skip the round if setupTime runs out
local backgroundColor, borderColor, textColor, selectedAnswerColor = 0x0D242C, 0x254659, "#00A1A1", "#A1A100"
local playerDetails = {}
local sentences = {}
local messages = {
welcome = "<VP>Welcome to 2 Truths, 1 Lie!",
setup = "<VP>You have <ROSE>" .. setupTime .. " seconds<VP> to get the sentences up!",
change = "<R>You can't change your answer!",
shaman = "<R>You're the shaman, you can't answer!",
correct = "<VP> found the lie!",
skip = "<VP>The shaman skipped the round!",
afk = "<VP>The shaman is afk, a new round begins in <ROSE>5 seconds<VP>!",
left = "<VP>The shaman left, a new round begins in <ROSE>5 seconds<VP>!",
trueSentence1 = "True sentence no. 1:",
trueSentence2 = "True sentence no. 2:",
falseSentence = "False sentence:",
}

local function randomMap()
return maps[math.random(#maps)]
end

local function randomShaman()
local players = {}
for playerName, player in pairs(tfm.get.room.playerList) do
if playerName ~= shaman then
table.insert(players, playerName)
end
end
local randomNumber = math.random(#players)
return players[randomNumber]
end

local function sendMessage(playerName, message)
ui.updateTextArea(0, message, playerName)
end

local function prepareSentences(playerName)
ui.addPopup(1, 2, "<p align='center'>" .. messages.trueSentence1 .. "</p>", playerName, 300, 200, 200)
end

local function displaySentences()
for it = 1, 3 do
local randomNumber = math.random(3)
local auxSentence = {
text = sentences[it].text,
correct = sentences[it].correct
}
sentences[it] = {
text = sentences[randomNumber].text,
correct = sentences[randomNumber].correct
}
sentences[randomNumber] = {
text = auxSentence.text,
correct = auxSentence.correct
}
end
for it = 1, 3 do
ui.addTextArea(it, "<p align='center'><a href='event:" .. tostring(sentences[it].correct) .. "'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></a></p>", nil, 100, 60 + 50 * (it - 1), 600, nil, backgroundColor, borderColor)
end
end

local function removeTrueSentences()
for it = 1, 3 do
if sentences[it].correct then
ui.removeTextArea(it)
else
for playerName, player in pairs(tfm.get.room.playerList) do
if playerDetails[playerName].answer == "false" then
ui.updateTextArea(it, "<p align='center'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
else
ui.updateTextArea(it, "<p align='center'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
end
end
end
end

tfm.exec.setGameTime(5)
end

function eventPopupAnswer(id, playerName, answer)
if playerName == shaman then
if id == 1 then
sentences[id] = {
text = answer,
correct = true
}
setupStage = 2
ui.addPopup(2, 2, "<p align='center'>" .. messages.trueSentence2 .. "</p>", playerName, 300, 200, 200)
elseif id == 2 then
sentences[id] = {
text = answer,
correct = true
}
ui.addPopup(3, 2, "<p align='center'>" .. messages.falseSentence .. "</p>", playerName, 300, 200, 200)
else
sentences[id] = {
text = answer,
correct = false
}
displaySentences()
end
else
--sendMessage(playerName, messages.passed)
end
end

function eventTextAreaCallback(id, playerName, callback)
if playerName == shaman then
sendMessage(playerName, messages.shaman)
else
if not playerDetails[playerName].answered then
playerDetails[playerName].answer = callback
playerDetails[playerName].answered = true
ui.updateTextArea(id, "<p align='center'><a href='event:" .. tostring(sentences[id].correct) .. "'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[id].text .."</B></font></a></p>", playerName)
if callback == "false" then
sendMessage(nil, "<J>" .. playerName .. messages.correct)
removeTrueSentences()
shaman = playerName
end
else
sendMessage(playerName, messages.change)
end
end
end

function eventChatCommand(playerName, cmd)
if (cmd == "skip") and (playerDetails[playerName].isShaman) then
shaman = randomShaman()
sendMessage(nil, messages.skip)
tfm.exec.setGameTime(5)
end
end

function eventPlayerDied(playerName)
tfm.exec.respawnPlayer(playerName)
end

function eventNewPlayer(playerName)
ui.addTextArea(0, messages.welcome, playerName, 15, 370, nil, nil, backgroundColor, borderColor)
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end

function eventPlayerLeft(playerName)
if playerName == shaman then
shaman = randomShaman()
sendMessage(nil, messages.left)
tfm.exec.setGameTime(5)
end
end

function eventNewGame()
tfm.exec.setUIMapName("2 Truths, 1 Lie")
for playerName, player in pairs(tfm.get.room.playerList) do
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end
playerDetails[shaman].isShaman = true
tfm.exec.setShaman(shaman)
ui.setShamanName(shaman)
sendMessage(shaman, messages.setup)
prepareSentences(shaman)
setupStage = 1
end

function eventLoop(time, remaining)
if (time > setupTime * 1000) and (setupStage == 1) then
sendMessage(nil, messages.afk)
tfm.exec.setGameTime(5)
elseif remaining <= 0 then
tfm.exec.newGame(randomMap())
end
end

local function start()
system.disableChatCommandDisplay("skip", true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame(randomMap())

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

start()

Am modificat la local function randomMap() cu mapa @7265550 si la local shaman = "Wazt" --used to set the first shaman cu numele meu dar mereu apare mapa default din trib. Cred ca nu am modificat ce trebuie si unde trebuie. Poti sa-mi zici te rog randurile unde trebuie sa modific.
Iti raman dator cu 200 de branze
Wazt
« Citoyen »
1505123820000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#175
  1
Ylir a dit :
Wazt a dit :
Ylir a dit :
2 Truths, 1 Lie
https://i.imgur.com/hUw2E3B.png
Soarecii aleg din cele 3 declaratii date de shaman pe aceea pe care o considera ei falsa. Cel care ghiceste primul pe cea falsa este pus in locul shamanului si el, la randul lui, da alte 3 declaratii.
https://i.imgur.com/L7mBpX8.png
Ideea jocului e simpla dar presupun ca e foarte complicat sa faci scriptul iar eu nu stiu nimic legat despre asta. As fii foarte recunoscator celui care reuseste sa-l faca. Pozele sunt puse pentru a intelege mai bine despre cum ar trebui sa functioneze jocul.


EDIT: aici este mapa in caz ca vrea sa o foloseasca

Cod
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
--[[
Code: Wazt
Start date: 10/09/2017
Last updated: 11/09/2017
Version: 1.0

Request: http://atelier801.com/topic?f=6&t=802315&p=9#m171

Messages:
welcome - welcome message,
setup - message for the shaman when a new round begins
change - error message when trying to change your answer
shaman - error message when trying to answer as shaman
correct - congratulations message
skip - appears when the shaman skips the round
afk - displayed when setupTime ran out
left - sent when the shaman leaves the room
trueSentence1/2 - appears on the first 2 popups
falseSentence - appears on the last popup
]]

local shaman = "Wazt" --used to set the first shaman
local maps = {0} --maps used
local setupTime = 45 --seconds to get all 3 sentences up
local setupStage = 0 --used to skip the round if setupTime runs out
local backgroundColor, borderColor, textColor, selectedAnswerColor = 0x0D242C, 0x254659, "#00A1A1", "#A1A100"
local playerDetails = {}
local sentences = {}
local messages = {
welcome = "<VP>Welcome to 2 Truths, 1 Lie!",
setup = "<VP>You have <ROSE>" .. setupTime .. " seconds<VP> to get the sentences up!",
change = "<R>You can't change your answer!",
shaman = "<R>You're the shaman, you can't answer!",
correct = "<VP> found the lie!",
skip = "<VP>The shaman skipped the round!",
afk = "<VP>The shaman is afk, a new round begins in <ROSE>5 seconds<VP>!",
left = "<VP>The shaman left, a new round begins in <ROSE>5 seconds<VP>!",
trueSentence1 = "True sentence no. 1:",
trueSentence2 = "True sentence no. 2:",
falseSentence = "False sentence:",
}

local function randomMap()
return maps[math.random(#maps)]
end

local function randomShaman()
local players = {}
for playerName, player in pairs(tfm.get.room.playerList) do
if playerName ~= shaman then
table.insert(players, playerName)
end
end
local randomNumber = math.random(#players)
return players[randomNumber]
end

local function sendMessage(playerName, message)
ui.updateTextArea(0, message, playerName)
end

local function prepareSentences(playerName)
ui.addPopup(1, 2, "<p align='center'>" .. messages.trueSentence1 .. "</p>", playerName, 300, 200, 200)
end

local function displaySentences()
for it = 1, 3 do
local randomNumber = math.random(3)
local auxSentence = {
text = sentences[it].text,
correct = sentences[it].correct
}
sentences[it] = {
text = sentences[randomNumber].text,
correct = sentences[randomNumber].correct
}
sentences[randomNumber] = {
text = auxSentence.text,
correct = auxSentence.correct
}
end
for it = 1, 3 do
ui.addTextArea(it, "<p align='center'><a href='event:" .. tostring(sentences[it].correct) .. "'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></a></p>", nil, 100, 60 + 50 * (it - 1), 600, nil, backgroundColor, borderColor)
end
end

local function removeTrueSentences()
for it = 1, 3 do
if sentences[it].correct then
ui.removeTextArea(it)
else
for playerName, player in pairs(tfm.get.room.playerList) do
if playerDetails[playerName].answer == "false" then
ui.updateTextArea(it, "<p align='center'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
else
ui.updateTextArea(it, "<p align='center'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
end
end
end
end

tfm.exec.setGameTime(5)
end

function eventPopupAnswer(id, playerName, answer)
if playerName == shaman then
if id == 1 then
sentences[id] = {
text = answer,
correct = true
}
setupStage = 2
ui.addPopup(2, 2, "<p align='center'>" .. messages.trueSentence2 .. "</p>", playerName, 300, 200, 200)
elseif id == 2 then
sentences[id] = {
text = answer,
correct = true
}
ui.addPopup(3, 2, "<p align='center'>" .. messages.falseSentence .. "</p>", playerName, 300, 200, 200)
else
sentences[id] = {
text = answer,
correct = false
}
displaySentences()
end
else
--sendMessage(playerName, messages.passed)
end
end

function eventTextAreaCallback(id, playerName, callback)
if playerName == shaman then
sendMessage(playerName, messages.shaman)
else
if not playerDetails[playerName].answered then
playerDetails[playerName].answer = callback
playerDetails[playerName].answered = true
ui.updateTextArea(id, "<p align='center'><a href='event:" .. tostring(sentences[id].correct) .. "'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[id].text .."</B></font></a></p>", playerName)
if callback == "false" then
sendMessage(nil, "<J>" .. playerName .. messages.correct)
removeTrueSentences()
shaman = playerName
end
else
sendMessage(playerName, messages.change)
end
end
end

function eventChatCommand(playerName, cmd)
if (cmd == "skip") and (playerDetails[playerName].isShaman) then
shaman = randomShaman()
sendMessage(nil, messages.skip)
tfm.exec.setGameTime(5)
end
end

function eventPlayerDied(playerName)
tfm.exec.respawnPlayer(playerName)
end

function eventNewPlayer(playerName)
ui.addTextArea(0, messages.welcome, playerName, 15, 370, nil, nil, backgroundColor, borderColor)
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end

function eventPlayerLeft(playerName)
if playerName == shaman then
shaman = randomShaman()
sendMessage(nil, messages.left)
tfm.exec.setGameTime(5)
end
end

function eventNewGame()
tfm.exec.setUIMapName("2 Truths, 1 Lie")
for playerName, player in pairs(tfm.get.room.playerList) do
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end
playerDetails[shaman].isShaman = true
tfm.exec.setShaman(shaman)
ui.setShamanName(shaman)
sendMessage(shaman, messages.setup)
prepareSentences(shaman)
setupStage = 1
end

function eventLoop(time, remaining)
if (time > setupTime * 1000) and (setupStage == 1) then
sendMessage(nil, messages.afk)
tfm.exec.setGameTime(5)
elseif remaining <= 0 then
tfm.exec.newGame(randomMap())
end
end

local function start()
system.disableChatCommandDisplay("skip", true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame(randomMap())

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

start()

Am modificat la local function randomMap() cu mapa @7265550 si la local shaman = "Wazt" --used to set the first shaman cu numele meu dar mereu apare mapa default din trib. Cred ca nu am modificat ce trebuie si unde trebuie. Poti sa-mi zici te rog randurile unde trebuie sa modific.
Iti raman dator cu 200 de branze

Linia 23, în loc de 0 pui "cod hartă", exemplu local maps = {"@7265550", "@500000"}.
Ylir
« Censeur »
1505129160000
    • Ylir#0000
    • Profil
    • Derniers messages
    • Tribu
#176
  0
Wazt a dit :
Ylir a dit :
Wazt a dit :
Ylir a dit :
2 Truths, 1 Lie
https://i.imgur.com/hUw2E3B.png
Soarecii aleg din cele 3 declaratii date de shaman pe aceea pe care o considera ei falsa. Cel care ghiceste primul pe cea falsa este pus in locul shamanului si el, la randul lui, da alte 3 declaratii.
https://i.imgur.com/L7mBpX8.png
Ideea jocului e simpla dar presupun ca e foarte complicat sa faci scriptul iar eu nu stiu nimic legat despre asta. As fii foarte recunoscator celui care reuseste sa-l faca. Pozele sunt puse pentru a intelege mai bine despre cum ar trebui sa functioneze jocul.


EDIT: aici este mapa in caz ca vrea sa o foloseasca

Cod
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
--[[
Code: Wazt
Start date: 10/09/2017
Last updated: 11/09/2017
Version: 1.0

Request: http://atelier801.com/topic?f=6&t=802315&p=9#m171

Messages:
welcome - welcome message,
setup - message for the shaman when a new round begins
change - error message when trying to change your answer
shaman - error message when trying to answer as shaman
correct - congratulations message
skip - appears when the shaman skips the round
afk - displayed when setupTime ran out
left - sent when the shaman leaves the room
trueSentence1/2 - appears on the first 2 popups
falseSentence - appears on the last popup
]]

local shaman = "Wazt" --used to set the first shaman
local maps = {0} --maps used
local setupTime = 45 --seconds to get all 3 sentences up
local setupStage = 0 --used to skip the round if setupTime runs out
local backgroundColor, borderColor, textColor, selectedAnswerColor = 0x0D242C, 0x254659, "#00A1A1", "#A1A100"
local playerDetails = {}
local sentences = {}
local messages = {
welcome = "<VP>Welcome to 2 Truths, 1 Lie!",
setup = "<VP>You have <ROSE>" .. setupTime .. " seconds<VP> to get the sentences up!",
change = "<R>You can't change your answer!",
shaman = "<R>You're the shaman, you can't answer!",
correct = "<VP> found the lie!",
skip = "<VP>The shaman skipped the round!",
afk = "<VP>The shaman is afk, a new round begins in <ROSE>5 seconds<VP>!",
left = "<VP>The shaman left, a new round begins in <ROSE>5 seconds<VP>!",
trueSentence1 = "True sentence no. 1:",
trueSentence2 = "True sentence no. 2:",
falseSentence = "False sentence:",
}

local function randomMap()
return maps[math.random(#maps)]
end

local function randomShaman()
local players = {}
for playerName, player in pairs(tfm.get.room.playerList) do
if playerName ~= shaman then
table.insert(players, playerName)
end
end
local randomNumber = math.random(#players)
return players[randomNumber]
end

local function sendMessage(playerName, message)
ui.updateTextArea(0, message, playerName)
end

local function prepareSentences(playerName)
ui.addPopup(1, 2, "<p align='center'>" .. messages.trueSentence1 .. "</p>", playerName, 300, 200, 200)
end

local function displaySentences()
for it = 1, 3 do
local randomNumber = math.random(3)
local auxSentence = {
text = sentences[it].text,
correct = sentences[it].correct
}
sentences[it] = {
text = sentences[randomNumber].text,
correct = sentences[randomNumber].correct
}
sentences[randomNumber] = {
text = auxSentence.text,
correct = auxSentence.correct
}
end
for it = 1, 3 do
ui.addTextArea(it, "<p align='center'><a href='event:" .. tostring(sentences[it].correct) .. "'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></a></p>", nil, 100, 60 + 50 * (it - 1), 600, nil, backgroundColor, borderColor)
end
end

local function removeTrueSentences()
for it = 1, 3 do
if sentences[it].correct then
ui.removeTextArea(it)
else
for playerName, player in pairs(tfm.get.room.playerList) do
if playerDetails[playerName].answer == "false" then
ui.updateTextArea(it, "<p align='center'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
else
ui.updateTextArea(it, "<p align='center'><font color='" .. textColor .. "'><B>".. sentences[it].text .."</B></font></p>", playerName)
end
end
end
end

tfm.exec.setGameTime(5)
end

function eventPopupAnswer(id, playerName, answer)
if playerName == shaman then
if id == 1 then
sentences[id] = {
text = answer,
correct = true
}
setupStage = 2
ui.addPopup(2, 2, "<p align='center'>" .. messages.trueSentence2 .. "</p>", playerName, 300, 200, 200)
elseif id == 2 then
sentences[id] = {
text = answer,
correct = true
}
ui.addPopup(3, 2, "<p align='center'>" .. messages.falseSentence .. "</p>", playerName, 300, 200, 200)
else
sentences[id] = {
text = answer,
correct = false
}
displaySentences()
end
else
--sendMessage(playerName, messages.passed)
end
end

function eventTextAreaCallback(id, playerName, callback)
if playerName == shaman then
sendMessage(playerName, messages.shaman)
else
if not playerDetails[playerName].answered then
playerDetails[playerName].answer = callback
playerDetails[playerName].answered = true
ui.updateTextArea(id, "<p align='center'><a href='event:" .. tostring(sentences[id].correct) .. "'><font color='" .. selectedAnswerColor .. "'><B>".. sentences[id].text .."</B></font></a></p>", playerName)
if callback == "false" then
sendMessage(nil, "<J>" .. playerName .. messages.correct)
removeTrueSentences()
shaman = playerName
end
else
sendMessage(playerName, messages.change)
end
end
end

function eventChatCommand(playerName, cmd)
if (cmd == "skip") and (playerDetails[playerName].isShaman) then
shaman = randomShaman()
sendMessage(nil, messages.skip)
tfm.exec.setGameTime(5)
end
end

function eventPlayerDied(playerName)
tfm.exec.respawnPlayer(playerName)
end

function eventNewPlayer(playerName)
ui.addTextArea(0, messages.welcome, playerName, 15, 370, nil, nil, backgroundColor, borderColor)
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end

function eventPlayerLeft(playerName)
if playerName == shaman then
shaman = randomShaman()
sendMessage(nil, messages.left)
tfm.exec.setGameTime(5)
end
end

function eventNewGame()
tfm.exec.setUIMapName("2 Truths, 1 Lie")
for playerName, player in pairs(tfm.get.room.playerList) do
playerDetails[playerName] = {
answered = false,
answer = "false",
isShaman = false
}
end
playerDetails[shaman].isShaman = true
tfm.exec.setShaman(shaman)
ui.setShamanName(shaman)
sendMessage(shaman, messages.setup)
prepareSentences(shaman)
setupStage = 1
end

function eventLoop(time, remaining)
if (time > setupTime * 1000) and (setupStage == 1) then
sendMessage(nil, messages.afk)
tfm.exec.setGameTime(5)
elseif remaining <= 0 then
tfm.exec.newGame(randomMap())
end
end

local function start()
system.disableChatCommandDisplay("skip", true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.newGame(randomMap())

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

start()

Am modificat la local function randomMap() cu mapa @7265550 si la local shaman = "Wazt" --used to set the first shaman cu numele meu dar mereu apare mapa default din trib. Cred ca nu am modificat ce trebuie si unde trebuie. Poti sa-mi zici te rog randurile unde trebuie sa modific.
Iti raman dator cu 200 de branze

Linia 23, în loc de 0 pui "cod hartă", exemplu local maps = {"@7265550", "@500000"}.

Acolo modificasem si prima data ca doar imi dadea mura in gura dar tot nu mergea si credeam ca mai sunt si alte linii care trebuiau modificate.
Acum am inteles ca imi lipseau ghilimelele iar acum imi merge.
Sa-ti dea dumnezeu sanatate si daca poti sa intri in seara asta pe tfm ca iti sunt dator cu 200 de branze

Dernière modification le 1505129220000
Sky
« Censeur »
1507400880000
    • Sky#0015
    • Profil
    • Derniers messages
    • Tribu
#177
  0
când folosesc
Code Lua

1
2
3
function eventNewPlayer(Sky_dreams)
ui.addTextArea(1, "<font size='15'><font color='#30BA76'>•</font>", nil, 746, 44, 33, 43, 0x324650, 0x000000, 0, true)
end
sau
Code Lua

1
2
3
function eventPlayerLeft (Sky_dreams)
ui.addTextArea(1, "<font size='15'><font color='#ed1717'>•</font>", nil, 746, 44, 33, 43, 0xffffff, 0x000000, 0, true)
end[code=lua]


să apară doar când plec/vin eu.



Am rezolvat


function eventNewPlayer(psd)
if psd == "Sky_dreams" then
ui.addTextArea(1, "<font size='15'><font color='#30BA76'>•</font>", nil, 746, 44, 33, 43, 0x324650, 0x000000, 0, true)
end
end


function eventPlayerLeft (psd)
if psd == "Sky_dreams" then
ui.addTextArea(1, "<font size='15'><font color='#ed1717'>•</font>", nil, 746, 44, 33, 43, 0xffffff, 0x000000, 0, true)
end
end

Dernière modification le 1507402620000
Denyelxxx
« Citoyen »
1514973000000
    • Denyelxxx#0000
    • Profil
    • Derniers messages
#178
  0
Okay deci am gasit scriptul asta lua si ma intrebam daca ma puteti ajuta sa il fac sa pot spawna doar eu inimioare nu toti de pe sala
function main()
for playerName in pairs(tfm.get.room.playerList) do
eventNewPlayer(playerName)
end
end

function eventNewPlayer(playerName)
system.bindMouse (playerName, true);
end

function eventMouse (playerName, mx, my)
local size = 5;
local x_position = mx;
local y_position = my;

for t=0,2*math.pi,0.1 do

x=(16*math.sin(t)^3)*size + x_position
y=(13*math.cos(t)-5*math.cos(2*t)-2*math.cos(3*t)-math.cos(4*t))*size
y=-y + y_position

tfm.exec.addShamanObject(0,x,y);

end
end

main ();
Cristi
1515676560000
    • Cristi#9959
    • Profil
    • Derniers messages
    • Tribu
#179
[Modéré par Hotaru, raison : flood]
Wazt
« Citoyen »
1515797820000
    • Wazt#0000
    • Profil
    • Derniers messages
    • Tribu
#180
  0
Denyelxxx a dit :
Okay deci am gasit scriptul asta lua si ma intrebam daca ma puteti ajuta sa il fac sa pot spawna doar eu inimioare nu toti de pe sala
function main()
for playerName in pairs(tfm.get.room.playerList) do
eventNewPlayer(playerName)
end
end

function eventNewPlayer(playerName)
system.bindMouse (playerName, true);
end

function eventMouse (playerName, mx, my)
local size = 5;
local x_position = mx;
local y_position = my;

for t=0,2*math.pi,0.1 do

x=(16*math.sin(t)^3)*size + x_position
y=(13*math.cos(t)-5*math.cos(2*t)-2*math.cos(3*t)-math.cos(4*t))*size
y=-y + y_position

tfm.exec.addShamanObject(0,x,y);

end
end

main ();

Pe prima linie pui numele tău

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local name = "Wazt"
system.bindMouse (name, true);

function eventMouse (playerName, mx, my)
local size = 5;
local x_position = mx;
local y_position = my;

for t=0,2*math.pi,0.1 do

x=(16*math.sin(t)^3)*size + x_position
y=(13*math.cos(t)-5*math.cos(2*t)-2*math.cos(3*t)-math.cos(4*t))*size
y=-y + y_position

tfm.exec.addShamanObject(0,x,y);

end
end
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Cereri scripturi
« ‹ 9 / 10 › »
© Atelier801 2018

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

Version 1.27