View difference between Paste ID: xnRegPv5 and zUuLuYiU
SHOW: | | - or go back to the newest paste.
1-
 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);
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-
local maps = {"@4580112", "@4580134", "@4580171", "@4580165", "@4580177", "@4580185","@4580197", "@4580640", "@4580645"}
10+
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-
                tfm.exec.disableAutoShaman(true)
19+
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-
        if (playersAlive == 1) then
40+
41-
                tfm.exec.setGameTime (10);
41+
42-
               
42+
43-
        elseif (playersAlive ==0) then
43+
                   
44
        if (playersAlive ==0) then
45
                startNewGame();
46
        end
47
end
48
 
49
main();
50
 
51
function eventChatCommand(name,command)
52
    if command == "help" then
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)
54
        elseif command == "rojo" then
55
            tfm.exec.setNameColor(name, 0xFF0000)        
56
        elseif command == "azul" then
57
            tfm.exec.setNameColor(name, 0x000AFF)        
58
    elseif command == "verde" then
59
            tfm.exec.setNameColor(name, 0x32FF00)        
60
    elseif command == "rosa" then
61
            tfm.exec.setNameColor(name, 0xFD55FB)        
62
    elseif command == "naranja" then
63
        tfm.exec.setNameColor(name, 0xFF9500)        
64
    elseif command == "amarillo" then
65
        tfm.exec.setNameColor(name, 0xFFEF00)        
66
        end
67-
67+
68-
function eventPlayerDied (name)
68+
69-
	tfm.exec.respawnPlayer(name)
69+
function isBanned (playerName)
70
        for _,bannedName in pairs(banlist) do
71
                if playerName == bannedName then return true end
72
        end
73
        return false
74
end
75
 
76
function isAdmin (playerName)
77
        for _,adminName in pairs(admins) do
78
                if playerName == adminName then return true end
79
        end
80
        return false
81
end
82
 
83
function eventChatCommand (playerName, command)
84
        if isBanned(playerName) then return end
85
 
86
        args = {}
87
        for arg in command:gmatch ("[^%s]+") do
88
                table.insert (args, arg)
89
        end
90
 
91
        if args[1] == "ban" and tfm.get.room.playerList[args[2]] then
92
                if isAdmin (playerName) then
93
                        if isBanned(args[2]) then
94
                                ui.addPopup (0, 0, "Error: "..args[2].." ya está banead@.", playerName, 350, 200, 100)
95
                        elseif isAdmin(args[2]) then
96
                                ui.addPopup (0, 0, "Error: "..args[2].." es un admin.", playerName, 350, 200, 100)
97
                        else
98
                                table.insert (banlist, args[2])
99
                                tfm.exec.killPlayer(args[2]);
100
                                ui.addPopup (0, 0, "¡Has sido banead@! ", args[2], 350, 200, 100)
101
                                ui.addPopup (1, 0, "¡"..args[2].." ha sido banead@!", playerName, 350, 200, 100)
102
                        end
103
                else
104
                        ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
105
end
106
        elseif args[1] == "desban" and tfm.get.room.playerList[args[2]] then
107
                if isAdmin (playerName) then
108
                        if not isBanned(args[2]) then
109
                                ui.addPopup (0, 0, "Error: "..args[2].." no está baneado.", playerName, 350, 200, 100)
110
                        else
111
                                for i,bannedName in pairs(banlist) do
112
                                        if args[2] == bannedName then
113
                                                table.remove (banlist, i)
114
                                                break
115
                                        end
116
                                end
117
                                ui.addPopup (0, 0, "¡Has sido desbaneado!", args[2], 350, 200, 100)
118
                                ui.addPopup (1, 0, "¡"..args[2].." ha sido desbaneado! :):)", playerName, 350, 200, 100)
119
                        end
120
                else
121
                        ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
122
                        end
123
             end
124
    end
125
	
126
function eventNewGame (playerName)
127
        for _,playerName in pairs(banlist) do
128
                tfm.exec.killPlayer(playerName);
129
        end
130
end
131
 
132
function eventNewPlayer (playerName)
133
        if isBanned(playerName) then
134
                tfm.exec.killPlayer(playerName);
135
        end
136
end
137
 
138
function eventPlayerRespawn (playerName)
139
        if isBanned(playerName) then
140
                tfm.exec.killPlayer(playerName);
141
        end
142
end