Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- -- table and locals --
- data ={""}
- maps = {1}
- warCount = 0
- count = 0
- catchSoul = false
- local cm = tfm.get.room.community
- --Messages--
- welcomeMessage = {["EN"]="welcome to war! if is your first time here type !help to more info!";["BR"]="bem-vindo á war se é sua primeira vez aqui digite !help para mais informações!"}
- helpMessage = {["EN"]="war is a minigame where your goal is win the war. Each war have 20(twenty) rounds/maps, when a new war starts all players have 0(zero) coins, you can win coins by getting one of the three positions in the race for the cheese, you can type <B>!buy help</B> to open the shop. Good luck!";["BR"]="war é um minigame onde seu objetivo é ganhar a guerra. Cada guerra tem 20(vinte) rodadas/mapas, quando uma nova guerra inicia todos os jogadores têm coins 0(zero), você pode ganhar coins, obtendo uma das três posições na corrida para o queijo, você pode digitar <B>!buy help</B> para abrir a loja. Boa sorte!"}
- newWarMessage = {["EN"]="A new war is starting! Prepare for the fight.";["BR"]="Uma nova guerra está começando! Preparem-se para a luta."}
- getSoulMessage = {["EN"]="Is time to get coins! get the cheese for teen coins.";["BR"]="é hora de coletar coins! pegue o queijo para 10 coins."}
- getCheeseMessage ={["EN"]="Good! you get 10 coins!";["BR"]="Otimo! Você conseguiu 10 coins!"}
- getFirstMessage = {["EN"]=" get cheese in first! (s)he won 15 coins!";["BR"]=" conseguiu chegar em primeiro! Ele(a) recebeu 15 coins."}
- getSecondessage = {["EN"]=" get cheese in second! (s)he won 10 coins!";["BR"]=" conseguiu chegar em segundo! Ele(a) recebeu 10 coins."}
- getThirdMessage = {["EN"]=" get cheese in thrid! (s)he won 5 coins!";["BR"]=" conseguiu chegar em terceiro! Ele(a) recebeu 5 coins."}
- buyHelpMessage = {["EN"]="Avaliable commands:<BR>!shop coins - to see your coins.<BR>!shop powers - to see avaliable powers to buy.<BR>More cooming soon.";["BR"]="Comandos atuais:<BR>!buy coins - veja seus coins.<BR>!buy powers - para ver uma lista de poderes que podem ser comprados.<BR>Mais em breve."}
- coinsAmountMessage = {["EN"]="Actually, you have ",["BR"]="Atualmente você têm "}
- buyPowersMessage = {["EN"] ="Avaliable powers to buy: <BR>!power respawn - 20 coins - if you die, you can respawn, use one time. <BR>!power jump - 30 coins - you can press Z to have a jump boost, you can use two times. <BR>!power speed - 50 coins - you can press X to have a speed boost, you can use three times.";["BR"]="Poderes disponiveis:<BR>!power respawn - 20 coins - Se você morrer, você pode respawnar, usos : 1 vez. <BR>!power jump - 30 coins - te dá um impulso adicional, usos : 2 vezes.<BR>!power speed - 50 coins - te dá uma velocidade maior, usos : 3 vezes"}
- endOfWarMessage = {["EN"] ="The war ended, all coins/powers have been reset.";["BR"]="A guerra acabou, todas as moedas/poderes foram resetados."}
- buyRespawnPower = {["EN"]="You buyed one respawn power!";["BR"]="Você comprou um poder de respawn"}
- buyJumpPower = {["EN"]="You buyed two jump powers!";["BR"]="Você comprou dois poderes de pulo"}
- buySpeedPower = {["EN"]="You buyed three speed powers!";["BR"]="Você comprou três poderes de velocidade"}
- cantBuyPower = {["EN"]="You don't have enough coins to buy it.";["BR"]="Você não têm coins para comprar isto"}
- function newPlayerData(playerName)
- tfm.exec.bindKeyboard(playerName, 90, true, true)
- tfm.exec.bindKeyboard(playerName, 88, true, true)
- newData = {["banned"]=false;
- ["coins"]=0;
- ["respawns"]=0;
- ["jumps"]=0;
- ["speeds"]=0;}
- data[playerName] = newData
- end
- function message(sender,reciever,msg)
- print(string.format("<V>[%s]<N> <I>%s</I>",sender,msg),reciever)
- end
- function eventNewPlayer(playerName)
- if (cm =="BR") then
- message("Soldado",playerName,welcomeMessage.BR)
- else
- message("Soldier",playerName,welcomeMessage.EN)
- end
- newPlayerData(playerName)
- end
- function eventChatCommand(playerName, command)
- if (command=="help") then
- if (cm=="BR") then
- message("Inventor",playerName,helpMessage.BR)
- else
- message("Inventor",playerName,helpMessage.EN)
- end
- end
- if (command:sub(0,4)=="shop") then
- if (command:sub(6,10)=="help") then
- if (cm=="BR") then
- message("Vendedor",playerName,buyHelpMessage.BR)
- else
- message("Seller",playerName,buyHelpMessage.EN)
- end
- end
- if (command:sub(6,11)=="coins") then
- if (cm=="BR") then
- message("Vendedor",playerName,coinsAmountMessage.BR..data[playerName].coins.." coins.")
- else
- message("Seller",playerName,coinsAmountMessage.EN..data[playerName].coins.." coins.")
- end
- end
- if (command:sub(6,12)=="powers") then
- if (cm=="BR") then
- message("Vendedor",playerName,buyPowersMessage.BR)
- else
- message("Seller",playerName,buyPowersMessage.EN)
- end
- end
- end
- if (command:sub(0,5)=="power") then
- if (command:sub(7,14)=="respawn") then
- if data[playerName].coins > 20 then
- data[playerName].coins = data[playerName].coins -20
- data[playerName].respawns = data[playerName].respawns +1
- if (cm=="BR") then
- message("Vendedor",playerName,buyRespawnPower.BR)
- else
- message("Seller",playerName,buyRespawnPower.EN)
- end
- else
- if (cm=="BR") then
- message("Vendedor",playerName,cantBuyPower.BR)
- else
- message("Seller",playerName,cantBuyPower.EN)
- end
- end
- end
- if (command:sub(7,11)=="jump") then
- if data[playerName].coins > 30 then
- data[playerName].coins = data[playerName].coins -30
- data[playerName].jump = data[playerName].jumps +2
- if (cm=="BR") then
- message("Vendedor",playerName,buyJumpPower.BR)
- else
- message("Seller",playerName,buyJumpPower.EN)
- end
- else
- if (cm=="BR") then
- message("Vendedor",playerName,cantBuyPower.BR)
- else
- message("Seller",playerName,cantBuyPower.EN)
- end
- end
- end
- if (command:sub(7,12)=="speed") then
- if data[playerName].coins > 50 then
- data[playerName].coins = data[playerName].coins -50
- data[playerName].speeds = data[playerName].speeds +3
- if (cm=="BR") then
- message("Vendedor",playerName,buySpeedPower.BR)
- else
- message("Seller",playerName,buySpeedPower.EN)
- end
- else
- if (cm=="BR") then
- message("Vendedor",playerName,cantBuyPower.BR)
- else
- message("Seller",playerName,cantBuyPower.EN)
- end
- end
- end
- end
- end
- function eventNewGame()
- count = 0
- warCount = warCount+1
- if warCount == 10 then
- catchSoul = true
- if (cm=="BR") then
- message("General",nil,getSoulMessage.BR)
- else
- message("General",nil,getSoulMessage.EN)
- end
- end
- if warCount == 11 then
- catchSoul = false
- end
- if warCount == 21 then
- warCount = 0
- if (cm=="BR") then
- message("General",nil,endOfWarMessage.BR)
- else
- message("General",nil,endOfWarMessage.EN)
- end
- end
- end
- function eventPlayerWon(playerName)
- if (catchSoul == true) then
- if (cm=="BR") then
- message("General",nil,getCheeseMessage.BR)
- else
- message("General",nil,getCheeseMessage.EN)
- end
- data[playerName].coins = data[playerName].coins+10
- endé iss
- if (catchSoul == false) then
- count = count+1
- if (count == 1) then
- data[playerName].coins = data[playerName].coins+15
- if (cm=="BR") then
- message("Banker",nil,playerName..getFirstMessage.BR)
- else
- message("Banker",nil,playerName..getFirstMessage.EN)
- end
- end
- if (count == 2) then
- data[playerName].coins = data[playerName].coins+10
- if (cm=="BR") then
- message("Banker",nil,playerName..getSecondMessage.BR)
- else
- message("Banker",nil,playerName..getSecondessage.EN)
- end
- end
- if (count == 3) then
- data[playerName].coins = data[playerName].coins+5
- if (cm=="BR") then
- message("Banker",nil,playerName..getThirdMessage.BR)
- else
- message("Banker",nil,playerName..getThirdMessage.EN)
- end
- end
- end
- end
- function eventLoop(time,remaining)
- if (cm=="BR") then
- tfm.exec.setUIMapName(string.format("<N>Rodada: <V>%s/20",warCount))
- else
- tfm.exec.setUIMapName(string.format("<N>Round: <V>%s/20",warCount))
- end
- if remaining<=0 then
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- for playerName,name in pairs(tfm.get.room.playerList) do
- ui.addTextArea(0, string.format("<B> Info</B><BR><BR>Coins : %s<BR>Respawns: %s<BR>Jumps : %s<BR>Speeds : %s",data[playerName].coins,data[playerName].respawns,data[playerName].jumps,data[playerName].speeds), playerName, 714, 120, 80, 150, 1, 16777215, 0.5, true);
- end
- end
- function eventPlayerDied(playerName)
- local i=0
- for n,player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- i=i+1
- end
- end
- if i==0 then
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- if (data[playerName].respawns > 0) then
- tfm.exec.respawnPlayer(playerName)
- data[playerName].respawns = data[playerName].respawns -1
- end
- end
- tfm.exec.newGame(maps[math.random(#maps)])
- for player,name in pairs(tfm.get.room.playerList) do
- newPlayerData(player)
- end
Advertisement
Add Comment
Please, Sign In to add comment