×

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
  • Tribus
  • /
  • We Dance A Lot
  • /
  • Lua code's
  • /
  • Lua for tribe house
Lua for tribe house
Aen_elle
« Citoyen »
Membre
1586770620000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  1
  • General
  • Info
  • Code
Original version – taken from open source
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0


Buttons:

  • E — throw a snowball


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
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 eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
end

Dernière modification le 1588246320000
Aen_elle
« Citoyen »
Membre
1586770920000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.0.1
Teleportation
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.


Buttons:

  • E — throw a snowball


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 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

function eventTpMouse(name)
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


main()

function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
end
v 0.0.1
  • Added a new command — "!tp"


Dernière modification le 1589664480000
Aen_elle
« Citoyen »
Membre
1586854500000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#3
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.0.2
Spacebar fly
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


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

local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = 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)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
end
end

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

function eventTpMouse(name)
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


main()

function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
end
v 0.0.2
  • Added new functionality to button "space" — fluy


Dernière modification le 1589664420000
Aen_elle
« Citoyen »
Membre
1586886060000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#4
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.1.0
"Rpg module"
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs near mice
    cost: 30 mana
    require: level 1
    key: H


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
local keys = {space = 32, left = 37, right = 39, a = 65, d = 68, e = 69, h = 72, q = 81}
local players = {}
local rpgmodule = {}
local skillKeys = ''
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
}



local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = 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 data.isDead then
return
end
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)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
elseif rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
end
end
end


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

function eventTpMouse(name)
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end

function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function checkSkillKey(key)
return false
end



function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana .. "(+" .. rpgmodule[name].manaRegen .. ")\n"
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString, name,920,0,150,80,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
updateTextArea(rpgmodule[key].name)
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end




function eventStartRpg(name)
createStats(name)
createTextArea(name)
end

function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
}
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
end

main()

function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
if command=="rpgmodule" then
eventStartRpg(name)
end
end
v 0.1.0
Added a rpg module!
Something between test of functionality and alpha-test c:
  • Added new command — "!rpgmodule"
  • Added new functionality to button "H" — skill "snowStar"
  • Added mana, level, manaRegen to functionality of RPG module


Dernière modification le 1586886180000
Aen_elle
« Citoyen »
Membre
1586962500000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#5
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.1.2
New skill
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G


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
219
220
221
222
223
224
local keys = {space = 32, left = 37, right = 39, a = 65, b = 66, d = 68, e = 69, g= 71, h = 72, q = 81}
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
}
local players = {}
local rpgmodule = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
}



local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = 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 data.isDead then
return
end
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)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
elseif rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
end
end
end


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

function eventTpMouse(name)
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end

function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function checkSkillKey(key)
return false
end



function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana .. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString, name,920,0,150,120,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
updateTextArea(rpgmodule[key].name)
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end




function eventStartRpg(name)
createStats(name)
createTextArea(name)
end

function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
}
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key] .. "}\n"
end
end
return answer
end


main()

function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
if command=="rpgmodule" then
eventStartRpg(name)
end
end
v 0.1.2
Skills:
  • Added new functionality to button "G" — skill "snowFall"


Dernière modification le 1589664420000
Aen_elle
« Citoyen »
Membre
1587074040000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#6
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.1.4
Added exp and level rising.
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
local keys = {space = 32, left = 37, right = 39, a = 65, b = 66, d = 68, e = 69, g= 71, h = 72, q = 81, t = 84}
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
}
local players = {}
local rpgmodule = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
}



local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = 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 data.isDead then
return
end
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)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
elseif rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end


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

function eventTpMouse(name)
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end

function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: " .. rpgmodule[name].exp .. "/" .. rpgmodule[name].expToLevel .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana .. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString, name,920,0,200,150,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end
end

function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end

function eventStartRpg(name)
createStats(name)
createTextArea(name)
end

function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key] .. "}: " .. skills[k].requiments.mana .. "\n"
end
end
return answer
end


main()

function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
if command=="rpgmodule" then
eventStartRpg(name)
end
end
v 0.1.4
Skills:
  • Added exp and level rising: now every cast will give u exp. If you have enough exp your lvl will increase, that improve your stats.
  • Added new functionality to button "B" — skill "telekinesisLow"


Dernière modification le 1589644860000
Aen_elle
« Citoyen »
Membre
1587299220000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#7
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.1.5
New skill
Functions:

Commands:
  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
local keys = {space = 32, left = 37, right = 39, a = 65, b = 66,
d = 68, e = 69, f = 70, g = 71, h = 72, q = 81, t = 84}
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
[keys.f] = "F",
}
local players = {}
local rpgmodule = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 1,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 10, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
}



local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = 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 data.isDead then
return
end
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)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
elseif rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end


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

function eventTpMouse(name)
system.bindMouse(name, true)
end

function eventMouse(name, x, y)
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end

function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: " .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule
[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,150,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen)
then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end




function eventStartRpg(name)
createStats(name)
createTextArea(name)
end

function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key]
.. "}: " .. skills[k].requiments.mana .. "\n"
end
end
return answer
end


main()

function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
if command=="rpgmodule" then
eventStartRpg(name)
end
end
v 0.1.5
Skills:
  • Added new functionality to button "F" — skill "iceArrow"


Dernière modification le 1589664420000
Aen_elle
« Citoyen »
Membre
1587568200000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#8
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.2.0
Added an admin panel!
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
local keys = {space = 32, left = 37, right = 39, a = 65, b = 66, 
d = 68, e = 69, f = 70, g = 71, h = 72, q = 81, t = 84, admin = 192}
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
[keys.f] = "F",
}
local admins = {"Zarimona#7336", "Aen_elle#0000"}
local players = {}
local rpgmodule = {}
local textAreas = {}
local hideAdminPanel = true
local adminTp = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
adminKeys = {[keys.admin] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if hideAdminPanel == true then
showAdminPanel(n)
else
ui.removeTextArea("mainAdmin", n)
hideAdminPanel = true
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
elseif rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: " .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule
[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,150,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end


function eventStartRpg(name)
createStats(name)
createTextArea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key]
.. "}: " .. skills[k].requiments.mana .. "\n"
end
end
return answer
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
hideAdminPanel = false
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).."\n"
return result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
ui.removeTextArea("mainAdmin", playerName)
hideAdminPanel = true
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
ui.removeTextArea("mainAdmin", playerName)
hideAdminPanel = true
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


main()


function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
if command=="rpgmodule" then
eventStartRpg(name)
end
if command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.0
Skills:
  • Added new functionality to button "`" — admin panel
  • Added new command — "!adminpanel"
  • Added many functions to admin panel


Dernière modification le 1587568380000
Aen_elle
« Citoyen »
Membre
1587997680000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#9
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.2.1
Moderator permission
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman
    • set other mice as moder (give admin opps)


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
local keys = {space = 32, left = 37, right = 39, a = 65, b = 66, 
d = 68, e = 69, f = 70, g = 71, h = 72, q = 81, t = 84, admin = 192}
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
[keys.f] = "F",
}
local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
adminKeys = {[keys.admin] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
elseif rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: " .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule
[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,150,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end


function eventStartRpg(name)
createStats(name)
createTextArea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key]
.. "}: " .. skills[k].requiments.mana .. "\n"
end
end
return answer
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


main()


function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
end
if command=="big" then
tfm.exec.changePlayerSize(name, 3)
end
if command=="medium" then
tfm.exec.changePlayerSize(name, 2)
end
if command=="normal" then
tfm.exec.changePlayerSize(name, 1)
end
if command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
end
if command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
end
if command=="tp" then
eventTpMouse(name)
end
if command=="no" then
for n in pairs(tfm.get.room.playerList) do
tfm.get.room.playerList[n].isShaman = true
print(tfm.get.room.playerList[n].isShaman)
end
end
if command=="rpgmodule" then
eventStartRpg(name)
end
if command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.1
Adminpanel:
  • Added new functionality to admin panel — moderator


Dernière modification le 1589664420000
Aen_elle
« Citoyen »
Membre
1589469240000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#10
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.2.4
Godfly
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills
  • "!godfly" — bind mice for her current location


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman
    • set other mice as moder (give admin opps)
    • enable/disable godfly for mice


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
local keys = {space = 32, left = 37, right = 39, down = 40, a = 65, 
b = 66, d = 68, e = 69, f = 70, g = 71, h = 72, q = 81, t = 84,
admin = 192, s = 83, w = 87, up = 38 }
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
[keys.f] = "F",
}
local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local playersGodFly = {}
local godGroundsId = 0
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
adminKeys = {[keys.admin] = true},
downKeys = {[keys.s] = true, [keys.down] = true},
jumpKeys = {[keys.w] = true, [keys.up] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
for somekey in pairs(playersGodFly) do
if (somekey == n) then
if settings.rightKeys[key] then
playersGodFly[n].x = playersGodFly[n].x + 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.leftKeys[key] then
playersGodFly[n].x = playersGodFly[n].x - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif (settings.flyKeys[key]) or (settings.jumpKeys[key]) then
playersGodFly[n].y = playersGodFly[n].y - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.downKeys[key] then
print('wat')
playersGodFly[n].y = playersGodFly[n].y + 25
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
end
end
if rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: " .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule
[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,150,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end

for key in pairs(playersGodFly) do
tfm.exec.movePlayer(key, playersGodFly[key].x, playersGodFly[key].y ,false,0,10, false)
if (tfm.get.room.playerList[key]) then
if (tfm.get.room.playerList[key].movingLeft) then
playersGodFly[key].x = playersGodFly[key].x - 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+ 15, playersGodFly[key].id)
elseif (tfm.get.room.playerList[key].movingRight) then
playersGodFly[key].x = playersGodFly[key].x + 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+15, playersGodFly[key].id)
end
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end


function eventStartRpg(name)
if (not rpgmodule[name]) then
createStats(name)
end
createTextArea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key]
.. "}: " .. skills[k].requiments.mana .. "\n"
end
end
return answer
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
result = result.. "godFly("

for name in pairs(playersGodFly) do
if (playersGodFly[name].name == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "noGodFly"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "godFly"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 6) == "godFly") then
startGodFly(string.sub(s, 7))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "noGodFly") then
endGodFly(string.sub(s, 9))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


