Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admin = {"Sagazgamer", "Tectoon", "Theapps"}
- function newGameLoader(playerName,turn)
- if mLoader then
- currentMap = currentMap + turn
- mapList[currentMap].LOAD = true
- for k,v in pairs(admin) do
- print("<ROSE>[•] Loading @" .. mapList[currentMap].MAP .. " exported by " .. mapList[currentMap].playerName .."." , v)
- end
- mLoader = false
- tfm.exec.newGame(mapList[currentMap].MAP)
- system.newTimer(function () mLoader = true system.removeTimer(0) end,3500,false)
- else
- print("<R>[•] Please be patient and don't spam the buttons", playerName)
- end
- end
- for player,playerName in pairs(admin) do
- tfm.exec.bindKeyboard(playerName,77,true,true)
- tfm.exec.bindKeyboard(playerName,188,true,true)
- tfm.exec.bindKeyboard(playerName,190,true,true)
- end
- player = { }
- mapList = { }
- mLoader = true
- currentMap = 1
- function newPlayer(playerName)
- player[playerName] = { MAPS = { }, inRoom = true }
- end
- for v,k in pairs(tfm.get.room.playerList) do
- newPlayer(v)
- end
- system.disableChatCommandDisplay('maplist',true)
- system.disableChatCommandDisplay('addmap',true)
- system.disableChatCommandDisplay('m',true)
- function eventChatCommand(name, command)
- if command == 'help' then
- print("<ROSE>!addmap @xxxxxxx<J> - add a map to the queue, 2 max.",name)
- end
- split = string.split(command)
- if split[1] == "addmap" then
- if #split > 1 then
- if string.sub(split[2], 1, 1) == "@" then
- split[2] = string.sub(split[2],2,#split[2])
- getPlayerMap(split[2],name)
- end
- end
- end
- for playerName, playerKey in pairs(admin) do
- if playerKey == name then
- message = string.find(command,"m ",1)
- if message == 1 then
- print("<FONT COLOR=\"#DC85FF\">♠ [" .. name.. "]<B>" .. string.sub(command,message + 1,string.len(command)) .. "</B></FONT>")
- end
- if split[1] == 'checkRoom' then
- for v,k in pairs(player) do
- if player[v].inRoom then
- print(v)
- end
- end
- end
- if split[1] == 'addMapTest' then
- for i=0,10,1 do
- mapList[#mapList + 1] = { MAP = '12345' .. i , playerName = name , LOAD = false}
- end
- end
- if split[1] == 'maplist' then
- if #mapList > 0 then
- if split[2] == 'all' then
- for k,v in pairs(mapList) do
- print("<J>[•] Queue: " .. k .. " | Player Name: " .. v.playerName .. " | Map code: @" .. v.MAP, name)
- end
- elseif split[2] == nil or split[3] == nil then
- for k,v in pairs(mapList) do
- if v.LOAD == false then
- print("<J>[•] Queue: " .. k .. " | Player Name: " .. v.playerName .. " | Map code: @" .. v.MAP, name)
- end
- end
- else
- split[2] = tonumber(split[2])
- split[3] = tonumber(split[3])
- if split[2] ~= nil and split[3] ~= nil then
- if split[3] > #mapList then
- split[3] = #mapList
- end
- for k = split[2],split[3],1 do
- print("<J>[•] Queue: " .. k .. " | Player Name: " .. mapList[k].playerName .. " | Map code: @" .. mapList[k].MAP, name)
- end
- end
- end
- end
- end
- end
- end
- end
- function eventPlayerLeft(playerName)
- player[playerName].inRoom = false
- end
- function eventNewPlayer(playerName)
- if player[playerName] == nil then
- newPlayer(playerName)
- print("<J>Welcome to mapcrew testing room, in this room you will be able to show your maps to the public and let the crew evaluate them. For commands list please type <B>!help</b>. Have fun :)",playerName)
- else
- player[playerName].inRoom = true
- end
- end
- function getPlayerMap(input,name)
- input = tonumber(input)
- firstPlacer = true
- if input ~= nil then
- if input > 999 and input < 5000000 then
- for i=1,2,1 do
- if player[name].MAPS[i] == nil then
- player[name].MAPS[i] = {CODE = input}
- print("<ROSE>[•] Your map: @" .. input .. " has been add to the list.",name)
- mapList[#mapList + 1] = { MAP = input , playerName = name , LOAD = false}
- firstPlacer = false
- break
- end
- end
- if firstPlacer then
- for k2,v2 in pairs(player[name].MAPS) do
- for k,v in pairs(mapList) do
- if mapList[k].playerName == name then
- if mapList[k].LOAD then
- if player[name].MAPS[k2].CODE == mapList[k].MAP then
- player[name].MAPS[k2].CODE = input
- print("<ROSE>[•] Your map: @" .. input .. " has been add to the list.",name)
- mapList[#mapList + 1] = { MAP = input , playerName = name , LOAD = false}
- break
- end
- elseif player[name].MAPS[k2].CODE == mapList[k].MAP then
- print("<ROSE>[•] Map @" .. player[name].MAPS[k2].CODE .. " is still on queue.",name)
- end
- end
- end
- end
- end
- else
- print("<R>[•] Error - Map code length invalid.",name)
- end
- else
- print("<R>[•] Error - Invalid map. (!addmap @xxxxxxx)",name)
- end
- end
- function eventKeyboard(p,k)
- for playerKey, playerName in pairs(admin) do
- if p == playerName then
- if k == 77 then
- if mapList[currentMap] ~= nil then
- newGameLoader(playerName,0)
- else
- print("<R>[•] There are no maps on the list", playerName)
- end
- end
- if k == 188 then
- if currentMap ~= 1 then
- newGameLoader(playerName,-1)
- else
- print("<R>[•] you reached the first map in the list", playerName)
- end
- end
- if k == 190 then
- if mapList[currentMap+1] ~= nil then
- newGameLoader(playerName,1)
- else
- print("<R>[•] There no more maps on the list", playerName)
- end
- end
- end
- end
- end
- function string.split(message)
- i = 1
- command = {}
- for split in string.gmatch(message, "[^%s]+") do
- command[i] = split
- i = i + 1
- end
- return command
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement