SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | _____________________________________________________________________ | |
| 3 | | | | |
| 4 | | ____ _____ | | |
| 5 | | |___ \ |_ _| ___ __ _ _ __ ___ ___ | | |
| 6 | | __) | | | / _ \ / _` | | '_ ` _ \ / __| | | |
| 7 | | / __/ | | | __/ | (_| | | | | | | | \__ \ | | |
| 8 | | |_____| |_| \___| \__,_| |_| |_| |_| |___/ | | |
| 9 | | Remake By -Ctmce- v5.6beta | | |
| 10 | |_____________________________________________________________________| | |
| 11 | ||
| 12 | --]] | |
| 13 | ||
| 14 | --[[ | |
| 15 | CMDS: | |
| 16 | 1. !team1 "playername" "playername" \\Assign players to team1 , ex: !team1 Ctmce Ziggy_z | |
| 17 | 2. !team2 "playername "playername" \\Assign players to team2 , ex: !team2 Ctmce Ziggy_z | |
| 18 | 3. !add team1 "playername" "playername" \\Adds the player team1. | |
| 19 | 4. !add team2 "playername" "playername" \\Adds the player team2. | |
| 20 | 5. !remove team1 "playername" "playername" \\Removes the player/'s from team1! | |
| 21 | 6. !remove team2 "playername" "playername" \\Removes the player/'s from team2! | |
| 22 | 7. !exit \\Closing the Admin Panel// | |
| 23 | 8. !start \\Shows the Admin Panel back// | |
| 24 | 9. !sp team1 23 \\Sets the points for team1 to 23 or whatever you choose! | |
| 25 | 10. !sp team2 15 \\Sets the points for team1 to 15 or whatever you choose! | |
| 26 | 11. !aj on / off \\Turns AutoJoin On and Off. | |
| 27 | 12. !pause //pauses the game , and shows the gui back ^^ | |
| 28 | --------------------------------- | |
| 29 | Total Commands Count: [8]. | |
| 30 | Total BootcampMaps Count: [222]. | |
| 31 | Total RacingMaps Count: [1424]. | |
| 32 | --------------------------------- | |
| 33 | ||
| 34 | TODO: | |
| 35 | 1. Make 4 teams! | |
| 36 | --]] | |
| 37 | ||
| 38 | --Admin/Game Setup-- | |
| 39 | - | local Admin = "Eruptia#6455" --Write your name here to be able to use the Admin Panel-- |
| 39 | + | local Admin = "Stuckerrs#0000" --Write your name here to be able to use the Admin Panel-- |
| 40 | local ScoreToWin = 5 --Type here the amount of points need to win the game(Leave it at the same number it is right now if you want to change it in the Setup Panel)-- | |
| 41 | local autoJoin = true | |
| 42 | local team1Color = "Green" --List of colors ["Pink","Blue","Green","White"]-- | |
| 43 | local team2Color = "Blue" --List of colors ["Pink","Blue","Green","White"]-- | |
| 44 | local mod = "Bootcamp" | |
| 45 | --^^^^^^^^^^^^^^^^^^^CHANGE ONLY THE THINGS ABOVE^^^^^^^^^^^^^^^^^^^-- | |
| 46 | -------------- | |
| 47 | ||
| 48 | --DO NOT CHANGE THE SCRIPT!-- | |
| 49 | local teams = {Team1 = {}, Team2 = {}}
| |
| 50 | --Team score-- | |
| 51 | local teamScore = {Team1 = 0, Team2 = 0}
| |
| 52 | -------------- | |
| 53 | ---Maps--- | |
| 54 | local racingMaps = {"7025177","7046282","7047612","7049172","7053504","2283","2806","3154","72339","166705","237281","349389","103182","107544","112790","114122","117548","120152","122911","124359","130763","136966","138036","138678","407536","144468","144677","277731","146801","147436","148424","150692","152299","155168","156685","156847","6583596","159351","160762","161730","163682","164802","165112","165747","165843","5848412","167941","168776","380417","169892","171152","175205","176263","177236","177813","178545","178657","180191","180255","180274","180469","180509","180619","181312","184110","563303","185760","185774","186604","190026","191201","191716","191753","192391","192566","193009","193588","193936","195720","196433","196468","197219","197501","198549","198715","199219","201323","3679666","206810","208058","208162","208914","209315","209708","209799","210188","211528","211565","211885","212542","213331","213697","213933","214037","214660","214775","215938","216439","216505","216553","216735","217282","217881","217900","219548","220500","222098","223293","223810","223986","224441","225017","226069","226879","226883","227417","227851","228462","229814","229827","229830","229834","229835","229944","230510","230741","231254","231694","231905","232140","232274","232451","232699","232791","233230","233345","233398","233687","234039","234502","234959","235034","235501","235651","236146","237000","237041","237263","237269","237278","237321","237744","238380","238791","239626","239880","240544","240548","240973","241211","241295","242708","243279","244006","244699","244888","245223","246790","246973","247815","247818","248098","250610","251459","252759","252806","253883","254291","255098","255542","255893","258717","259604","259716","259833","260024","260292","260338","260377","260384","260678","261078","261172","261720","261959","262144","262212","262239","263163","263182","263624","263907","264132","264232","264348","235221","266704","266765","266807","266854","266913","266930","267187","267597","269337","270668","270819","271523","273434","274321","275017","275514","277687","277784","278506","278916","279100","279256","280382","280896","281730","282101","282434","282694","283526","283715","283874","284299","285752","286333","287268","289821","291628","292348","292614","293065","294522","294943","299002","299503","29971","300055","301315","302936","304356","305677","306213","308280","308435","308694","308711","308992","309029","309057","309169","309834","312713","313245","314159","314205","315801","316289","317696","317754","317779","318378","318813","319524","319841","321339","321712","321814","321906","322771","323115","323366","323600","324355","326585","327254","327266","330441","332210","332290","332467","333277","333656","333837","335507","337581","337774","339272","339418","339643","339896","340069","340901","341116","341239","344361","344865","344952","345257","245312","345943","348479","348801","349140","4581354","349984","350251","350519","352381","352710","352885","354616","354878","355658","355676","355769","355957","356722","356982","357328","357428","359055","359521","359901","360201","6414689","360273","360365","361382","362549","363411","363625","363638","363822","364186","364998","1512355","365464","365652","365774","365464","365652","365774","367520","369160","369230","370444","370850","371076","371078","372970","373511","375381","378826","379326","379550","379745","379866","381043","381287","381305","381569","381669","382977","384206","384869","385203","385295","386029","386046","386959","387012","387180","387270","387290","387638","388447","389582","391625","391693","391831","391868","391990","392446","392492","392913","393675","393851","394890","395459","395585","395607","396223","396332","396347","396645","396861","397296","397501","397812","397938","398011","398041","398081","398942","399633","399673","400429","400666","400866","5886096","401778","401945","401995","402214","402239","402453","402936","403698","403910","404440","404590","405075","405295","405339","405497","405679","405833","405955","406266","406486","406881","406982","407165","407230","407294","407455","407457","407488","407495","6127809","407686","407746","408978","409199","410230","410532","410565","410608","410736","410813","412211","412316","412657","412752","413408","414188","414460","414899","416015","416142","416552","418022","418196","418265","418293","418323","418337","418600","418606","418658","419374","419735","420806","420956","421302","421717","422361","422509","422580","422939","423062","423449","423517","423672","424361","424786","424795","425030","425044","425215","425349","425548","425600","425771","425797","425806","426638","427300","428517","429262","429822","429897","430145","430219","430736","431142","431373","431887","433937","434887","436041","436107","436447","437860","438154","440676","441047","441376","441598","443309","444490","444830","444964","445133","445219","447556","448281","452016","455167","459349","463195","463977","465205","468260","470687","470727","471053","472379","472665","475151","475790","477370","477603","480023","483924","484992","494706","496091","496945","499109","499682","499684","499687","500074","501428","501711","501916","504409","504461","504704","504951","505109","505963","506215","507308","507325","508106","508451","508796","509082","510194","511187","511275","512927","512291","514412","514510","514982","517005","517697","523046","528428","531569","536235","537776","538116","545493","549470","551126","556253","556426","558790","563183","563484","564033","566347","566438","571144","580031","583056","586622","586688","587458","590641","594049","594883","595447","603381","606719","606723","608459","610137","611320","613985","616373","616433","620996","624098","624721","627609","634945","645288","646800","658464","664949","667920","669031","670226","694900","704015","732880","734476","1445160","737841","749102","759128","763371","763378","789058","792062","798953","813156","824082","829657","838069","846805","849224","879616","905496","972616","976721","976786","979179","982242","1015436","1015582","1019378","1033170","1034035","1051378","1051384","1058681","1085530","1102815","1130728","1132639","1142116","1143815","1144548","1162611","1167734","1172426","1174107","1195842","1208798","1208979","1210037","1214182","1216253","1221661","1222899","1229246","1231216","1234914","1249601","1252122","1253523","1255130","1255148","1256845","1281700","1281981","1286910","1307880","1311059","1321417","1321664","1341396","1346440","1351308","1352534","1358446","1359797","1364063","1368222","1368233","1371239","1371294","1372941","1373000","1373748","1375345","1378209","1393405","1394120","1398732","1405249","1405496","1416040","1425101","1428436","1448760","1450554","1453667","1471124","1483155","1487161","1490438","1491022","1492120","1495344","1503393","1504586","1506007","1509474","1513407","1525272","1531388","1538895","1539515","1539791","1542618","1542736","1555532","1555862","1556661","1564762","1567620","1573213","1571997","1580508","1583655","1586439","1587904","1588884","1589026","1591471","1592767","1595600","1597594","1600443","1601492","1601786","1601857","1602654","1603050","1605364","1608259","1608638","1609978","1611631","1612436","1612796","1613550","1613927","1614563","1618110","1619934","1621611","1622737","1623300","1628732","1629164","1632294","1632541","1632706","1632746","1634741","1637638","1639996","1643157","1644638","1646120","1648583","1651658","1654096","1654105","1654841","1654903","1657021","1657360","1658171","1659639","1659716","1661852","1663380","1663415","1665249","1665516","1665775","1669046","1673174","1674534","1675083","1687268","1689382","1692628","1693705","1694602","1702169","1703617","1705316","1716693","1716949","1718723","1724289","1728943","1749434","1751944","1759287","1768347","1778687","1787232","1787239","1794287","1802907","1841744","1845710","1848032","1851411","1851568","1851968","1856349","1857829","1862800","1862823","1873736","1923785","1924227","1926831","1927270","1932796","1951856","1952851","1954369","1954898","1956002","1956555","1964700","1964752","1965819","1973574","1975275","1975286","1975684","1975753","1976007","1976857","1979131","1982476","1985019","1987990","2005559","2007170","2007205","2012147","2018511","2023552","2030343","3691622","2047177","2048474","2068543","2070768","2076632","2079190","2089069","2098621","2101747","2106576","2118599","2134537","2138401","2141379","2144010","2149382","2150335","2174319","2176620","2180790","2185089","2214661","2219308","2223685","2228834","2245005","2286056","2287914","2331474","2347666","2372538","2378820","2393139","2417713","2453022","2509175","2536577","2538131","2557885","2564883","2577060","2582610","2586491","2588032","2592421","5712914","2645615","2682985","2683170","2725924","2726034","5834732","2796001","2813487","2816067","2840770","2854246","2868414","2883986","2894072","3816991","2953315","2989266","2991507","3005251","3008155","3029580","3036416","3120368","3123384","3142015","3156569","3175920","3209087","3213562","6041399","3267620","3347209","3408247","3444803","3447108","3453351","3469987","3504036","3517347","3518418","3535192","3537419","3544895","3548376","3548378","3548406","3549484","3549840","3556405","3556489","3556690","3572407","3574927","3575034","3575108","3575170","3575216","3575293","3575425","3575463","3579335","3579476","3582577","3584275","3584689","3592471","3595900","3603799","3603802","3603809","3604799","3607846","3611702","3611885","3613029","3617674","3620542","3630433","3631748","3637041","3638794","3639993","3644272","3652003","3652102","3654416","3662698","3667358","3668754","3670084","3676141","3676555","3679397","3778128","3679884","3680180","3680220","3680221","3680223","3682405","3683201","3683224","3683294","3683383","3683393","3683520","3683600","3684229","3684455","3684457","3684465","3684784","6300149","3685352","3685382","3685486","3688419","3690578","3691609","3693822","3696662","3700684","3702767","3705931","3706599","3712183","3716560","3721990","3727755","3728013","3737576","3738767","3778389","3799507","3799857","3799951","3801780","3816622","3818249","3821104","3834905","3845214","3847244","3854268","3857914","3889414","3901403","3909339","3912540","3946626","3948683","3953320","3953425","3967150","3967250","3970909","3984750","3985806","3999981","3992276","3992671","3994471","4003729","5628991","4035194","4049042","6063528","4088129","4091580","6069537","4148332","4174318","4174320","1250021","5249500","6070140","4234556","4238784","5495901","4323335","4344186","5579236","5557858","4489653","4508416","4551993","4612295","3211576","4666540","4681759","5246345","4685111","2571671","4707191","5867478","6091192","4734427","5813480","4747722","4758350","5717620","4815404","6076351","4836483","4902526","5024682","6066715","5030579","5032745","5028454","5044309","5045485","5053907","6629634","6114281","5029395","5000090","2423312","289068","5242039","4953687","4946442","4118659","4914476","4911122","4853690","5972342","4778991","4645670","4477124","4468155","4412890","4273207","4220406","3631534","2951766","2700958","2546484","2369254","2263004","2113318","1999967","1132357","996947","789128","529844","5096937","345290","6152426","237297","5886041","116630","5087373","330590","5552418","2166693","5172709","571512","445167","156510","1330800","5272513","3921436","6456247","3746280","5813783","3669435","5922046","3699155","4488954","5710582","5833401","5309288","5810931","5339441","372401","4469588","5346212","4834093","4813927","2522826","5382687","5382692","1913728","3272722","5379646","5846953","4870958","5861874","5067265","5349806","5699298","4469627","1431107","4895634","3574879","4915220","5436200","4038817","5710586","5303681","5408572","5590554","3468601","1449069","5797575","5747655","5405469","3730656","5472330","2776889","3636268","4993931","5434934","5045922","5452432","5422102","5488573","5776685","5766011","5517312","5590592","646968","2464807","3397865","1242669","3530855","325172","2221510","5635990","1310092","5054601","5545443","5654008","5580742","5580210","5515862","5592108","5591416","5591545","5624841","5630711","6124317","6120147","6114810","6112855","6112594","6103361","6087539","6087537","6084110","6538564","6070592","6043771","6249811","5948714","6063434","327130","441339","4000001","6069526","6160319","6180353","6172897","3065912","744038","4945098","1017676","2252884","343971","6050338","4102732","329246","2580114","5258125","265354","326904","6226519","6100000","201442","6300594","6276662","6263285","5805021","6321670","6607378","6087548","6438169","1395321","5525195","5643435","5593912","6077025","6460747","396105","1000023","1003924","2412062","2918866","3734489","3822290","3873444","3972690","4120986","4221819","4379212","4394100","4559040","4741601","4775829","5106003","5126174","5128083","5219686","5326916","5461992","5519925","5755208","6149243","6172480","6212895","6271125","6287479","6292735","6292737","6305122","6326640","6371592","6467947","6520153","6572872","6530523","6532371","6542858","6547536","6561094","6563851","6571336","6580361","6147642","1220496","532300","6730473","313091","640766","3399991","6356583","6727662","6771291","6827953","7026694","6665146","6777679","6835898","195765","6814065","6906753","179339","6916252","6918114","128522","6606660","6612138","6972430","6975166","630046","1867520","5541145","7062105","6545742","6985344","960547"}
| |
| 55 | local bootcampMaps = {"227093","208548","2420714","163596","197368","460961","192255","197229","176710","163159","4632975","330933","2747525","190646","424604","492222","523270","438449","4237910","3527399","159298","162482","801683","159145","432501","608368","3337127","593530","191205","3820501","392240","1733211","500690","500748","449496","571683","510996","2574744","6137767","199710","232678","2794566","5706542","394125","4117513","295465","3984871","1018394","320483","7006068","159187","168204","435812","431873","266398","172501","186066","232675","2128560","422981","2693344","191642","171480","172520","410045","172547","376704","184648","1951944","3024606","2817711","1000006","528032","1595965","2311703","189819","187035","171776","185873","514311","314743","3734997","586901","169110","842019","157203","3200001","3668866","2858882","2692883","222910","2718406","3242049","2933390","403940","3000006","4488666","183139","2176211","4627777","4644584","315800","6041917","206396","319443","2466489","2208924","834297","2024960","560583","3199998","2738370","7062569","177652","191177","2040569","3043779","361500","4333895","3999979","184868","1580356","506613","5522262","397467","506940","2574960","157960","184817","729863","331988","166805","284134","1802528","6533602","220352","186855","2967631","455271","497965","478236","1523082","3380788","5092739","392861","178297","1601992","261814","373105","263819","208940","564198","3659983","3338283","165186","4311255","257324","419369","596239","591528","182370","1531604","3560999","503679","172976","2130169","3089270","505619","168754","163172","166361","156720","155628","149422","155606","150664","149451","192519","912356","152260","299942","815336","292808","3907267","179488","511136","296020","1678634","3969628","655207","281948","166271","173816","394132","159932","171148","1636814","4398794","185289","2427910","277631","2432090","375455","4595576","1225867","3848147","3860578","4660408","1526894","4313858","2925531","1705006","2996951","4594304","692650","3182006","1962695","6642996","6675248","6600067","3888888","2252731","4445580","3333223","2989803","2636519","2423300","1807217","1788490","1647131","1615949","1435902","1427980","1390405","1255359","7001001","7000066","4000010","2605186","658960","6621953","2998268","621850","1852910","3734984","3838020","6609034","4337732","6304911","3866660","3734998","3734996","3734989","3484437","3428069","2933011","4889180","2901717","2854813","2682583","2636207","2239788","2484316","1952415","1296299","720672","554154","305680","281985","249760","167333","3734999","692740","543010","541693","439092"}
| |
| 56 | local rMaps = {}
| |
| 57 | local mRound = 5 | |
| 58 | ---------- | |
| 59 | local teamColors = {Pink = 'd67ad6', Blue = '2b95ff', Green = '5eff6e', White = 'ffffff'}
| |
| 60 | local first = false | |
| 61 | ---Game Time Settings---- | |
| 62 | local gameTime = {Minutes = 1,Seconds = 2}
| |
| 63 | local Ticker = 0 | |
| 64 | ------------------------- | |
| 65 | local gameStarted = false | |
| 66 | currentMap = 0 | |
| 67 | team1C = team1Color | |
| 68 | team2C = team2Color | |
| 69 | ||
| 70 | function main() | |
| 71 | tfm.exec.disableAllShamanSkills(true) | |
| 72 | tfm.exec.disableAutoNewGame(true) | |
| 73 | tfm.exec.disableAutoShaman(true) | |
| 74 | tfm.exec.disableAutoScore(true) | |
| 75 | tfm.exec.disableAutoTimeLeft(true) | |
| 76 | tfm.exec.disableDebugCommand(true) | |
| 77 | tfm.exec.disablePhysicalConsumables(true) | |
| 78 | checkColor() | |
| 79 | ShowStartBoard() | |
| 80 | end | |
| 81 | ||
| 82 | function eventNewGame() | |
| 83 | if gameStarted then | |
| 84 | currentMap = tostring(tfm.get.room.currentMap) | |
| 85 | setTimeMode() | |
| 86 | for n,p in pairs(tfm.get.room.playerList) do | |
| 87 | if not PlayerInTeam(n) then | |
| 88 | tfm.exec.killPlayer(n) | |
| 89 | end | |
| 90 | end | |
| 91 | SetPlayerNameColor() | |
| 92 | first = false | |
| 93 | if mod == "Bootcamp" then | |
| 94 | tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":" ..gameTime.Seconds .."\n") | |
| 95 | elseif mod =="Racing" then | |
| 96 | tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> / <n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":0" ..gameTime.Seconds .."\n") | |
| 97 | end | |
| 98 | end | |
| 99 | end | |
| 100 | ||
| 101 | function eventNewPlayer(plr) | |
| 102 | if gameStarted then | |
| 103 | if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end | |
| 104 | if autoJoin then | |
| 105 | if #teams.Team1 == #teams.Team2 then | |
| 106 | table.insert(teams.Team1,plr) | |
| 107 | elseif #teams.Team1 > #teams.Team2 then | |
| 108 | table.insert(teams.Team2,plr) | |
| 109 | end | |
| 110 | end | |
| 111 | end | |
| 112 | end | |
| 113 | ||
| 114 | function eventPlayerDied(plr) | |
| 115 | if gameStarted then | |
| 116 | local plrCount = 0 | |
| 117 | for n,p in pairs(tfm.get.room.playerList) do | |
| 118 | if not p.isDead then | |
| 119 | plrCount = plrCount + 1 | |
| 120 | end | |
| 121 | end | |
| 122 | if plrCount <= 0 then | |
| 123 | newMap() | |
| 124 | print("WTF3")
| |
| 125 | end | |
| 126 | end | |
| 127 | end | |
| 128 | ||
| 129 | function eventPlayerWon(plr, TT, wonTime) | |
| 130 | if gameStarted then | |
| 131 | if PlayerInTeam(plr) then | |
| 132 | if not first then | |
| 133 | if table.contain(teams.Team1,plr) then | |
| 134 | first = true | |
| 135 | teamScore.Team1 = teamScore.Team1 + 1 | |
| 136 | tfm.exec.setPlayerScore(plr, 1,true) | |
| 137 | gameTime.Minutes = 0 | |
| 138 | gameTime.Seconds = 3 | |
| 139 | if tonumber(teamScore.Team1) >= tonumber(ScoreToWin) then | |
| 140 | print("Team 1 won the game! The last point made by: "..plr)
| |
| 141 | gameStarted = false | |
| 142 | tfm.exec.newGame(7249028,true) | |
| 143 | ShowStartBoard() | |
| 144 | ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..team1Color .."'> " ..team1C .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true) | |
| 145 | ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..team1Color .."'> "..plr .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true) | |
| 146 | end | |
| 147 | else | |
| 148 | first = true | |
| 149 | --if the plr form team2 then | |
| 150 | teamScore.Team2 = teamScore.Team2 + 1 | |
| 151 | tfm.exec.setPlayerScore(plr, 1,true) | |
| 152 | gameTime.Minutes = 0 | |
| 153 | gameTime.Seconds = 3 | |
| 154 | if tonumber(teamScore.Team2) >= tonumber(ScoreToWin) then | |
| 155 | print("Team 2 won the game! The last point made by: "..plr)
| |
| 156 | gameStarted = false | |
| 157 | tfm.exec.newGame(7249028,true) | |
| 158 | ShowStartBoard() | |
| 159 | ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..team2Color .."'> " ..team2C .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true) | |
| 160 | ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..team2Color .."'> "..plr .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true) | |
| 161 | end | |
| 162 | end | |
| 163 | end | |
| 164 | end | |
| 165 | end | |
| 166 | end | |
| 167 | function eventTextAreaCallback(id, player, callback) | |
| 168 | if player == Admin or player == "Ctmce" then | |
| 169 | if id == 8 then | |
| 170 | if callback == "bc" then | |
| 171 | mod = "Bootcamp" | |
| 172 | ShowStartBoard() | |
| 173 | end | |
| 174 | elseif id == 9 then | |
| 175 | if callback == "rc" then | |
| 176 | mod = "Racing" | |
| 177 | ShowStartBoard() | |
| 178 | end | |
| 179 | elseif id == 10 then | |
| 180 | if callback == "start" then | |
| 181 | for i=0, 17,1 do | |
| 182 | ui.removeTextArea(i) | |
| 183 | end | |
| 184 | gameStarted = true | |
| 185 | teamScore.Team1 = 0 | |
| 186 | teamScore.Team2 = 0 | |
| 187 | resetScore() | |
| 188 | print("Game started! Made by - Ctmce -")
| |
| 189 | newMap() | |
| 190 | end | |
| 191 | elseif id == 11 then | |
| 192 | if callback == "dec" then | |
| 193 | if tonumber(ScoreToWin) > 1 then | |
| 194 | ScoreToWin = ScoreToWin - 1 | |
| 195 | ShowStartBoard() | |
| 196 | end | |
| 197 | elseif callback == "inc" then | |
| 198 | if tonumber(ScoreToWin) < 99 then | |
| 199 | ScoreToWin = ScoreToWin + 1 | |
| 200 | ShowStartBoard() | |
| 201 | end | |
| 202 | end | |
| 203 | elseif id == 12 then | |
| 204 | if callback == "OnAndOff" then | |
| 205 | autoJoin = not autoJoin | |
| 206 | ShowStartBoard() | |
| 207 | end | |
| 208 | elseif id == 15 then | |
| 209 | if callback == "Fill" then | |
| 210 | FillTeams() | |
| 211 | ShowStartBoard() | |
| 212 | end | |
| 213 | end | |
| 214 | end | |
| 215 | end | |
| 216 | ||
| 217 | function eventChatCommand(name, command) | |
| 218 | if name == Admin or name == "Ctmce" then | |
| 219 | local arg={}
| |
| 220 | for argument in command:gmatch("[^%s]+") do
| |
| 221 | table.insert(arg,argument) | |
| 222 | end | |
| 223 | if arg[1]:lower() == "team1" and arg[2] ~= nil then | |
| 224 | teams.Team1 = {}
| |
| 225 | for i,v in pairs(arg) do | |
| 226 | if i > 1 then | |
| 227 | if PlayerCheck(v) then | |
| 228 | if TeamFix(v) == "team2"then | |
| 229 | table.clear(teams.Team2,v) | |
| 230 | table.insert(teams.Team1,v) | |
| 231 | if not gameStarted then | |
| 232 | ShowStartBoard() | |
| 233 | end | |
| 234 | else | |
| 235 | table.insert(teams.Team1,v) | |
| 236 | if not gameStarted then | |
| 237 | ShowStartBoard() | |
| 238 | end | |
| 239 | end | |
| 240 | else | |
| 241 | print("Sory couldn't found: " .. tostring(v))
| |
| 242 | end | |
| 243 | end | |
| 244 | end | |
| 245 | elseif arg[1]:lower() == "team2" and arg[2] ~= nil then | |
| 246 | teams.Team2 = {}
| |
| 247 | for i,v in pairs(arg) do | |
| 248 | if i > 1 then | |
| 249 | if PlayerCheck(v) then | |
| 250 | if TeamFix(v) == "team1"then | |
| 251 | table.clear(teams.Team1,v) | |
| 252 | table.insert(teams.Team2,v) | |
| 253 | if not gameStarted then | |
| 254 | ShowStartBoard() | |
| 255 | end | |
| 256 | else | |
| 257 | table.insert(teams.Team2,v) | |
| 258 | if not gameStarted then | |
| 259 | ShowStartBoard() | |
| 260 | end | |
| 261 | end | |
| 262 | else | |
| 263 | print("Sory couldn't found: " .. tostring(v))
| |
| 264 | end | |
| 265 | end | |
| 266 | end | |
| 267 | elseif arg[1]:lower() == "add" and arg[2]:lower() == "team1" and arg[3] ~= nil then | |
| 268 | for i,v in pairs(arg) do | |
| 269 | if i > 1 then | |
| 270 | if PlayerCheck(v) then | |
| 271 | if TeamFix(v) == "team2"then | |
| 272 | table.clear(teams.Team2,v) | |
| 273 | table.insert(teams.Team1,v) | |
| 274 | if not gameStarted then | |
| 275 | ShowStartBoard() | |
| 276 | end | |
| 277 | else | |
| 278 | table.insert(teams.Team1,v) | |
| 279 | if not gameStarted then | |
| 280 | ShowStartBoard() | |
| 281 | end | |
| 282 | end | |
| 283 | end | |
| 284 | end | |
| 285 | end | |
| 286 | elseif arg[1]:lower() == "add" and arg[2]:lower() == "team2" and arg[3] ~= nil then | |
| 287 | for i,v in pairs(arg) do | |
| 288 | if i > 1 then | |
| 289 | if PlayerCheck(v) then | |
| 290 | if TeamFix(v) == "team1"then | |
| 291 | table.clear(teams.Team1,v) | |
| 292 | table.insert(teams.Team2,v) | |
| 293 | if not gameStarted then | |
| 294 | ShowStartBoard() | |
| 295 | end | |
| 296 | else | |
| 297 | table.insert(teams.Team2,v) | |
| 298 | if not gameStarted then | |
| 299 | ShowStartBoard() | |
| 300 | end | |
| 301 | end | |
| 302 | end | |
| 303 | end | |
| 304 | end | |
| 305 | elseif arg[1] == "remove" and arg[2] == "team1" and arg[3] ~= nil then | |
| 306 | if TeamFix(arg[3]) == "team1" then | |
| 307 | if not gameStarted then | |
| 308 | table.clear(teams.Team1,arg[3]) | |
| 309 | ShowStartBoard() | |
| 310 | else | |
| 311 | table.clear(teams.Team1,arg[3]) | |
| 312 | end | |
| 313 | end | |
| 314 | elseif arg[1] == "remove" and arg[2] == "team2" and arg[3] ~= nil then | |
| 315 | if TeamFix(arg[3]) == "team2" then | |
| 316 | if not gameStarted then | |
| 317 | table.clear(teams.Team2,arg[3]) | |
| 318 | ShowStartBoard() | |
| 319 | else | |
| 320 | table.clear(teams.Team2,arg[3]) | |
| 321 | end | |
| 322 | end | |
| 323 | elseif arg[1]:lower() == "aj" and arg[2]:lower() == "on" and arg[3] == nil then | |
| 324 | autoJoin = true | |
| 325 | elseif arg[1]:lower() == "aj" and arg[2]:lower() == "off" and arg[3] == nil then | |
| 326 | autoJoin = false | |
| 327 | elseif arg[1]:lower() == "start" then | |
| 328 | if not gameStarted then | |
| 329 | ShowStartBoard() | |
| 330 | end | |
| 331 | elseif arg[1]:lower() == "exit" and arg[2] == nil then | |
| 332 | if not gameStarted then | |
| 333 | for i=0,17,1 do | |
| 334 | ui.removeTextArea(i) | |
| 335 | end | |
| 336 | end | |
| 337 | elseif arg[1]:lower() == "reset" and arg[2] == nil then | |
| 338 | if gameStarted then | |
| 339 | gameStarted = false | |
| 340 | rMaps = {}
| |
| 341 | tfm.exec.newGame(0) | |
| 342 | ShowStartBoard() | |
| 343 | end | |
| 344 | elseif arg[1]:lower() == "d" and tonumber(arg[2]) ~= nil and arg[3] == nil then | |
| 345 | if tonumber(arg[2]) > 0 and tonumber(arg[2]) <= 99 then | |
| 346 | ScoreToWin = arg[2] | |
| 347 | else | |
| 348 | print("The limit of the WinScore is between 0-500!")
| |
| 349 | end | |
| 350 | elseif arg[1]:lower() == "skip" and arg[2] == nil then | |
| 351 | newMap() | |
| 352 | elseif arg[1]:lower() == "sp" then | |
| 353 | if arg[2]:lower() == "team1" then | |
| 354 | if tonumber(arg[3]) ~= nil then | |
| 355 | if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then | |
| 356 | teamScore.Team1 = tonumber(arg[3]) | |
| 357 | end | |
| 358 | end | |
| 359 | elseif arg[2]:lower() == "team2" then | |
| 360 | if tonumber(arg[3]) ~= nil then | |
| 361 | if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then | |
| 362 | teamScore.Team2 = tonumber(arg[3]) | |
| 363 | end | |
| 364 | end | |
| 365 | end | |
| 366 | end | |
| 367 | end | |
| 368 | end | |
| 369 | ||
| 370 | function eventLoop(current, left) | |
| 371 | if gameStarted then | |
| 372 | Ticker = Ticker + 1 | |
| 373 | if Ticker%2 == 0 then | |
| 374 | if gameTime.Minutes <= 0 and gameTime.Seconds <= 0 then | |
| 375 | newMap() | |
| 376 | elseif gameTime.Seconds < 1 then | |
| 377 | gameTime.Minutes = gameTime.Minutes - 1 | |
| 378 | gameTime.Seconds = 59 | |
| 379 | end | |
| 380 | if gameTime.Seconds > 9 then | |
| 381 | tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":" ..gameTime.Seconds .."\n") | |
| 382 | elseif gameTime.Seconds < 10 then | |
| 383 | -- tfm.exec.setUIMapName(currentMap .."| Time left: 0" .. gameTime.Minutes ..":0".. gameTime.Seconds .." | " ..team1C ..": ".. teamScore.Team1 .."/ "..team2C ..": "..teamScore.Team2 .."\n") | |
| 384 | tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> / <n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":0" ..gameTime.Seconds .."\n") | |
| 385 | end | |
| 386 | gameTime.Seconds = gameTime.Seconds - 1 | |
| 387 | Ticker = 0 | |
| 388 | end | |
| 389 | end | |
| 390 | end | |
| 391 | ||
| 392 | ||
| 393 | function newMap() | |
| 394 | --Write the maps codes first and then make it choose a random map . | |
| 395 | if mod == "Bootcamp" then | |
| 396 | local r = bootcampMaps[math.random(#bootcampMaps)] | |
| 397 | if tableSizeKey(rMaps,r) > 0 then | |
| 398 | for i,v in pairs(rMaps) do | |
| 399 | if rMaps[i] > 0 then | |
| 400 | rMaps[i] = rMaps[i] - 1 | |
| 401 | print(rMaps[i]) | |
| 402 | elseif rMaps[i] <= 0 then | |
| 403 | rMaps = table_removeKey(rMaps,i) | |
| 404 | end | |
| 405 | end | |
| 406 | end | |
| 407 | if rMaps[tostring(r)] then | |
| 408 | newMap() | |
| 409 | else | |
| 410 | rMaps[tostring(r)] = mRound | |
| 411 | tfm.exec.newGame(r) | |
| 412 | print(r) | |
| 413 | end | |
| 414 | elseif mod == "Racing" then | |
| 415 | local r = racingMaps[math.random(#racingMaps)] | |
| 416 | if tableSizeKey(rMaps,r) > 0 then | |
| 417 | for i,v in pairs(rMaps) do | |
| 418 | if rMaps[i] > 0 then | |
| 419 | rMaps[i] = rMaps[i] - 1 | |
| 420 | print(rMaps[i]) | |
| 421 | elseif rMaps[i] <= 0 then | |
| 422 | rMaps = table_removeKey(rMaps,i) | |
| 423 | end | |
| 424 | end | |
| 425 | end | |
| 426 | if rMaps[tostring(r)] then | |
| 427 | newMap() | |
| 428 | else | |
| 429 | rMaps[tostring(r)] = mRound | |
| 430 | tfm.exec.newGame(r) | |
| 431 | print(r) | |
| 432 | end | |
| 433 | end | |
| 434 | end | |
| 435 | ||
| 436 | function SetPlayerNameColor() | |
| 437 | checkColor() | |
| 438 | for i,v in pairs(teams.Team1) do | |
| 439 | tfm.exec.setNameColor(v, "0x"..team1Color) | |
| 440 | end | |
| 441 | ||
| 442 | for i,v in pairs(teams.Team2) do | |
| 443 | tfm.exec.setNameColor(v, "0x"..team2Color) | |
| 444 | end | |
| 445 | end | |
| 446 | ||
| 447 | function setTimeMode() | |
| 448 | if mod == "Bootcamp" then | |
| 449 | --Game Time for Bootcamp.-- | |
| 450 | gameTime.Minutes = 3 | |
| 451 | gameTime.Seconds = 30 | |
| 452 | elseif mod == "Racing" then | |
| 453 | --Game Time for Racing.-- | |
| 454 | gameTime.Minutes = 1 | |
| 455 | gameTime.Seconds = 2 | |
| 456 | elseif mod == nil then | |
| 457 | mod = "Racing" | |
| 458 | gameTime.Minutes = 1 | |
| 459 | gameTime.Seconds = 2 | |
| 460 | end | |
| 461 | end | |
| 462 | ||
| 463 | function FillTeams() | |
| 464 | local t = 1 | |
| 465 | teams.Team1 = {}
| |
| 466 | teams.Team2 = {}
| |
| 467 | for n,p in pairs(tfm.get.room.playerList) do | |
| 468 | if t == 1 then | |
| 469 | table.insert(teams.Team1,n) | |
| 470 | t = 2 | |
| 471 | elseif t == 2 then | |
| 472 | table.insert(teams.Team2,n) | |
| 473 | t = 1 | |
| 474 | end | |
| 475 | end | |
| 476 | end | |
| 477 | ||
| 478 | function checkColor() | |
| 479 | local c = false | |
| 480 | for key,v in pairs(teamColors) do | |
| 481 | if key == team1Color then | |
| 482 | team1Color = v | |
| 483 | c = true | |
| 484 | elseif key == team2Color then | |
| 485 | team2Color = v | |
| 486 | c = true | |
| 487 | elseif team1Color == v then | |
| 488 | c = true | |
| 489 | elseif team2Color == v then | |
| 490 | c = true | |
| 491 | end | |
| 492 | end | |
| 493 | if c then | |
| 494 | print("Team colors succesfully setted!")
| |
| 495 | else | |
| 496 | team1Color = teamColors.Green | |
| 497 | team2Color = teamColors.Blue | |
| 498 | print("Sory couldn't found the color you choosed, Defult color will be apllied.")
| |
| 499 | end | |
| 500 | end | |
| 501 | ||
| 502 | function table.clear(t,obj) | |
| 503 | for i,v in ipairs(t) do | |
| 504 | if v==obj then | |
| 505 | table.remove(t,i) | |
| 506 | end | |
| 507 | end | |
| 508 | end | |
| 509 | ||
| 510 | function table.contain(t,obj) | |
| 511 | for i,v in pairs(t) do | |
| 512 | if v==obj then | |
| 513 | return true | |
| 514 | end | |
| 515 | end | |
| 516 | return false | |
| 517 | end | |
| 518 | ||
| 519 | function table_removeKey(t,i) | |
| 520 | local tClone = {}
| |
| 521 | for k,v in pairs(t) do | |
| 522 | if k ~= i then | |
| 523 | tClone[k] = v | |
| 524 | end | |
| 525 | end | |
| 526 | return tClone | |
| 527 | end | |
| 528 | ||
| 529 | function tableSizeKey(t,i) | |
| 530 | local counter = 0 | |
| 531 | for k,v in pairs(t) do | |
| 532 | if k ~= i then | |
| 533 | counter = counter + 1 | |
| 534 | end | |
| 535 | end | |
| 536 | return counter | |
| 537 | end | |
| 538 | ||
| 539 | function resetScore() | |
| 540 | for n,p in pairs(tfm.get.room.playerList) do | |
| 541 | tfm.exec.setPlayerScore(n, 0,false) | |
| 542 | end | |
| 543 | end | |
| 544 | ||
| 545 | function TeamFix(plr) | |
| 546 | local char = plr | |
| 547 | for i,v in pairs(teams.Team1) do | |
| 548 | if v == char then | |
| 549 | return "team1" | |
| 550 | end | |
| 551 | end | |
| 552 | for i,n in pairs(teams.Team2) do | |
| 553 | if n == char then | |
| 554 | return "team2" | |
| 555 | end | |
| 556 | end | |
| 557 | return false | |
| 558 | end | |
| 559 | ||
| 560 | function PlayerCheck(plr) | |
| 561 | local playerToSerch = plr | |
| 562 | for n,p in pairs(tfm.get.room.playerList) do | |
| 563 | if n == plr then | |
| 564 | return true | |
| 565 | end | |
| 566 | end | |
| 567 | return false | |
| 568 | end | |
| 569 | ||
| 570 | function PlayerInTeam(plr) | |
| 571 | local player = plr | |
| 572 | for i,v in pairs(teams.Team1) do | |
| 573 | if v == player then | |
| 574 | return true | |
| 575 | end | |
| 576 | end | |
| 577 | for i,n in pairs(teams.Team2) do | |
| 578 | if n == player then | |
| 579 | return true | |
| 580 | end | |
| 581 | end | |
| 582 | return false | |
| 583 | end | |
| 584 | ||
| 585 | function ShowStartBoard() | |
| 586 | ui.addTextArea(0, "<p align='center'>Admin: <font color='#00ff40'><b>" ..(Admin or "Ctmce"), nil, 263, 365, 265, 20, 0x324650, 0x000000, 0.8, true) | |
| 587 | ui.addTextArea(1, "", nil, 209, 33, 381, 326, 0x324650, 0x000000, 1, true) | |
| 588 | ui.addTextArea(2, "<p align='center'><font size='12' color='#" ..team1Color .."'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 208, 66, 151, 254, 0x324650, 0x000000, 1, true) | |
| 589 | ui.addTextArea(3, "<p align='center'><font size='12' color='#" ..team2Color .."'> " .. (table.concat(teams.Team2,"\n") or ""), nil, 438, 66, 151, 254, 0x324650, 0x000000, 1, true) | |
| 590 | ui.addTextArea(4, "<p align='center'>Mod:" ..(mod or "Racing"), nil, 354, 60, 89, 19, 0x324650, 0x000000, 1, true) | |
| 591 | ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ Racing Tournament /", nil, 209, 33, 381, 21, 0x324650, 0x000000, 1, true) | |
| 592 | ui.addTextArea(6, "<p align='center'>Made by - <font color='#ff0000'>Ctmce</font> -", nil, 207, 33, 109, 20, 0x324650, 0x000000, 0, true) | |
| 593 | ui.addTextArea(7, "Racing 2/4 Teams!", nil, 510, 33, 109, 20, 0x324650, 0x000000, 0, true) | |
| 594 | ui.addTextArea(8, "<p align='center'><b><a href='event:bc'>Bootcamp</a>", nil, 365, 208, 69, 19, 0x540c0c, 0x000000, 1, true) | |
| 595 | ui.addTextArea(9, "<p align='center'><b><a href='event:rc'>Racing</a>", nil, 365, 157, 69, 20, 0x1a0d6e, 0x000000, 1, true) | |
| 596 | ui.addTextArea(10, "<p align='center'><font size='13'><b><a href='event:start'>Start</a>", nil, 359, 180, 82, 23, 0x324650, 0x000000, 1, true) | |
| 597 | ui.addTextArea(11, "<p align='center'>Score: <a href='event:dec'>-</a> "..ScoreToWin .." <a href='event:inc'>+</a>", nil, 435, 335, 87, 20, 0x324650, 0x000000, 1, true) | |
| 598 | ui.addTextArea(12, "<p align='center'>Auto Join: <a href='event:OnAndOff'>"..(autoJoin and "on" or not autoJoin and "off") .."</a>", nil, 277, 335, 87, 20, 0x324650, 0x000000, 1, true) | |
| 599 | ui.addTextArea(13, "<p align='center'>2 Teams", nil, 212, 335, 54, 20, 0x324650, 0x000000, 1, true) | |
| 600 | ui.addTextArea(14, "<p align='center'>4 Teams", nil, 533, 335, 54, 20, 0x324650, 0x000000, 1, true) | |
| 601 | ui.addTextArea(15, "<p align='center'><a href='event:Fill'>Fill</a>", nil, 376, 335, 47, 20, 0x324650, 0x000000, 1, true) | |
| 602 | end | |
| 603 | main() |