function startGodFly(name)
godGroundsId = godGroundsId + 1
playersGodFly[name] = {}
playersGodFly[name].name = name
playersGodFly[name].id = godGroundsId
playersGodFly[name].x = tfm.get.room.playerList[name].x
playersGodFly[name].y = tfm.get.room.playerList[name].y
addGodGround(playersGodFly[name].x, playersGodFly[name].y+15, playersGodFly[name].id)
end


function addGodGround(x, y, id)
tfm.exec.addPhysicObject(id, x, y,{
type=12,
restitution=0,
friction=30,
width=1,
height=1,
groundCollision=true
})
end


function endGodFly(name)
tfm.exec.removePhysicObject(playersGodFly[name].id)
playersGodFly[name] = NIL
end


function checkGodFly(name)
local some = {}
for keys in pairs(playersGodFly) do
if (playersGodFly[keys].name == name) then
some[name] = 1
end
end
if some[name] == 1 then
endGodFly(name)
some[name] = 0
else
startGodFly(name)
end
end


main()


function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
elseif command=="big" then
tfm.exec.changePlayerSize(name, 3)
elseif command=="medium" then
tfm.exec.changePlayerSize(name, 2)
elseif command=="normal" then
tfm.exec.changePlayerSize(name, 1)
elseif command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
elseif command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
elseif command=="tp" then
eventTpMouse(name)
elseif command=="rpgmodule" then
eventStartRpg(name)
elseif command=="godfly" then
checkGodFly(name)
elseif command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.4
Command:
  • Added new command — !godfly


Dernière modification le 1589664360000
Aen_elle
« Citoyen »
Membre
1589546640000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#11
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.2.5
New skills
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills
  • "!godfly" — bind mice for her current location


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)
  • ` — show/hide an adminpanel (if you have privileges to do this)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F
  • telekinesisMedium — create a medium explosion at ur position
    cost: 50 mana
    require: level 3
    key: V
  • randomTp — instantly teleport ur mice to random coordinates
    cost: 100 mana
    require: level 3
    key: B


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman
    • set other mice as moder (give admin opps)
    • enable/disable godfly for mice


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
local keys = {space = 32, left = 37, right = 39, down = 40, a = 65, 
b = 66, d = 68, e = 69, f = 70, g = 71, h = 72, q = 81, t = 84,
admin = 192, s = 83, w = 87, up = 38, c = 67, v = 86, }
local keyNames = {
[keys.h] = "H",
[keys.b] = "B",
[keys.g] = "G",
[keys.f] = "F",
[keys.c] = "C",
[keys.v] = "V",
}
local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local playersGodFly = {}
local godGroundsId = 0
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
telekinesisMedium = {
name = "telekinesisMedium",
requiments = {
mana = 50,
level = 3,
},
key = keys.v,
expGain = 3,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 9, 100,false)
end
},
randomTp = {
name = "randomTp",
requiments = {
mana = 100,
level = 3,
},
key = keys.c,
expGain = 4,
call = function (x, y, dir, name)
local randomX = math.random(10, 790)
local randomY = math.random(10, 390)
tfm.exec.movePlayer(name,randomX,randomY,false,0,0,false)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.space] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.right] = true, [keys.d] = true},
adminKeys = {[keys.admin] = true},
downKeys = {[keys.s] = true, [keys.down] = true},
jumpKeys = {[keys.w] = true, [keys.up] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
for somekey in pairs(playersGodFly) do
if (somekey == n) then
if settings.rightKeys[key] then
playersGodFly[n].x = playersGodFly[n].x + 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.leftKeys[key] then
playersGodFly[n].x = playersGodFly[n].x - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif (settings.flyKeys[key]) or (settings.jumpKeys[key]) then
playersGodFly[n].y = playersGodFly[n].y - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.downKeys[key] then
print('wat')
playersGodFly[n].y = playersGodFly[n].y + 25
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
end
end
if rpgmodule[n] == nil then
return false
end
local currentSkill = getSkillKey(key)
if not currentSkill then
return
end
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction, n)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode)
for k, val in pairs(skills) do
if skills[k].key == keyCode then
return skills[k].name
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: " .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: " .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule
[name].avaibleSkills
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,180,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end

for key in pairs(playersGodFly) do
tfm.exec.movePlayer(key, playersGodFly[key].x, playersGodFly[key].y ,false,0,10, false)
if (tfm.get.room.playerList[key]) then
if (tfm.get.room.playerList[key].movingLeft) then
playersGodFly[key].x = playersGodFly[key].x - 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+ 15, playersGodFly[key].id)
elseif (tfm.get.room.playerList[key].movingRight) then
playersGodFly[key].x = playersGodFly[key].x + 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+15, playersGodFly[key].id)
end
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
end


function eventStartRpg(name)
if (not rpgmodule[name]) then
createStats(name)
end
createTextArea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].avaibleSkills = getAvaibleSkills(n)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[" .. skills[k].name .. "] - {" .. keyNames[skills[k].key]
.. "}: " .. skills[k].requiments.mana .. "\n"
end
end
return answer
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
result = result.. "godFly("

for name in pairs(playersGodFly) do
if (playersGodFly[name].name == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "noGodFly"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "godFly"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 6) == "godFly") then
startGodFly(string.sub(s, 7))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "noGodFly") then
endGodFly(string.sub(s, 9))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


function startGodFly(name)
godGroundsId = godGroundsId + 1
playersGodFly[name] = {}
playersGodFly[name].name = name
playersGodFly[name].id = godGroundsId
playersGodFly[name].x = tfm.get.room.playerList[name].x
playersGodFly[name].y = tfm.get.room.playerList[name].y
addGodGround(playersGodFly[name].x, playersGodFly[name].y+15, playersGodFly[name].id)
end


function addGodGround(x, y, id)
tfm.exec.addPhysicObject(id, x, y,{
type=12,
restitution=0,
friction=30,
width=1,
height=1,
groundCollision=true
})
end


function endGodFly(name)
tfm.exec.removePhysicObject(playersGodFly[name].id)
playersGodFly[name] = NIL
end


function checkGodFly(name)
local some = {}
for keys in pairs(playersGodFly) do
if (playersGodFly[keys].name == name) then
some[name] = 1
end
end
if some[name] == 1 then
endGodFly(name)
some[name] = 0
else
startGodFly(name)
end
end


main()


function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
elseif command=="big" then
tfm.exec.changePlayerSize(name, 3)
elseif command=="medium" then
tfm.exec.changePlayerSize(name, 2)
elseif command=="normal" then
tfm.exec.changePlayerSize(name, 1)
elseif command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
elseif command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
elseif command=="tp" then
eventTpMouse(name)
elseif command=="rpgmodule" then
eventStartRpg(name)
elseif command=="godfly" then
checkGodFly(name)
elseif command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.5
Skills:
  • Added new skill — !telekinesisMedium
  • Added new skill — !randomTp


Dernière modification le 1589664360000
Aen_elle
« Citoyen »
Membre
1589664240000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#12
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.2.6
Bind system
Functions:

Commands:

  • "!bigger" — set the mice size to 5
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills
  • "!godfly" — bind mice for her current location


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)
  • ` — show/hide an adminpanel (if you have privileges to do this)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H (default)
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G (default)
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B (default)
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F (default)
  • telekinesisMedium — create a medium explosion at ur position
    cost: 50 mana
    require: level 3
    key: V (default)
  • randomTp — instantly teleport ur mice to random coordinates
    cost: 100 mana
    require: level 3
    key: B (default)


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman
    • set other mice as moder (give admin opps)
    • enable/disable godfly for mice


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
local keys = { backspace = 8, tab = 9, enter = 13, shift = 16, 
control = 17, alt = 18, pause = 19, capsLock = 20, escape = 27,
spacebar = 32, pageUp = 33, pageDown = 34, endButton = 35, home = 36,
leftArrow = 37, upArrow = 38, rightArrow = 39, downArrow = 40,
insert = 45, delete = 46, usual0 = 48, usual1 = 49, usual2 = 50,
usual3 = 51, usual4 = 52, usual5 = 53, usual6 = 54, usual7 = 55,
usual8 = 56, usual9 = 57, a = 65, b = 66, c = 67, d = 68, e = 69,
f = 70, g = 71, h = 72, i = 73, k = 74, j = 75, l = 76,
m = 77, n = 78, o = 79, p = 80, q = 81, r = 82, s = 83, t = 84,
u = 85, v = 86, w = 87, x = 88, y = 89, z = 90, numbpad1 = 97,
numbpad2 = 98, numbpad3 = 99, numbpad4 = 100, numbpad5 = 101,
numbpad6 = 102, numbpad7 = 103, numbpad8 = 104, numbpad9 = 105,
numbpadAsterix = 106, numbpadPlus = 107, numbpadMinus = 109,
numbpadForwardSlash = 110, f1 = 112, f2 = 113, f3 = 114, f4 = 115,
f5 = 116, f6 = 117, f7 = 118, f8 = 119, f9 = 120, f10 = 121,
f11 = 122, f12 = 123, numlock = 144, scrollLock = 145,
semicolon = 186, equals = 187, comma = 188, hyphen = 189,
period = 190, forwardSlash = 191, apostrophe = 192,
leftSquareBracket = 219, backslash = 220, rightSquareBracket = 221,
}
local keyNames = { [keys.backspace] = "backspace", [keys.tab] = "tab",
[keys.enter] = "enter", [keys.shift] = "shift",
[keys.control] = "control", [keys.alt] = "alt",
[keys.pause] = "pause", [keys.capsLock] = "capsLock",
[keys.escape] = "escape", [keys.spacebar] = "spacebar",
[keys.pageUp] = "pageUp", [keys.pageDown] = "pageDown",
[keys.endButton] = "endButton", [keys.home] = "home",
[keys.leftArrow] = "leftArrow", [keys.upArrow] = "upArrow",
[keys.rightArrow] = "rightArrow", [keys.downArrow] = "downArrow",
[keys.insert] = "insert", [keys.delete] = "delete",
[keys.usual0] = "usual0", [keys.usual1] = "usual1",
[keys.usual2] = "usual2", [keys.usual3] = "usual3",
[keys.usual4] = "usual4", [keys.usual5] = "usual5",
[keys.usual6] = "usual6", [keys.usual7] = "usual7",
[keys.usual8] = "usual8", [keys.usual9] = "usual9",
[keys.a] = "a", [keys.b] = "b", [keys.c] = "c", [keys.d] = "d",
[keys.e] = "e", [keys.f] = "f", [keys.g] = "g", [keys.h] = "h",
[keys.i] = "i", [keys.k] = "k", [keys.j] = "j", [keys.l] = "l",
[keys.m] = "m", [keys.n] = "n", [keys.o] = "o", [keys.p] = "p",
[keys.q] = "q", [keys.r] = "r", [keys.s] = "s", [keys.t] = "t",
[keys.u] = "u", [keys.v] = "v", [keys.w] = "w", [keys.x] = "x",
[keys.y] = "y", [keys.z] = "z", [keys.numbpad1] = "numbpad1",
[keys.numbpad2] = "numbpad2", [keys.numbpad3] = "numbpad3",
[keys.numbpad4] = "numbpad4", [keys.numbpad5] = "numbpad5",
[keys.numbpad6] = "numbpad6", [keys.numbpad7] = "numbpad7",
[keys.numbpad8] = "numbpad8", [keys.numbpad9] = "numbpad9",
[keys.numbpadAsterix] = "numbpadAsterix",
[keys.numbpadPlus] = "numbpadPlus",
[keys.numbpadMinus] = "numbpadMinus",
[keys.numbpadForwardSlash] = "numbpadForwardSlash",
[keys.f1] = "f1", [keys.f2] = "f2", [keys.f3] = "f3",
[keys.f4] = "f4", [keys.f5] = "f5", [keys.f6] = "f6",
[keys.f7] = "f7", [keys.f8] = "f8", [keys.f9] = "f9",
[keys.f10] = "f10", [keys.f11] = "f11", [keys.f12] = "f12",
[keys.numlock] = "numlock", [keys.scrollLock] = "scrollLock",
[keys.semicolon] = "semicolon", [keys.equals] = "equals",
[keys.comma] = "comma", [keys.hyphen] = "hyphen",
[keys.period] = "period", [keys.forwardSlash] = "forwardSlash",
[keys.apostrophe] = "apostrophe",
[keys.leftSquareBracket] = "leftSquareBracket",
[keys.backslash] = "backslash", [keys.rightSquareBracket] = "rightSquareBracket",
}
local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local playerKeys = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local playersGodFly = {}
local godGroundsId = 0
local bindKeyStatus = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
telekinesisMedium = {
name = "telekinesisMedium",
requiments = {
mana = 50,
level = 3,
},
key = keys.v,
expGain = 3,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 9, 100,false)
end
},
randomTp = {
name = "randomTp",
requiments = {
mana = 100,
level = 3,
},
key = keys.c,
expGain = 4,
call = function (x, y, dir, name)
local randomX = math.random(10, 790)
local randomY = math.random(10, 390)
tfm.exec.movePlayer(name,randomX,randomY,false,0,0,false)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.spacebar] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.leftArrow] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.rightArrow] = true, [keys.d] = true},
adminKeys = {[keys.apostrophe] = true},
downKeys = {[keys.s] = true, [keys.downArrow] = true},
jumpKeys = {[keys.w] = true, [keys.upArrow] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
for somekey in pairs(playersGodFly) do
if (somekey == n) then
if settings.rightKeys[key] then
playersGodFly[n].x = playersGodFly[n].x + 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.leftKeys[key] then
playersGodFly[n].x = playersGodFly[n].x - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif (settings.flyKeys[key]) or (settings.jumpKeys[key]) then
if (playersGodFly[n].y > 15) then
playersGodFly[n].y = playersGodFly[n].y - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
elseif settings.downKeys[key] then
print('wat')
playersGodFly[n].y = playersGodFly[n].y + 25
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
end
end
if not bindKeyStatus[n] then
return
end
if bindKeyStatus[n].id == 1 then
for someKey in pairs(playerKeys[n]) do
if someKey == bindKeyStatus[n].name then
playerKeys[n][someKey] = key
bindKeyStatus[n].id = 0
bindKeyStatus[n].text = "\n(click at button name to change button for this skill)"
updateSkillsTextarea(n)
end
end
elseif rpgmodule[n] == nil then
return false
elseif not getSkillKey(key, n) then
return
else
local currentSkill = getSkillKey(key, n)
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction, n)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode, name)
for key in pairs(playerKeys[name]) do
if playerKeys[name][key] == keyCode then
return key
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: <vp>" .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "</vp>\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: <bv>" .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")</bv>\n"
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,60,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end

