SHOW:
|
|
- or go back to the newest paste.
1 | local admins = {"Thetroz"} | |
2 | local banlist = {} | |
3 | ||
4 | ui.addPopup (1,0,"Bienvenido a Spiritcheese, minijuego creado por Flingoyo, Drymisty y Quesoyquesos, créditos a Thetroz por su valiosa ayuda. escribe !help para ver una lista de comandos y una pequeña ayuda.", nil, 250, 100, 300); | |
5 | for name in pairs (tfm.get.room.playerList) do | |
6 | system.bindMouse (name); | |
7 | end | |
8 | ||
9 | function eventMouse (playerName, x, y) | |
10 | tfm.exec.addShamanObject (24, x, y); | |
11 | end | |
12 | ||
13 | local maps = {"@4580112", "@4580134", "@4580171", "@4580165", "@4580177", "@4580185","@4580197", "@4580640", "@4580645", "@4581538", "@4581571"} | |
14 | ||
15 | function main() | |
16 | tfm.exec.disableAutoNewGame (true) | |
17 | tfm.exec.disableAutoTimeLeft (true) | |
18 | startNewGame(); | |
19 | end | |
20 | ||
21 | function startNewGame() | |
22 | tfm.exec.disableAutoShaman(true) | |
23 | tfm.exec.newGame (maps[math.random(#maps)]); | |
24 | tfm.exec.setGameTime (43); | |
25 | end | |
26 | ||
27 | function eventLoop (a, timeLeft) | |
28 | if timeLeft <= 0 then | |
29 | startNewGame(); | |
30 | end | |
31 | end | |
32 | ||
33 | function eventPlayerDied (playerName) | |
34 | local playersAlive = 0; | |
35 | local winner; | |
36 | ||
37 | for player in pairs(tfm.get.room.playerList) do | |
38 | if not tfm.get.room.playerList[player].isDead then | |
39 | playersAlive = playersAlive + 1; | |
40 | winner = player; | |
41 | end | |
42 | end | |
43 | ||
44 | if (playersAlive ==0) then | |
45 | startNewGame(); | |
46 | end | |
47 | end | |
48 | ||
49 | main(); | |
50 | ||
51 | - | function eventChatCommand(name,command) |
51 | + | |
52 | - | if command == "help" then |
52 | + | |
53 | - | ui.addPopup (0,0,"Haz click donde desees invocar una chispa, si quieres ponerle color a tu nombre escribe, !rojo o !azul, !amarillo, !naranja, !rosa, !verde.", name, 200, 100, 400) |
53 | + | |
54 | end | |
55 | - | tfm.exec.setNameColor(name, 0xFF0000) |
55 | + | |
56 | end | |
57 | - | tfm.exec.setNameColor(name, 0x000AFF) |
57 | + | |
58 | function isAdmin (playerName) | |
59 | - | tfm.exec.setNameColor(name, 0x32FF00) |
59 | + | |
60 | if playerName == adminName then return true end | |
61 | - | tfm.exec.setNameColor(name, 0xFD55FB) |
61 | + | |
62 | return false | |
63 | end | |
64 | ||
65 | - | tfm.exec.setNameColor(name, 0xFFEF00) |
65 | + | |
66 | if isBanned(playerName) then return end | |
67 | ||
68 | args = {} | |
69 | for arg in command:gmatch ("[^%s]+") do | |
70 | table.insert (args, arg) | |
71 | end | |
72 | ||
73 | if args[1] == "ban" and tfm.get.room.playerList[args[2]] then | |
74 | if isAdmin (playerName) then | |
75 | if isBanned(args[2]) then | |
76 | ui.addPopup (0, 0, "Error: "..args[2].." ya está banead@.", playerName, 350, 200, 100) | |
77 | elseif isAdmin(args[2]) then | |
78 | ui.addPopup (0, 0, "Error: "..args[2].." es un admin.", playerName, 350, 200, 100) | |
79 | else | |
80 | table.insert (banlist, args[2]) | |
81 | tfm.exec.killPlayer(args[2]); | |
82 | ui.addPopup (0, 0, "¡Has sido banead@! ", args[2], 350, 200, 100) | |
83 | ui.addPopup (1, 0, "¡"..args[2].." ha sido banead@!", playerName, 350, 200, 100) | |
84 | end | |
85 | else | |
86 | ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100) | |
87 | end | |
88 | elseif args[1] == "desban" and tfm.get.room.playerList[args[2]] then | |
89 | if isAdmin (playerName) then | |
90 | if not isBanned(args[2]) then | |
91 | ui.addPopup (0, 0, "Error: "..args[2].." no está baneado.", playerName, 350, 200, 100) | |
92 | else | |
93 | for i,bannedName in pairs(banlist) do | |
94 | if args[2] == bannedName then | |
95 | table.remove (banlist, i) | |
96 | break | |
97 | end | |
98 | end | |
99 | ui.addPopup (0, 0, "¡Has sido desbaneado!", args[2], 350, 200, 100) | |
100 | ui.addPopup (1, 0, "¡"..args[2].." ha sido desbaneado! :):)", playerName, 350, 200, 100) | |
101 | end | |
102 | else | |
103 | ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100) | |
104 | end | |
105 | ||
106 | elseif command == "help" then | |
107 | ui.addPopup (0,0,"Haz click donde desees invocar una chispa, si quieres ponerle color a tu nombre escribe, !rojo o !azul, !amarillo, !naranja, !rosa, !verde.", playerName, 200, 100, 400) | |
108 | elseif command == "rojo" then | |
109 | tfm.exec.setNameColor(playerName, 0xFF0000) | |
110 | elseif command == "azul" then | |
111 | tfm.exec.setNameColor(playerName, 0x000AFF) | |
112 | elseif command == "verde" then | |
113 | tfm.exec.setNameColor(playerName, 0x32FF00) | |
114 | elseif command == "rosa" then | |
115 | tfm.exec.setNameColor(playerName, 0xFD55FB) | |
116 | elseif command == "naranja" then | |
117 | tfm.exec.setNameColor(name, 0xFF9500) | |
118 | elseif command == "amarillo" then | |
119 | tfm.exec.setNameColor(playerName, 0xFFEF00) | |
120 | end | |
121 | end | |
122 | function eventNewGame (playerName) | |
123 | for _,playerName in pairs(banlist) do | |
124 | tfm.exec.killPlayer(playerName); | |
125 | end | |
126 | end | |
127 | ||
128 | function eventNewPlayer (playerName) | |
129 | if isBanned(playerName) then | |
130 | tfm.exec.killPlayer(playerName); | |
131 | end | |
132 | end | |
133 | ||
134 | function eventPlayerRespawn (playerName) | |
135 | if isBanned(playerName) then | |
136 | tfm.exec.killPlayer(playerName); | |
137 | end | |
138 | end |