JustPaste.it

admins = {"Mousecrewz", "Nick"}
version = 1.1

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

function eventLoop(timePassed, timeLeft)
if timeLeft < 500 or aliveMice == 0 then
doNextMap();
end
for i = 1, 100 do
for p in pairs(tfm.get.room.playerList) do
tfm.exec.setNameColor(p, randomColor());
end
end
end

function doNextMap()
tfm.exec.newGame(maplist[math.random(#maplist)]);
end

print("<J>Добро пожаловать в мини игру <b>Гоночная Сила</b>! Для получения подробной информации введите <i>!help</i>. Версия "..version..".")

function eventPlayerDied(pn)
aliveMice = aliveMice-1
end

function eventPlayerWon(pn)
aliveMice = aliveMice-1
end

tfm.exec.disableAutoNewGame(true);
maplist = {"4612295", "4465679", "4338921", "4337892", "4323335", "3544895", "646968", "3469987", "4035194", "2816067", "3592471", "2509175", "264132", "4271298", "210188", "211528", "4234534", "3999981", "4229660", "3953425", "1856349", "3638794", "4029729", "3877599", "2894072", "3652102", "4238784", "4148332", "3684229", "3688419", "3008155", "3684802", "3684465", "1689382", "1019378", "3685382", "3682405", "2796001", "1445160", "1051384", "1051378", "645288", "470687", "419374", "465205", "664949", "369230", "277687", "704015", "398942", "271523", "1787239", "354616", "294943", "323085", "3683600"};
doNextMap();

tfm.exec.disableAutoShaman(true);
tfm.exec.disableAutoShaman(true);

function randomColor()
return "0x" .. string.format("%X", math.random(0x000000, 0xFFFFFF))
end

function eventPlayerLeft(playerName)
print("<VP>Только не это!<J>"..playerName.." <VP>покинул комнату!")
end

function eventPlayerGetCheese(playerName)
print("<J>Ты взял сыр, а теперь отнеси его в нору первым и получи <b>+16</b> очков!")
end



function eventEmotePlayed(playerName,emote)
if emote == 9 then
tfm.exec.killPlayer(playerName)
end
end

function eventChatCommand(p,c)
if c == [[help]] then
ui.addPopup(0, 0,[[<J>Добро пожаловать в мини-игру <b>Гоночная сила</b>! Вы должны проходить карты, а за это вы будете получать очки, за которые сможете купить бонусы. Просто введите <i>!shop</i>. <br><br>Создатель мини-игры: Mousecrewz.<br><br>Помощь: Squalleze.]], p, 200, 100, 500)
elseif c == [[shop]] then
ui.addTextArea(0, [[<p align='center'><font size='18'>Магазинчик</font></p><br><font size='12'>Мип<br>Скорость<br>Полет<br>Телепорт<br>Сыр<br>Нора<br>Сыр и нора]], p, 300, 120, 200, 180, 768, 768, 0.8, true);
ui.addTextArea(1, [[<p align='center'><font size='18'>Магазинчик</font></p><br><font size='12'><p align='right'><a href=''>25 Очков</a><br><a href=''>50 Очков</a><br><a href=''>100 Очков</a><br><a href=''>200 Очков</a><br><a href=''>300 Очков</a><br><a href=''>300 Points</a><br><a href=''>500 Очков</a><br><br><br><br><br><br>__]], p, 300, 120, 200, 180, 768, 768, 0.0, true);
ui.addTextArea(2, [[<p align='center'><a href=''>Закрыть</a></p>]], p, 310, 270, 180, nil, 768, 768, 0.8, true);
end
end

info = {}

function eventNewPlayer(p)
if not info[p] then
data = {
["speed"] = false;
["fly"] = false;
["teleport"] = false;
["time"] = os.time()
}
info[p] = data
end
tfm.exec.bindKeyboard(p,32,true)
system.bindMouse(p, true)
print("<VP>Хорошие новости! <J>"..p.." <VP>вошел в комнату.")
end

for p in pairs(tfm.get.room.playerList) do
eventNewPlayer(p)
end

function eventNewGame()
aliveMice = 0
for p in pairs(tfm.get.room.playerList) do
info[p].speed = false
info[p].fly = false
info[p].teleport = false
aliveMice = aliveMice+1
end
tfm.exec.setUIMapName("<J>"..tfm.get.room.currentMap.." <G>| <VP>Гоночная сила");
end

function eventTextAreaCallback(t,p,c)
if c == [[close]] then
for i = 0,2 do
ui.removeTextArea(i,p)
end
elseif c == [[meep]] then
if tfm.get.room.playerList[p].score > 25 then
tfm.exec.setPlayerScore(p, -25, true)
tfm.exec.giveMeep(p)
end
elseif c == [[speed]] then
if tfm.get.room.playerList[p].score > 50 then
tfm.exec.setPlayerScore(p, -50, true)
info[p].speed = true
end
elseif c == [[fly]] then
if tfm.get.room.playerList[p].score > 100 then
tfm.exec.setPlayerScore(p, -100, true)
info[p].fly = true
end
elseif c == [[teleport]] then
if tfm.get.room.playerList[p].score > 200 then
tfm.exec.setPlayerScore(p, -200, true)
info[p].teleport = true
end
elseif c == [[cheese]] then
if tfm.get.room.playerList[p].score > 300 then
tfm.exec.setPlayerScore(p, -300, true)
tfm.exec.giveCheese(p)
end
elseif c == [[hole]] then
if tfm.get.room.playerList[p].score > 300 then
tfm.exec.setPlayerScore(p, -300, true)
tfm.exec.playerVictory(p)
end
elseif c == [[won]] then
if tfm.get.room.playerList[p].score > 500 then
tfm.exec.setPlayerScore(p, -500, true)
tfm.exec.giveCheese(p)
tfm.exec.playerVictory(p)
end
end
end

function eventKeyboard(p,k,d,x,y)
if info[p].fly == true then
if k == 32 then
tfm.exec.movePlayer(p,0,-1,true,0,-49,false)
end
elseif info[p].speed == true then
if k == 32 and tfm.get.room.playerList[p].isFacingRight == true and info[p].time < os.time()-1500 then
info[p].time = os.time()
tfm.exec.movePlayer(p,0,0,true,100,0,false)
elseif k == 32 and tfm.get.room.playerList[p].isFacingRight == false and info[p].time < os.time()-1500 then
info[p].time = os.time()
tfm.exec.movePlayer(p,0,0,true,-100,0,false)
end
end
end

function eventMouse(p, x, y)
if info[p].teleport == true then
tfm.exec.movePlayer(p, x, y, false, 0, 0, false)
end
end