for key in pairs(playersGodFly) do
tfm.exec.movePlayer(key, playersGodFly[key].x, playersGodFly[key].y ,false,0,10, false)
if (tfm.get.room.playerList[key]) then
if (tfm.get.room.playerList[key].movingLeft) then
playersGodFly[key].x = playersGodFly[key].x - 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+ 15, playersGodFly[key].id)
elseif (tfm.get.room.playerList[key].movingRight) then
playersGodFly[key].x = playersGodFly[key].x + 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+15, playersGodFly[key].id)
end
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
updateSkillsTextarea(name)
end


function eventStartRpg(name)
if (not rpgmodule[name]) then
createStats(name)
end
bindPlayerKeys(name)
createTextArea(name)
addSkillsTextarea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function bindPlayerKeys(name)
playerKeys[name] = {}
for k in pairs(skills) do
playerKeys[name][k] = skills[k].key
end
bindKeyStatus[name] = {}
bindKeyStatus[name].text = "\n(click at button name to change button for this skill)"
bindKeyStatus[name].id = 0
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[<CH>" .. skills[k].name .. "</CH>] - {"
for someKey in pairs(playerKeys[n]) do
if (someKey == skills[k].name) then
answer = answer .. makeClickable(keyNames[playerKeys[n][someKey]], "chButton"..skills[k].name)
end
end
answer = answer .. "}: " .. skills[k].requiments.mana .. "\n"
end
end
answer = answer .. bindKeyStatus[n].text .. "\n"
return answer
end


function addSkillsTextarea(n)
updateSkillsTextarea(n)
end


function updateSkillsTextarea(n)
if (rpgmodule[n]) then
if (rpgmodule[n].skillsTextarea) then
ui.updateTextArea(2,getAvaibleSkills(n),n)
else
createSkillsTextarea(n)
end
else
createSkillsTextarea(n)
end
end


function createSkillsTextarea(n)
ui.addTextArea(2,getAvaibleSkills(n),n ,-270,0,150,200,0x324650,0x212F36,0.8,true)
rpgmodule[n].skillsTextarea = true
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
result = result.. "godFly("

for name in pairs(playersGodFly) do
if (playersGodFly[name].name == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "noGodFly"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "godFly"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 6) == "godFly") then
startGodFly(string.sub(s, 7))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "noGodFly") then
endGodFly(string.sub(s, 9))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "chButton") then
bindKeyStatus[playerName] = {}
bindKeyStatus[playerName].text = "\n(press button to set it 'active' for skill '" .. (string.sub(s, 9)) .. "')"
bindKeyStatus[playerName].id = 1
bindKeyStatus[playerName].name = (string.sub(s, 9))
updateSkillsTextarea(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


function startGodFly(name)
godGroundsId = godGroundsId + 1
playersGodFly[name] = {}
playersGodFly[name].name = name
playersGodFly[name].id = godGroundsId
playersGodFly[name].x = tfm.get.room.playerList[name].x
playersGodFly[name].y = tfm.get.room.playerList[name].y
addGodGround(playersGodFly[name].x, playersGodFly[name].y+15, playersGodFly[name].id)
end


function addGodGround(x, y, id)
tfm.exec.addPhysicObject(id, x, y,{
type=12,
restitution=0,
friction=30,
width=1,
height=1,
groundCollision=true
})
end


function endGodFly(name)
tfm.exec.removePhysicObject(playersGodFly[name].id)
playersGodFly[name] = NIL
end


function checkGodFly(name)
local some = {}
for keys in pairs(playersGodFly) do
if (playersGodFly[keys].name == name) then
some[name] = 1
end
end
if some[name] == 1 then
endGodFly(name)
some[name] = 0
else
startGodFly(name)
end
end


main()


function eventChatCommand(name,command)
if command=="bigger" then
tfm.exec.changePlayerSize(name, 5)
elseif command=="big" then
tfm.exec.changePlayerSize(name, 3)
elseif command=="medium" then
tfm.exec.changePlayerSize(name, 2)
elseif command=="normal" then
tfm.exec.changePlayerSize(name, 1)
elseif command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
elseif command=="smaller" then
tfm.exec.changePlayerSize(name, 0)
elseif command=="tp" then
eventTpMouse(name)
elseif command=="rpgmodule" then
eventStartRpg(name)
elseif command=="godfly" then
checkGodFly(name)
elseif command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.6
Added new bind system!
Now you can click on the button name of any skill. After that, next click on any keyboard button will bind it as button for that skill activation.

Dernière modification le 1589664360000
Aen_elle
« Citoyen »
Membre
1589664960000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#13
  1
  • General
  • Info
  • Code
  • Patchnote
v 0.2.6.1
New commands
Functions:

Commands:

  • "!biggest" — set the mice size to 5
  • "!bigger" — set the mice size to 4
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0.35
  • "!smallest" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills
  • "!godfly" — bind mice for her current location


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)
  • ` — show/hide an adminpanel (if you have privileges to do this)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H (default)
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G (default)
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B (default)
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F (default)
  • telekinesisMedium — create a medium explosion at ur position
    cost: 50 mana
    require: level 3
    key: V (default)
  • randomTp — instantly teleport ur mice to random coordinates
    cost: 100 mana
    require: level 3
    key: B (default)


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman
    • set other mice as moder (give admin opps)
    • enable/disable godfly for mice


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
local keys = { backspace = 8, tab = 9, enter = 13, shift = 16, 
control = 17, alt = 18, pause = 19, capsLock = 20, escape = 27,
spacebar = 32, pageUp = 33, pageDown = 34, endButton = 35, home = 36,
leftArrow = 37, upArrow = 38, rightArrow = 39, downArrow = 40,
insert = 45, delete = 46, usual0 = 48, usual1 = 49, usual2 = 50,
usual3 = 51, usual4 = 52, usual5 = 53, usual6 = 54, usual7 = 55,
usual8 = 56, usual9 = 57, a = 65, b = 66, c = 67, d = 68, e = 69,
f = 70, g = 71, h = 72, i = 73, k = 74, j = 75, l = 76,
m = 77, n = 78, o = 79, p = 80, q = 81, r = 82, s = 83, t = 84,
u = 85, v = 86, w = 87, x = 88, y = 89, z = 90, numbpad1 = 97,
numbpad2 = 98, numbpad3 = 99, numbpad4 = 100, numbpad5 = 101,
numbpad6 = 102, numbpad7 = 103, numbpad8 = 104, numbpad9 = 105,
numbpadAsterix = 106, numbpadPlus = 107, numbpadMinus = 109,
numbpadForwardSlash = 110, f1 = 112, f2 = 113, f3 = 114, f4 = 115,
f5 = 116, f6 = 117, f7 = 118, f8 = 119, f9 = 120, f10 = 121,
f11 = 122, f12 = 123, numlock = 144, scrollLock = 145,
semicolon = 186, equals = 187, comma = 188, hyphen = 189,
period = 190, forwardSlash = 191, apostrophe = 192,
leftSquareBracket = 219, backslash = 220, rightSquareBracket = 221,
}
local keyNames = { [keys.backspace] = "backspace", [keys.tab] = "tab",
[keys.enter] = "enter", [keys.shift] = "shift",
[keys.control] = "control", [keys.alt] = "alt",
[keys.pause] = "pause", [keys.capsLock] = "capsLock",
[keys.escape] = "escape", [keys.spacebar] = "spacebar",
[keys.pageUp] = "pageUp", [keys.pageDown] = "pageDown",
[keys.endButton] = "endButton", [keys.home] = "home",
[keys.leftArrow] = "leftArrow", [keys.upArrow] = "upArrow",
[keys.rightArrow] = "rightArrow", [keys.downArrow] = "downArrow",
[keys.insert] = "insert", [keys.delete] = "delete",
[keys.usual0] = "usual0", [keys.usual1] = "usual1",
[keys.usual2] = "usual2", [keys.usual3] = "usual3",
[keys.usual4] = "usual4", [keys.usual5] = "usual5",
[keys.usual6] = "usual6", [keys.usual7] = "usual7",
[keys.usual8] = "usual8", [keys.usual9] = "usual9",
[keys.a] = "a", [keys.b] = "b", [keys.c] = "c", [keys.d] = "d",
[keys.e] = "e", [keys.f] = "f", [keys.g] = "g", [keys.h] = "h",
[keys.i] = "i", [keys.k] = "k", [keys.j] = "j", [keys.l] = "l",
[keys.m] = "m", [keys.n] = "n", [keys.o] = "o", [keys.p] = "p",
[keys.q] = "q", [keys.r] = "r", [keys.s] = "s", [keys.t] = "t",
[keys.u] = "u", [keys.v] = "v", [keys.w] = "w", [keys.x] = "x",
[keys.y] = "y", [keys.z] = "z", [keys.numbpad1] = "numbpad1",
[keys.numbpad2] = "numbpad2", [keys.numbpad3] = "numbpad3",
[keys.numbpad4] = "numbpad4", [keys.numbpad5] = "numbpad5",
[keys.numbpad6] = "numbpad6", [keys.numbpad7] = "numbpad7",
[keys.numbpad8] = "numbpad8", [keys.numbpad9] = "numbpad9",
[keys.numbpadAsterix] = "numbpadAsterix",
[keys.numbpadPlus] = "numbpadPlus",
[keys.numbpadMinus] = "numbpadMinus",
[keys.numbpadForwardSlash] = "numbpadForwardSlash",
[keys.f1] = "f1", [keys.f2] = "f2", [keys.f3] = "f3",
[keys.f4] = "f4", [keys.f5] = "f5", [keys.f6] = "f6",
[keys.f7] = "f7", [keys.f8] = "f8", [keys.f9] = "f9",
[keys.f10] = "f10", [keys.f11] = "f11", [keys.f12] = "f12",
[keys.numlock] = "numlock", [keys.scrollLock] = "scrollLock",
[keys.semicolon] = "semicolon", [keys.equals] = "equals",
[keys.comma] = "comma", [keys.hyphen] = "hyphen",
[keys.period] = "period", [keys.forwardSlash] = "forwardSlash",
[keys.apostrophe] = "apostrophe",
[keys.leftSquareBracket] = "leftSquareBracket",
[keys.backslash] = "backslash", [keys.rightSquareBracket] = "rightSquareBracket",
}
local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local playerKeys = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local playersGodFly = {}
local godGroundsId = 0
local bindKeyStatus = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
telekinesisMedium = {
name = "telekinesisMedium",
requiments = {
mana = 50,
level = 3,
},
key = keys.v,
expGain = 3,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 9, 100,false)
end
},
randomTp = {
name = "randomTp",
requiments = {
mana = 100,
level = 3,
},
key = keys.c,
expGain = 4,
call = function (x, y, dir, name)
local randomX = math.random(10, 790)
local randomY = math.random(10, 390)
tfm.exec.movePlayer(name,randomX,randomY,false,0,0,false)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.spacebar] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.leftArrow] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.rightArrow] = true, [keys.d] = true},
adminKeys = {[keys.apostrophe] = true},
downKeys = {[keys.s] = true, [keys.downArrow] = true},
jumpKeys = {[keys.w] = true, [keys.upArrow] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
for somekey in pairs(playersGodFly) do
if (somekey == n) then
if settings.rightKeys[key] then
playersGodFly[n].x = playersGodFly[n].x + 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.leftKeys[key] then
playersGodFly[n].x = playersGodFly[n].x - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif (settings.flyKeys[key]) or (settings.jumpKeys[key]) then
if (playersGodFly[n].y > 15) then
playersGodFly[n].y = playersGodFly[n].y - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
elseif settings.downKeys[key] then
print('wat')
playersGodFly[n].y = playersGodFly[n].y + 25
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
end
end
if not bindKeyStatus[n] then
return
end
if bindKeyStatus[n].id == 1 then
for someKey in pairs(playerKeys[n]) do
if someKey == bindKeyStatus[n].name then
playerKeys[n][someKey] = key
bindKeyStatus[n].id = 0
bindKeyStatus[n].text = "\n(click at button name to change button for this skill)"
updateSkillsTextarea(n)
end
end
elseif rpgmodule[n] == nil then
return false
elseif not getSkillKey(key, n) then
return
else
local currentSkill = getSkillKey(key, n)
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction, n)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode, name)
for key in pairs(playerKeys[name]) do
if playerKeys[name][key] == keyCode then
return key
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: <vp>" .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "</vp>\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: <bv>" .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")</bv>\n"
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,60,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end

for key in pairs(playersGodFly) do
tfm.exec.movePlayer(key, playersGodFly[key].x, playersGodFly[key].y ,false,0,10, false)
if (tfm.get.room.playerList[key]) then
if (tfm.get.room.playerList[key].movingLeft) then
playersGodFly[key].x = playersGodFly[key].x - 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+ 15, playersGodFly[key].id)
elseif (tfm.get.room.playerList[key].movingRight) then
playersGodFly[key].x = playersGodFly[key].x + 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+15, playersGodFly[key].id)
end
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
updateSkillsTextarea(name)
end


function eventStartRpg(name)
if (not rpgmodule[name]) then
createStats(name)
end
bindPlayerKeys(name)
createTextArea(name)
addSkillsTextarea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function bindPlayerKeys(name)
playerKeys[name] = {}
for k in pairs(skills) do
playerKeys[name][k] = skills[k].key
end
bindKeyStatus[name] = {}
bindKeyStatus[name].text = "\n(click at button name to change button for this skill)"
bindKeyStatus[name].id = 0
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[<CH>" .. skills[k].name .. "</CH>] - {"
for someKey in pairs(playerKeys[n]) do
if (someKey == skills[k].name) then
answer = answer .. makeClickable(keyNames[playerKeys[n][someKey]], "chButton"..skills[k].name)
end
end
answer = answer .. "}: " .. skills[k].requiments.mana .. "\n"
end
end
answer = answer .. bindKeyStatus[n].text .. "\n"
return answer
end


function addSkillsTextarea(n)
updateSkillsTextarea(n)
end


function updateSkillsTextarea(n)
if (rpgmodule[n]) then
if (rpgmodule[n].skillsTextarea) then
ui.updateTextArea(2,getAvaibleSkills(n),n)
else
createSkillsTextarea(n)
end
else
createSkillsTextarea(n)
end
end


function createSkillsTextarea(n)
ui.addTextArea(2,getAvaibleSkills(n),n ,-270,0,150,200,0x324650,0x212F36,0.8,true)
rpgmodule[n].skillsTextarea = true
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
result = result.. "godFly("

for name in pairs(playersGodFly) do
if (playersGodFly[name].name == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "noGodFly"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "godFly"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 6) == "godFly") then
startGodFly(string.sub(s, 7))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "noGodFly") then
endGodFly(string.sub(s, 9))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "chButton") then
bindKeyStatus[playerName] = {}
bindKeyStatus[playerName].text = "\n(press button to set it 'active' for skill '" .. (string.sub(s, 9)) .. "')"
bindKeyStatus[playerName].id = 1
bindKeyStatus[playerName].name = (string.sub(s, 9))
updateSkillsTextarea(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


function startGodFly(name)
godGroundsId = godGroundsId + 1
playersGodFly[name] = {}
playersGodFly[name].name = name
playersGodFly[name].id = godGroundsId
playersGodFly[name].x = tfm.get.room.playerList[name].x
playersGodFly[name].y = tfm.get.room.playerList[name].y
addGodGround(playersGodFly[name].x, playersGodFly[name].y+15, playersGodFly[name].id)
end


function addGodGround(x, y, id)
tfm.exec.addPhysicObject(id, x, y,{
type=12,
restitution=0,
friction=30,
width=1,
height=1,
groundCollision=true
})
end


function endGodFly(name)
tfm.exec.removePhysicObject(playersGodFly[name].id)
playersGodFly[name] = NIL
end


function checkGodFly(name)
local some = {}
for keys in pairs(playersGodFly) do
if (playersGodFly[keys].name == name) then
some[name] = 1
end
end
if some[name] == 1 then
endGodFly(name)
some[name] = 0
else
startGodFly(name)
end
end


main()


function eventChatCommand(name,command)
if command=="biggest" then
tfm.exec.changePlayerSize(name, 5)
elseif command=="bigger" then
tfm.exec.changePlayerSize(name, 4)
elseif command=="big" then
tfm.exec.changePlayerSize(name, 3)
elseif command=="medium" then
tfm.exec.changePlayerSize(name, 2)
elseif command=="normal" then
tfm.exec.changePlayerSize(name, 1)
elseif command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
elseif command=="smaller" then
tfm.exec.changePlayerSize(name, 0.35)
elseif command=="smallest" then
tfm.exec.changePlayerSize(name, 0)
elseif command=="tp" then
eventTpMouse(name)
elseif command=="rpgmodule" then
eventStartRpg(name)
elseif command=="godfly" then
checkGodFly(name)
elseif command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.6.1
New commands:
  • !biggest - set mice size as big as posible
  • !smallest - set mice size as small as posible

Aen_elle
« Citoyen »
Membre
1589831940000
    • Aen_elle#0000
    • Profil
    • Derniers messages
    • Tribu
#14
  0
  • General
  • Info
  • Code
  • Patchnote
v 0.2.6.2
New command, bugs fixed
Functions:

Commands:

  • "!biggest" — set the mice size to 5
  • "!bigger" — set the mice size to 4
  • "!big" — set the mice size to 3
  • "!medium" — set the mice size to 2
  • "!normal" — set the mice size to 1
  • "!small" — set the mice size to 0.65
  • "!smaller" — set the mice size to 0.35
  • "!smallest" — set the mice size to 0
  • "!tp" — wait for the mice click on the screen. After click, set the mice position to the click coordinates.
  • "!rpgmodule" — give you opportunity to cast skills
  • "!godfly" — bind mice for her current location
  • "!shaman" — bind mice for her current location


Buttons:

  • E — throw a snowball
  • Space — make a jumb (unlimited number of jumps, so u can fly)
  • ` — show/hide an adminpanel (if you have privileges to do this)


Skills:

  • snowStar — throw a few snowballs around mice
    cost: 30 mana
    require: level 1
    key: H (default)
  • snowFall — create a few snowballs over mice
    cost: 50 mana
    require: level 1
    key: G (default)
  • telekinesisLow — create a little explosion at ur position
    cost: 25 mana
    require: level 2
    key: B (default)
  • iceArrow — throw 3 fast snowballs in same direction
    cost: 60 mana
    require: level 2
    key: F (default)
  • telekinesisMedium — create a medium explosion at ur position
    cost: 50 mana
    require: level 3
    key: V (default)
  • randomTp — instantly teleport ur mice to random coordinates
    cost: 100 mana
    require: level 3
    key: B (default)


Admin:

  • "!adminpanel" — show an admin panel
  • ` button — show (or close) an admin panel
  • Admins opps:
    • change mice lvl
    • change mice exp
    • give cheese to mice
    • kill mice
    • tp mice
    • set mice as shaman
    • set other mice as moder (give admin opps)
    • enable/disable godfly for mice


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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
local keys = { backspace = 8, tab = 9, enter = 13, shift = 16, 
control = 17, alt = 18, pause = 19, capsLock = 20, escape = 27,
spacebar = 32, pageUp = 33, pageDown = 34, endButton = 35, home = 36,
leftArrow = 37, upArrow = 38, rightArrow = 39, downArrow = 40,
insert = 45, delete = 46, usual0 = 48, usual1 = 49, usual2 = 50,
usual3 = 51, usual4 = 52, usual5 = 53, usual6 = 54, usual7 = 55,
usual8 = 56, usual9 = 57, a = 65, b = 66, c = 67, d = 68, e = 69,
f = 70, g = 71, h = 72, i = 73, k = 74, j = 75, l = 76,
m = 77, n = 78, o = 79, p = 80, q = 81, r = 82, s = 83, t = 84,
u = 85, v = 86, w = 87, x = 88, y = 89, z = 90, numbpad1 = 97,
numbpad2 = 98, numbpad3 = 99, numbpad4 = 100, numbpad5 = 101,
numbpad6 = 102, numbpad7 = 103, numbpad8 = 104, numbpad9 = 105,
numbpadAsterix = 106, numbpadPlus = 107, numbpadMinus = 109,
numbpadForwardSlash = 110, f1 = 112, f2 = 113, f3 = 114, f4 = 115,
f5 = 116, f6 = 117, f7 = 118, f8 = 119, f9 = 120, f10 = 121,
f11 = 122, f12 = 123, numlock = 144, scrollLock = 145,
semicolon = 186, equals = 187, comma = 188, hyphen = 189,
period = 190, forwardSlash = 191, apostrophe = 192,
leftSquareBracket = 219, backslash = 220, rightSquareBracket = 221,
}
local keyNames = { [keys.backspace] = "backspace", [keys.tab] = "tab",
[keys.enter] = "enter", [keys.shift] = "shift",
[keys.control] = "control", [keys.alt] = "alt",
[keys.pause] = "pause", [keys.capsLock] = "capsLock",
[keys.escape] = "escape", [keys.spacebar] = "spacebar",
[keys.pageUp] = "pageUp", [keys.pageDown] = "pageDown",
[keys.endButton] = "endButton", [keys.home] = "home",
[keys.leftArrow] = "leftArrow", [keys.upArrow] = "upArrow",
[keys.rightArrow] = "rightArrow", [keys.downArrow] = "downArrow",
[keys.insert] = "insert", [keys.delete] = "delete",
[keys.usual0] = "usual0", [keys.usual1] = "usual1",
[keys.usual2] = "usual2", [keys.usual3] = "usual3",
[keys.usual4] = "usual4", [keys.usual5] = "usual5",
[keys.usual6] = "usual6", [keys.usual7] = "usual7",
[keys.usual8] = "usual8", [keys.usual9] = "usual9",
[keys.a] = "a", [keys.b] = "b", [keys.c] = "c", [keys.d] = "d",
[keys.e] = "e", [keys.f] = "f", [keys.g] = "g", [keys.h] = "h",
[keys.i] = "i", [keys.k] = "k", [keys.j] = "j", [keys.l] = "l",
[keys.m] = "m", [keys.n] = "n", [keys.o] = "o", [keys.p] = "p",
[keys.q] = "q", [keys.r] = "r", [keys.s] = "s", [keys.t] = "t",
[keys.u] = "u", [keys.v] = "v", [keys.w] = "w", [keys.x] = "x",
[keys.y] = "y", [keys.z] = "z", [keys.numbpad1] = "numbpad1",
[keys.numbpad2] = "numbpad2", [keys.numbpad3] = "numbpad3",
[keys.numbpad4] = "numbpad4", [keys.numbpad5] = "numbpad5",
[keys.numbpad6] = "numbpad6", [keys.numbpad7] = "numbpad7",
[keys.numbpad8] = "numbpad8", [keys.numbpad9] = "numbpad9",
[keys.numbpadAsterix] = "numbpadAsterix",
[keys.numbpadPlus] = "numbpadPlus",
[keys.numbpadMinus] = "numbpadMinus",
[keys.numbpadForwardSlash] = "numbpadForwardSlash",
[keys.f1] = "f1", [keys.f2] = "f2", [keys.f3] = "f3",
[keys.f4] = "f4", [keys.f5] = "f5", [keys.f6] = "f6",
[keys.f7] = "f7", [keys.f8] = "f8", [keys.f9] = "f9",
[keys.f10] = "f10", [keys.f11] = "f11", [keys.f12] = "f12",
[keys.numlock] = "numlock", [keys.scrollLock] = "scrollLock",
[keys.semicolon] = "semicolon", [keys.equals] = "equals",
[keys.comma] = "comma", [keys.hyphen] = "hyphen",
[keys.period] = "period", [keys.forwardSlash] = "forwardSlash",
[keys.apostrophe] = "apostrophe",
[keys.leftSquareBracket] = "leftSquareBracket",
[keys.backslash] = "backslash", [keys.rightSquareBracket] = "rightSquareBracket",
}
local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local playerKeys = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local playersGodFly = {}
local godGroundsId = 0
local bindKeyStatus = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
telekinesisMedium = {
name = "telekinesisMedium",
requiments = {
mana = 50,
level = 3,
},
key = keys.v,
expGain = 3,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 9, 100,false)
end
},
randomTp = {
name = "randomTp",
requiments = {
mana = 100,
level = 3,
},
key = keys.c,
expGain = 4,
call = function (x, y, dir, name)
local randomX = math.random(10, 790)
local randomY = math.random(10, 390)
tfm.exec.movePlayer(name,randomX,randomY,false,0,0,false)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.spacebar] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.leftArrow] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.rightArrow] = true, [keys.d] = true},
adminKeys = {[keys.apostrophe] = true},
downKeys = {[keys.s] = true, [keys.downArrow] = true},
jumpKeys = {[keys.w] = true, [keys.upArrow] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
for somekey in pairs(playersGodFly) do
if (somekey == n) then
if settings.rightKeys[key] then
playersGodFly[n].x = playersGodFly[n].x + 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.leftKeys[key] then
playersGodFly[n].x = playersGodFly[n].x - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif (settings.flyKeys[key]) or (settings.jumpKeys[key]) then
playersGodFly[n].y = playersGodFly[n].y - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.downKeys[key] then
if (playersGodFly[n].y < 385) then
playersGodFly[n].y = playersGodFly[n].y + 25
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
end
end
end
if not bindKeyStatus[n] then
return
end
if bindKeyStatus[n].id == 1 then
for someKey in pairs(playerKeys[n]) do
if someKey == bindKeyStatus[n].name then
playerKeys[n][someKey] = key
bindKeyStatus[n].id = 0
bindKeyStatus[n].text = "\n(click at button name to change button for this skill)"
updateSkillsTextarea(n)
end
end
elseif rpgmodule[n] == nil then
return false
elseif not getSkillKey(key, n) then
return
else
local currentSkill = getSkillKey(key, n)
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction, n)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end
end


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


function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode, name)
for key in pairs(playerKeys[name]) do
if playerKeys[name][key] == keyCode then
return key
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: <vp>" .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "</vp>\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: <bv>" .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")</bv>\n"
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,60,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end

for key in pairs(playersGodFly) do
tfm.exec.movePlayer(key, playersGodFly[key].x, playersGodFly[key].y ,false,0,10, false)
if (tfm.get.room.playerList[key]) then
if (tfm.get.room.playerList[key].movingLeft) then
playersGodFly[key].x = playersGodFly[key].x - 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+ 15, playersGodFly[key].id)
elseif (tfm.get.room.playerList[key].movingRight) then
playersGodFly[key].x = playersGodFly[key].x + 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+15, playersGodFly[key].id)
end
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
updateSkillsTextarea(name)
end


function eventStartRpg(name)
if (not rpgmodule[name]) then
createStats(name)
end
bindPlayerKeys(name)
createTextArea(name)
addSkillsTextarea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function bindPlayerKeys(name)
playerKeys[name] = {}
for k in pairs(skills) do
playerKeys[name][k] = skills[k].key
end
bindKeyStatus[name] = {}
bindKeyStatus[name].text = "\n(click at button name to change button for this skill)"
bindKeyStatus[name].id = 0
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[<CH>" .. skills[k].name .. "</CH>] - {"
for someKey in pairs(playerKeys[n]) do
if (someKey == skills[k].name) then
answer = answer .. makeClickable(keyNames[playerKeys[n][someKey]], "chButton"..skills[k].name)
end
end
answer = answer .. "}: " .. skills[k].requiments.mana .. "\n"
end
end
answer = answer .. bindKeyStatus[n].text .. "\n"
return answer
end


function addSkillsTextarea(n)
updateSkillsTextarea(n)
end


function updateSkillsTextarea(n)
if (rpgmodule[n]) then
if (rpgmodule[n].skillsTextarea) then
createSkillsTextarea(n)
ui.updateTextArea(2,getAvaibleSkills(n),n)
else
createSkillsTextarea(n)
end
else
createSkillsTextarea(n)
end
end


function createSkillsTextarea(n)
ui.addTextArea(2,getAvaibleSkills(n),n ,-270,0,150,200,0x324650,0x212F36,0.8,true)
rpgmodule[n].skillsTextarea = true
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
result = result.. "godFly("

for name in pairs(playersGodFly) do
if (playersGodFly[name].name == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "noGodFly"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "godFly"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 6) == "godFly") then
startGodFly(string.sub(s, 7))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "noGodFly") then
endGodFly(string.sub(s, 9))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "chButton") then
bindKeyStatus[playerName] = {}
bindKeyStatus[playerName].text = "\n(press button to set it 'active' for skill '" .. (string.sub(s, 9)) .. "')"
bindKeyStatus[playerName].id = 1
bindKeyStatus[playerName].name = (string.sub(s, 9))
updateSkillsTextarea(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


function startGodFly(name)
godGroundsId = godGroundsId + 1
playersGodFly[name] = {}
playersGodFly[name].name = name
playersGodFly[name].id = godGroundsId
playersGodFly[name].x = tfm.get.room.playerList[name].x
playersGodFly[name].y = tfm.get.room.playerList[name].y
addGodGround(playersGodFly[name].x, playersGodFly[name].y+15, playersGodFly[name].id)
end


function addGodGround(x, y, id)
tfm.exec.addPhysicObject(id, x, y,{
type=12,
restitution=0,
friction=30,
width=1,
height=1,
groundCollision=true
})
end


function endGodFly(name)
tfm.exec.removePhysicObject(playersGodFly[name].id)
playersGodFly[name] = NIL
end


function checkGodFly(name)
local some = {}
for keys in pairs(playersGodFly) do
if (playersGodFly[keys].name == name) then
some[name] = 1
end
end
if some[name] == 1 then
endGodFly(name)
some[name] = 0
else
startGodFly(name)
end
end


main()


function eventChatCommand(name,command)
if command=="biggest" then
tfm.exec.changePlayerSize(name, 5)
elseif command=="bigger" then
tfm.exec.changePlayerSize(name, 4)
elseif command=="big" then
tfm.exec.changePlayerSize(name, 3)
elseif command=="medium" then
tfm.exec.changePlayerSize(name, 2)
elseif command=="normal" then
tfm.exec.changePlayerSize(name, 1)
elseif command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
elseif command=="smaller" then
tfm.exec.changePlayerSize(name, 0.35)
elseif command=="smallest" then
tfm.exec.changePlayerSize(name, 0)
elseif command=="tp" then
eventTpMouse(name)
elseif command=="rpgmodule" then
eventStartRpg(name)
elseif command=="godfly" then
checkGodFly(name)
elseif command=="shaman" then
tfm.exec.setShaman(name)
elseif command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
v 0.2.6.2
New command:
  • !shaman - makes mice shaman

Bugs fixed:
  • repeat dying if mice with !godfly reached y coords > 400
  • uncorrect showing of skill list after leaving and joing romm once more



Dernière modification le 1589832000000
Pagoda
« Citoyen »
Membre
1628425020000
    • Pagoda#4165
    • Profil
    • Derniers messages
    • Tribu
#15
  1
  • General
  • Info
  • Code
  • Secret Picture!
v 0.2.6.2
New command
Functions:

Commands:
  • "!clean" — Cleans up all of the objects in a room after it has been trashed by shamans

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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
local keys = { backspace = 8, tab = 9, enter = 13, shift = 16, 
control = 17, alt = 18, pause = 19, capsLock = 20, escape = 27,
spacebar = 32, pageUp = 33, pageDown = 34, endButton = 35, home = 36,
leftArrow = 37, upArrow = 38, rightArrow = 39, downArrow = 40,
insert = 45, delete = 46, usual0 = 48, usual1 = 49, usual2 = 50,
usual3 = 51, usual4 = 52, usual5 = 53, usual6 = 54, usual7 = 55,
usual8 = 56, usual9 = 57, a = 65, b = 66, c = 67, d = 68, e = 69,
f = 70, g = 71, h = 72, i = 73, k = 74, j = 75, l = 76,
m = 77, n = 78, o = 79, p = 80, q = 81, r = 82, s = 83, t = 84,
u = 85, v = 86, w = 87, x = 88, y = 89, z = 90, numbpad1 = 97,
numbpad2 = 98, numbpad3 = 99, numbpad4 = 100, numbpad5 = 101,
numbpad6 = 102, numbpad7 = 103, numbpad8 = 104, numbpad9 = 105,
numbpadAsterix = 106, numbpadPlus = 107, numbpadMinus = 109,
numbpadForwardSlash = 110, f1 = 112, f2 = 113, f3 = 114, f4 = 115,
f5 = 116, f6 = 117, f7 = 118, f8 = 119, f9 = 120, f10 = 121,
f11 = 122, f12 = 123, numlock = 144, scrollLock = 145,
semicolon = 186, equals = 187, comma = 188, hyphen = 189,
period = 190, forwardSlash = 191, apostrophe = 192,
leftSquareBracket = 219, backslash = 220, rightSquareBracket = 221,
}
local keyNames = { [keys.backspace] = "backspace", [keys.tab] = "tab",
[keys.enter] = "enter", [keys.shift] = "shift",
[keys.control] = "control", [keys.alt] = "alt",
[keys.pause] = "pause", [keys.capsLock] = "capsLock",
[keys.escape] = "escape", [keys.spacebar] = "spacebar",
[keys.pageUp] = "pageUp", [keys.pageDown] = "pageDown",
[keys.endButton] = "endButton", [keys.home] = "home",
[keys.leftArrow] = "leftArrow", [keys.upArrow] = "upArrow",
[keys.rightArrow] = "rightArrow", [keys.downArrow] = "downArrow",
[keys.insert] = "insert", [keys.delete] = "delete",
[keys.usual0] = "usual0", [keys.usual1] = "usual1",
[keys.usual2] = "usual2", [keys.usual3] = "usual3",
[keys.usual4] = "usual4", [keys.usual5] = "usual5",
[keys.usual6] = "usual6", [keys.usual7] = "usual7",
[keys.usual8] = "usual8", [keys.usual9] = "usual9",
[keys.a] = "a", [keys.b] = "b", [keys.c] = "c", [keys.d] = "d",
[keys.e] = "e", [keys.f] = "f", [keys.g] = "g", [keys.h] = "h",
[keys.i] = "i", [keys.k] = "k", [keys.j] = "j", [keys.l] = "l",
[keys.m] = "m", [keys.n] = "n", [keys.o] = "o", [keys.p] = "p",
[keys.q] = "q", [keys.r] = "r", [keys.s] = "s", [keys.t] = "t",
[keys.u] = "u", [keys.v] = "v", [keys.w] = "w", [keys.x] = "x",
[keys.y] = "y", [keys.z] = "z", [keys.numbpad1] = "numbpad1",
[keys.numbpad2] = "numbpad2", [keys.numbpad3] = "numbpad3",
[keys.numbpad4] = "numbpad4", [keys.numbpad5] = "numbpad5",
[keys.numbpad6] = "numbpad6", [keys.numbpad7] = "numbpad7",
[keys.numbpad8] = "numbpad8", [keys.numbpad9] = "numbpad9",
[keys.numbpadAsterix] = "numbpadAsterix",
[keys.numbpadPlus] = "numbpadPlus",
[keys.numbpadMinus] = "numbpadMinus",
[keys.numbpadForwardSlash] = "numbpadForwardSlash",
[keys.f1] = "f1", [keys.f2] = "f2", [keys.f3] = "f3",
[keys.f4] = "f4", [keys.f5] = "f5", [keys.f6] = "f6",
[keys.f7] = "f7", [keys.f8] = "f8", [keys.f9] = "f9",
[keys.f10] = "f10", [keys.f11] = "f11", [keys.f12] = "f12",
[keys.numlock] = "numlock", [keys.scrollLock] = "scrollLock",
[keys.semicolon] = "semicolon", [keys.equals] = "equals",
[keys.comma] = "comma", [keys.hyphen] = "hyphen",
[keys.period] = "period", [keys.forwardSlash] = "forwardSlash",
[keys.apostrophe] = "apostrophe",
[keys.leftSquareBracket] = "leftSquareBracket",
[keys.backslash] = "backslash", [keys.rightSquareBracket] = "rightSquareBracket",
}

local strongAdmins = {"Zarimona#7336", "Aen_elle#0000",}
local admins = {}
local players = {}
local rpgmodule = {}
local playerKeys = {}
local textAreas = {}
local adminPanelStatus = {}
local adminTp = {}
local playersGodFly = {}
local godGroundsId = 0
local bindKeyStatus = {}
local skills = {
snowStar = {
name = "snowStar",
requiments = {
mana = 30,
level = 1,
},
key = keys.h,
expGain = 1,
call = function (x, y, dir)
local crd = dir * 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd, y, 0, spd, 0)
tfm.exec.addShamanObject(34, x - crd, y, 0, -spd, 0)
tfm.exec.addShamanObject(34, x + crd, y + crd, 0, spd, spd)
tfm.exec.addShamanObject(34, x - crd, y + crd, 0, -spd, spd)
tfm.exec.addShamanObject(34, x + crd, y - crd*2, 0, spd, -spd)
tfm.exec.addShamanObject(34, x - crd, y - crd*2, 0, -spd, -spd)
end
},
snowFall = {
name = "snowFall",
requiments = {
mana = 50,
level = 1,
},
key = keys.g,
expGain = 1,
call = function (x, y, dir)
local crd = 10
local spd = 10 * dir
tfm.exec.addShamanObject(34, x + crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x + crd*6, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*2, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*4, y - crd*6, 0, spd, spd/4)
tfm.exec.addShamanObject(34, x - crd*6, y - crd*6, 0, spd, spd/4)
end
},
telekinesisLow = {
name = "telekinesisLow",
requiments = {
mana = 25,
level = 2,
},
key = keys.b,
expGain = 2,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 6, 100,false)
end
},
iceArrow = {
name = "iceArrow",
requiments = {
mana = 60,
level = 2,
},
key = keys.f,
expGain = 2,
call = function (x, y, dir)
local crd = 20
local spd = 30 * dir
tfm.exec.addShamanObject(34, x + (crd * dir), y - 10, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 9, 0, spd, 0)
tfm.exec.addShamanObject(34, x + (crd * dir) - 2 * dir, y - 11, 0, spd, 0)
end
},
telekinesisMedium = {
name = "telekinesisMedium",
requiments = {
mana = 50,
level = 3,
},
key = keys.v,
expGain = 3,
call = function (x, y, dir)
tfm.exec.explosion(x, y, 9, 100,false)
end
},
randomTp = {
name = "randomTp",
requiments = {
mana = 100,
level = 3,
},
key = keys.c,
expGain = 4,
call = function (x, y, dir, name)
local randomX = math.random(10, 790)
local randomY = math.random(10, 390)
tfm.exec.movePlayer(name,randomX,randomY,false,0,0,false)
end
},
}


local settings = {
throwKeys = {[keys.e] = true},
flyKeys = {[keys.spacebar] = true},
starThrowKeys = {[keys.h] = true},
leftKeys = {[keys.leftArrow] = true, [keys.a] = true, [keys.q] = true},
rightKeys = {[keys.rightArrow] = true, [keys.d] = true},
adminKeys = {[keys.apostrophe] = true},
downKeys = {[keys.s] = true, [keys.downArrow] = true},
jumpKeys = {[keys.w] = true, [keys.upArrow] = true},
}


function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
for val in pairs(strongAdmins) do
admins[val] = strongAdmins[val]
end
system.disableChatCommandDisplay("adminpanel",true)
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 data.isDead then
return
end
if settings.rightKeys[key] then
player.direction = 1
elseif settings.leftKeys[key] then
player.direction = -1
elseif settings.adminKeys[key] then
for k, val in pairs(admins) do
if n == admins[k] then
if adminPanelStatus[n] == false then
showAdminPanel(n)
else
hideAdminPanel(n)
end
end
end
elseif settings.throwKeys[key] then
tfm.exec.addShamanObject(34, x + (20 * player.direction), y - 10, 0, math.random(8, 12) * player.direction, 0, false)
elseif settings.flyKeys[key] then
tfm.exec.movePlayer(n,0,0,false,0,-50,false)
end
for somekey in pairs(playersGodFly) do
if (somekey == n) then
if settings.rightKeys[key] then
playersGodFly[n].x = playersGodFly[n].x + 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.leftKeys[key] then
playersGodFly[n].x = playersGodFly[n].x - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif (settings.flyKeys[key]) or (settings.jumpKeys[key]) then
playersGodFly[n].y = playersGodFly[n].y - 15
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
elseif settings.downKeys[key] then
if (playersGodFly[n].y < 385) then
playersGodFly[n].y = playersGodFly[n].y + 25
addGodGround(playersGodFly[n].x, playersGodFly[n].y+15, playersGodFly[n].id)
end
end
end
end
if not bindKeyStatus[n] then
return
end
if bindKeyStatus[n].id == 1 then
for someKey in pairs(playerKeys[n]) do
if someKey == bindKeyStatus[n].name then
playerKeys[n][someKey] = key
bindKeyStatus[n].id = 0
bindKeyStatus[n].text = "\n(click at button name to change button for this skill)"
updateSkillsTextarea(n)
end
end
elseif rpgmodule[n] == nil then
return false
elseif not getSkillKey(key, n) then
return
else
local currentSkill = getSkillKey(key, n)
if (rpgmodule[n].level >= skills[currentSkill].requiments.level) then
if (rpgmodule[n].mana >= skills[currentSkill].requiments.mana) then
reduceMana(n, skills[currentSkill].requiments.mana)
updateTextArea(n)
skills[currentSkill].call(x, y, player.direction, n)
raiseLevel(n, skills[currentSkill].expGain)
end
end
end
end


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

function eventTpMouse(name)
system.bindMouse(name, true)
end


function eventMouse(name, x, y)
for k, val in pairs(adminTp) do
if adminTp[k].admin == name then
tfm.exec.movePlayer(adminTp[k].target,x,y,false,0,0,false)
adminTp[k].admin = ""
adminTp[k].target = ""
system.bindMouse(name, false)
return
end
end
tfm.exec.movePlayer(name,x,y,false,0,0,false)
system.bindMouse(name, false)
end


function reduceMana(name, cost)
rpgmodule[name].mana = rpgmodule[name].mana - cost
end


function getSkillKey(keyCode, name)
for key in pairs(playerKeys[name]) do
if playerKeys[name][key] == keyCode then
return key
end
end
return false
end


function raiseLevel(n, expNum)
rpgmodule[n].exp = rpgmodule[n].exp + expNum
if rpgmodule[n].exp >= rpgmodule[n].expToLevel then
rpgmodule[n].exp = 0
rpgmodule[n].level = rpgmodule[n].level + 1
updateStats(n)
end
end


function updateInfo(name)
rpgmodule[name].infoString = "Player: " .. name .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Level: " .. rpgmodule
[name].level .. "\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Exp: <vp>" .. rpgmodule
[name].exp .. "/" .. rpgmodule[name].expToLevel .. "</vp>\n"
rpgmodule[name].infoString = rpgmodule[name].infoString .. "Mana: <bv>" .. rpgmodule
[name].mana .. "/"
rpgmodule[name].infoString = rpgmodule[name].infoString .. rpgmodule[name].maxMana
.. "(+" .. rpgmodule[name].manaRegen .. ")</bv>\n"
end


function createTextArea(name)
updateInfo(name)
ui.addTextArea(1, rpgmodule[name].infoString,
name,920,0,200,60,0x324650,0x212F36,0.8,true)
end


function eventLoop()
for key, val in pairs(rpgmodule) do
if rpgmodule[key].mana < (rpgmodule[key].maxMana) then
if rpgmodule[key].mana <= (rpgmodule[key].maxMana - rpgmodule[key].manaRegen) then
rpgmodule[key].mana = rpgmodule[key].mana + rpgmodule[key].manaRegen
else
rpgmodule[key].mana = rpgmodule[key].maxMana
end
updateTextArea(rpgmodule[key].name)
end
end

for key in pairs(playersGodFly) do
tfm.exec.movePlayer(key, playersGodFly[key].x, playersGodFly[key].y ,false,0,10, false)
if (tfm.get.room.playerList[key]) then
if (tfm.get.room.playerList[key].movingLeft) then
playersGodFly[key].x = playersGodFly[key].x - 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+ 15, playersGodFly[key].id)
elseif (tfm.get.room.playerList[key].movingRight) then
playersGodFly[key].x = playersGodFly[key].x + 25
addGodGround(playersGodFly[key].x, playersGodFly[key].y+15, playersGodFly[key].id)
end
end
end
end


function updateTextArea(name)
updateInfo(name)
ui.updateTextArea(1, rpgmodule[name].infoString, name)
updateSkillsTextarea(name)
end


function eventStartRpg(name)
if (not rpgmodule[name]) then
createStats(name)
end
bindPlayerKeys(name)
createTextArea(name)
addSkillsTextarea(name)
end


function createStats(n)
rpgmodule[n] = {
name = n,
level = 1,
mana = 0,
exp = 0,
}
updateStats(n)
end


function updateStats(n)
rpgmodule[n].maxMana = 75 + (rpgmodule[n].level * 25)
rpgmodule[n].manaRegen = 8 + (rpgmodule[n].level * 2)
rpgmodule[n].expToLevel = rpgmodule[n].level * 100
end


function bindPlayerKeys(name)
playerKeys[name] = {}
for k in pairs(skills) do
playerKeys[name][k] = skills[k].key
end
bindKeyStatus[name] = {}
bindKeyStatus[name].text = "\n(click at button name to change button for this skill)"
bindKeyStatus[name].id = 0
end


function getAvaibleSkills(n)
local answer = "Avaible skills:\n"
for k, val in pairs(skills) do
if (rpgmodule[n].level >= skills[k].requiments.level) then
answer = answer .. "[<CH>" .. skills[k].name .. "</CH>] - {"
for someKey in pairs(playerKeys[n]) do
if (someKey == skills[k].name) then
answer = answer .. makeClickable(keyNames[playerKeys[n][someKey]], "chButton"..skills[k].name)
end
end
answer = answer .. "}: " .. skills[k].requiments.mana .. "\n"
end
end
answer = answer .. bindKeyStatus[n].text .. "\n"
return answer
end


function addSkillsTextarea(n)
updateSkillsTextarea(n)
end


function updateSkillsTextarea(n)
if (rpgmodule[n]) then
if (rpgmodule[n].skillsTextarea) then
createSkillsTextarea(n)
ui.updateTextArea(2,getAvaibleSkills(n),n)
else
createSkillsTextarea(n)
end
else
createSkillsTextarea(n)
end
end


function createSkillsTextarea(n)
ui.addTextArea(2,getAvaibleSkills(n),n ,-270,0,150,200,0x324650,0x212F36,0.8,true)
rpgmodule[n].skillsTextarea = true
end


function showAdminPanel(n)
textAreas.admin = "mainAdmin"
local text = ""
for k, val in pairs(players) do
text = text.. getPlayerInfo(k)
end
text = text.. "\n"
text = text.. addCloseUpdateButton(textAreas.admin, n)
ui.addTextArea(textAreas.admin,text,n,50,50,700,300,0x324650,0x212F36,0.8,true)
adminPanelStatus[n] = true
end


function hideAdminPanel(n)
ui.removeTextArea("mainAdmin", n)
adminPanelStatus[n] = false
print(n)
end


function getPlayerInfo(n)
local result = " Player: " .. n
if (rpgmodule[n]) then
result = result.. " Level: " .. rpgmodule[n].level
result = result.. "("..makeClickable("edit", "edit"..n.."Level")..")"
result = result.. " Exp: " .. rpgmodule[n].exp
result = result.. "("..makeClickable("edit", "edit"..n.."Exp")..")"
end
result = result.. " Do: " .. makeClickable("kill", "kill"..n).." "
result = result.. makeClickable("cheese", "cheese"..n).." "
result = result.. makeClickable("tp", "tp"..n).." "
result = result.. makeClickable("shaman", "shaman"..n).." "
result = result.. "moder("
local some = {}
for name in pairs(admins) do
if (admins[name] == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "nomoder"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "moder"..n)..") "
end
result = result.. "godFly("

for name in pairs(playersGodFly) do
if (playersGodFly[name].name == n) then
some[n] = 1
end
end
if some[n] == 1 then
result = result.. makeClickable("yes", "noGodFly"..n)..") "
some[n] = 0
else
result = result.. makeClickable("no", "godFly"..n)..") "
end
return "\n"..result
end


function makeClickable(text, eventName)
local text = "<bv><a href='event:"..eventName.."'>"..text.."</a></bv>"
return text
end


function eventTextAreaCallback(textAreaID, playerName, callback)
print(playerName.." clicked on Text Area "..textAreaID.." on the event '"..callback.."'.")
local s = callback
if (s == "mainAdminClose") then
hideAdminPanel(playerName)
elseif (s == "mainAdminUpdate") then
showAdminPanel(playerName)
elseif (s == "returnToPanel") then
showAdminPanel(playerName)
elseif (string.sub(s, 1, 4) == "kill") then
tfm.exec.killPlayer(string.sub(s, 5))
elseif (string.sub(s, 1, 6) == "cheese") then
tfm.exec.giveCheese(string.sub(s, 7))
elseif (string.sub(s, 1, 6) == "shaman") then
tfm.exec.setShaman(string.sub(s, 7))
elseif (string.sub(s, 1, 5) == "moder") then
admins[#admins + 1] = string.sub(s, 6)
showAdminPanel(playerName)
elseif (string.sub(s, 1, 6) == "godFly") then
startGodFly(string.sub(s, 7))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "noGodFly") then
endGodFly(string.sub(s, 9))
showAdminPanel(playerName)
elseif (string.sub(s, 1, 8) == "chButton") then
bindKeyStatus[playerName] = {}
bindKeyStatus[playerName].text = "\n(press button to set it 'active' for skill '" .. (string.sub(s, 9)) .. "')"
bindKeyStatus[playerName].id = 1
bindKeyStatus[playerName].name = (string.sub(s, 9))
updateSkillsTextarea(playerName)
elseif (string.sub(s, 1, 7) == "nomoder") then
for name in pairs(admins) do
if admins[name] == string.sub(s, 8) then
print(string.sub(s, 8))
for adm in pairs(strongAdmins) do
if (strongAdmins[adm] == string.sub(s, 8)) then
return
end
end
admins[name] = ''
hideAdminPanel(string.sub(s, 8))
end
end
showAdminPanel(playerName)
elseif (string.sub(s, 1, 2) == "tp") then
adminTp[playerName] = {}
adminTp[playerName].admin = playerName
adminTp[playerName].target = string.sub(s, 3)
hideAdminPanel(playerName)
system.bindMouse(playerName, true)
elseif (string.sub(s, 1, 4) == "edit") then
if (string.sub(s, string.len(s)-4) == "Level") then
local tarPl = string.sub(s, 5, string.len(s)-5)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Level"), playerName)
elseif (string.sub(s, string.len(s)-2) == "Exp") then
local tarPl = string.sub(s, 5, string.len(s)-3)
ui.updateTextArea("mainAdmin", adminEditStats(tarPl, "Exp"), playerName)
end
elseif (string.sub(s, 1, 6) == "change") then
local stat = ""
local number = 0
local tarPl = ""
if string.sub(s, string.len(s)-4, string.len(s)-2) == "Exp" then
stat = "Exp"
tarPl = string.sub(s, 7, string.len(s)-5)
else
stat = "Level"
tarPl = string.sub(s, 7, string.len(s)-7)
end
if (string.sub(s, string.len(s)-1) == "-3") then
number = -3
elseif (string.sub(s, string.len(s)-1) == "-2") then
number = -2
elseif (string.sub(s, string.len(s)-1) == "-1") then
number = -1
elseif (string.sub(s, string.len(s)-1) == "+1") then
number = 1
elseif (string.sub(s, string.len(s)-1) == "+2") then
number = 2
elseif (string.sub(s, string.len(s)-1) == "+3") then
number = 3
end
editPlayerStat(tarPl, stat, number)
updateStats(tarPl)
updateTextArea(tarPl)
showAdminPanel(playerName)
end
end


function editPlayerStat(n, stat, num)
if stat == "Level" then
if (rpgmodule[n].level + num) < 1 then
return
else
rpgmodule[n].level = rpgmodule[n].level + num
end
elseif stat == "Exp" then
if (rpgmodule[n].exp + num * 20) < 1 then
return
else
rpgmodule[n].exp = rpgmodule[n].exp + num * 20
end
end
end


function adminEditStats(n, stat)
local text = "Edit " ..n.." "..stat..": "
if stat == "Exp" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i*20), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i*20, "change"..n..stat..i).." "
end
end
elseif stat == "Level" then
for i=-3, 3, 1 do
if i > 0 then
text = text.. makeClickable("+"..(i), "change"..n..stat.."+"..i).." "
elseif i < 0 then
text = text.. makeClickable(i, "change"..n..stat..i).." "
end
end
end
text = text.. makeClickable("Cancel", "returnToPanel")
return text
end


function addCloseUpdateButton(id)
local text = "<bv><font size='16'><p align='center'><a href='event:"..id.."Update".."'>Update</a></p></font></bv>"
text = text.. "<bv><font size='16'><p align='center'><a href='event:"..id.."Close".."'>Close</a></p></font></bv>"
return text
end


function startGodFly(name)
godGroundsId = godGroundsId + 1
playersGodFly[name] = {}
playersGodFly[name].name = name
playersGodFly[name].id = godGroundsId
playersGodFly[name].x = tfm.get.room.playerList[name].x
playersGodFly[name].y = tfm.get.room.playerList[name].y
addGodGround(playersGodFly[name].x, playersGodFly[name].y+15, playersGodFly[name].id)
end


function addGodGround(x, y, id)
tfm.exec.addPhysicObject(id, x, y,{
type=12,
restitution=0,
friction=30,
width=1,
height=1,
groundCollision=true
})
end


function endGodFly(name)
tfm.exec.removePhysicObject(playersGodFly[name].id)
playersGodFly[name] = NIL
end


function checkGodFly(name)
local some = {}
for keys in pairs(playersGodFly) do
if (playersGodFly[keys].name == name) then
some[name] = 1
end
end
if some[name] == 1 then
endGodFly(name)
some[name] = 0
else
startGodFly(name)
end
end


main()


function eventChatCommand(name,command)
local IDList = {}

if command=="clean" then
for id, object in pairs(tfm.get.room.objectList) do
table.insert(IDList, id)
end
for i, id in pairs(IDList) do
tfm.exec.removeObject(id)
end
elseif command=="biggest" then
tfm.exec.changePlayerSize(name, 5)
elseif command=="bigger" then
tfm.exec.changePlayerSize(name, 4)
elseif command=="big" then
tfm.exec.changePlayerSize(name, 3)
elseif command=="medium" then
tfm.exec.changePlayerSize(name, 2)
elseif command=="normal" then
tfm.exec.changePlayerSize(name, 1)
elseif command=="small" then
tfm.exec.changePlayerSize(name, 0.65)
elseif command=="smaller" then
tfm.exec.changePlayerSize(name, 0.35)
elseif command=="smallest" then
tfm.exec.changePlayerSize(name, 0)
elseif command=="tp" then
eventTpMouse(name)
elseif command=="rpgmodule" then
eventStartRpg(name)
elseif command=="godfly" then
checkGodFly(name)
elseif command=="shaman" then
tfm.exec.setShaman(name)
elseif command=="adminpanel" then
for k, val in pairs(admins) do
if name == admins[k] then
showAdminPanel(name)
end
end
end
end
https://i.ibb.co/y6jvD0W/Eyyea-ICVc-AE5ht-N.png
  • Tribus
  • /
  • We Dance A Lot
  • /
  • Lua code's
  • /
  • Lua for tribe house
© Atelier801 2018

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

Version 1.27