nostopgmaming17

map game commands

Apr 22nd, 2022 (edited)
861
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. All made by noam#5887 the first exploiter in nations roleplay
  3. A collection of most of the scripts I made for this game all in one
  4.  
  5. Commands:
  6. invert/ - inverts map color
  7. rainbow/ - makes the map rainbow
  8. setcolor/color - sets the entire map to the one color
  9. random/ - randomizes the map colors making it a mess
  10. replace/color/newcolor - replaces the the map (doesn't work with a lot of colors sadly)
  11. name/target/name - sets the target's rp name
  12. noname/ - remove your rp name
  13.  
  14. SAVE COMMANDS:
  15. these commands only save after leaving if your exploit has a filesystem api
  16. however if you arent using a good exploit then it will saved until you leave or rejoin
  17.  
  18. save/name - saves the map
  19. load/name - loads a save
  20. del/name - deletes a save
  21.  
  22. default save lists for exploits with no filesystem api:
  23. default - the default map
  24. inverted - the default map but inverted
  25. ]]--
  26.  
  27. local cansave,saves = true,nil
  28. if not (isfolder and makefolder and readfile and writefile and isfile) then
  29.     cansave = false
  30.     saves = loadstring(game:HttpGet("https://pastebin.com/raw/7jHCikse"))()
  31. end
  32. if cansave then
  33.     if not isfolder("mapgame") then makefolder("mapgame") end
  34.     if not isfolder("mapgame/saves") then makefolder("mapgame/saves") end
  35. end
  36. local plr = game.Players.LocalPlayer
  37. local t = plr.Backpack:FindFirstChild("PaintBucket") or plr.Character:FindFirstChild("PaintBucket")
  38. function get(p)
  39.     local p1 = p.Position - (p.Size / 2)
  40.     local p2 = p.Position + (p.Size / 2)
  41.     return p1,p2
  42. end
  43.  
  44. local r1 = {math.huge,math.huge,math.huge}
  45. local r2 = {0,0,0}
  46. for i,v in next,workspace.Provinces:GetDescendants() do
  47.     if v:IsA("BasePart") and v.Name == "Province" then
  48.         local p1,p2 = get(v)
  49.         if p1.X < r1[1] then r1[1] = p1.X end
  50.         if p1.Y < r1[2] then r1[2] = p1.Y end
  51.         if p1.Z < r1[3] then r1[3] = p1.Z end
  52.         if p2.X > r2[1] then r2[1] = p2.X end
  53.         if p2.Y > r2[2] then r2[2] = p2.Y end
  54.         if p2.Z > r2[3] then r2[3] = p2.Z end
  55.     end
  56. end
  57. r1 = Vector3.new(unpack(r1))
  58. r2 = Vector3.new(unpack(r2))
  59. local r = Region3.new(r1,r2)
  60.  
  61. function paint(rem, part, color)
  62.     return rem:InvokeServer("PaintPart", {Part = part;Color = color})
  63. end
  64.  
  65. function checkcol(c1, c2)
  66.     return c1.R == c2.R and c1.G == c2.G and c1.B == c2.B
  67. end
  68. function invertColor(p)
  69.     return Color3.new(1-p.Color.R,1-p.Color.G,1-p.Color.B)
  70. end
  71.  
  72. function invert()
  73.     if t then
  74.         if t.Parent == plr.Backpack then plr.Character.Humanoid:EquipTool(t) end
  75.         local r = t:WaitForChild("Remotes"):WaitForChild("ServerControls")
  76.         for i,v in next, workspace.Provinces:GetChildren() do
  77.             if v:IsA("BasePart") then
  78.                 local c = invertColor(v)
  79.                 if v.Name == "Province" and not checkcol(v.Color, c) then
  80.                     spawn(function() paint(r,v,c) end)
  81.                 end
  82.             end
  83.         end
  84.     end
  85. end
  86.  
  87. function rainbowColor(p)
  88.     return Color3.fromHSV(math.abs((p.Position.X-r.CFrame.X)/r.Size.X),1,1)
  89. end
  90.  
  91. function rainbow()
  92.     if t then
  93.         if t.Parent == plr.Backpack then plr.Character.Humanoid:EquipTool(t) end
  94.         local r = t:WaitForChild("Remotes"):WaitForChild("ServerControls")
  95.         for i,v in next, workspace.Provinces:GetChildren() do
  96.             if v:IsA("BasePart") then
  97.                 local c = rainbowColor(v)
  98.                 if v.Name == "Province" and not checkcol(v.Color, c) then
  99.                     spawn(function() paint(r,v,c) end)
  100.                 end
  101.             end
  102.         end
  103.     end
  104. end
  105.  
  106. function save(name)
  107.     local t = {
  108.     }
  109.     function new(i)
  110.         table.insert(t,{i.Position;i.Color})
  111.     end
  112.     for i,v in next,workspace.Provinces:GetDescendants() do
  113.         if v:IsA("BasePart") and v.Name == "Province" then
  114.             new(v)
  115.         end
  116.     end
  117.     local s = "return {"
  118.     for i,v in next, t do
  119.         s = s.."{Vector3.new("..v[1].X..","..v[1].Y..","..v[1].Z..");Color3.new("..v[2].R..","..v[2].G..","..v[2].B..")};"
  120.     end
  121.     s = s.."}"
  122.     if cansave then
  123.         writefile("mapgame/saves/"..name..".lua",s)
  124.     else
  125.         saves[name] = s
  126.     end
  127. end
  128.  
  129. function loadColor(T,p)
  130.     for i = 1,#T do
  131.         local I
  132.         if i%2 == 0 then
  133.             I = #T+1-math.floor(i/2)
  134.         else
  135.             I = math.floor(i/2+.5)
  136.         end
  137.         if p.Position == T[I][1] then c = T[I][2] table.remove(T,I) return c end
  138.     end
  139. end
  140.  
  141. function loadmap(name)
  142.     if cansave then
  143.         if not isfile("mapgame/saves/"..name..".lua") then return false end
  144.     else
  145.         if saves[name] == nil then return false end
  146.     end
  147.     local T
  148.     if cansave then
  149.         T = loadstring(readfile("mapgame/saves/"..name..".lua"))()
  150.     else
  151.         T = loadstring(saves[name])()
  152.     end
  153.     if t then
  154.         if t.Parent == plr.Backpack then plr.Character.Humanoid:EquipTool(t) end
  155.         local r = t:WaitForChild("Remotes"):WaitForChild("ServerControls")
  156.         for i,v in next, workspace.Provinces:GetChildren() do
  157.             if v:IsA("BasePart") and v.Name == "Province" then
  158.                 local c = loadColor(T,v)
  159.                 if not checkcol(v.Color, c) then
  160.                     spawn(function() paint(r,v,c) end)
  161.                 end
  162.             end
  163.         end
  164.     end
  165. end
  166.  
  167. function name(n,t)
  168.     for i,v in next,game.Players:GetPlayers() do
  169.         if n:lower() == v.Name:lower():sub(1,#n) or n:lower() == v.DisplayName:lower():sub(1,#n) or n:lower() == "all" then
  170.             for I,V in next, v.Character:GetChildren() do
  171.                 if V:FindFirstChild("ServerHandler") then
  172.                     spawn(function() V.ServerHandler:FireServer(t) end)
  173.                 end
  174.             end
  175.         end
  176.     end
  177. end
  178.  
  179. function setcolor(color)
  180.     local c = BrickColor.new(color).Color
  181.     if t then
  182.         if t.Parent == plr.Backpack then plr.Character.Humanoid:EquipTool(t) end
  183.         local r = t:WaitForChild("Remotes"):WaitForChild("ServerControls")
  184.         for i,v in next, workspace.Provinces:GetChildren() do
  185.             if v:IsA("BasePart") then
  186.                 if v.Name == "Province" and not checkcol(v.Color, c) then
  187.                     spawn(function() paint(r,v,c) end)
  188.                 end
  189.             end
  190.         end
  191.     end
  192. end
  193.  
  194. function replace(col1,col2)
  195.     local c1 = BrickColor.new(col1)
  196.     local c2 = BrickColor.new(col2)
  197.     if t then
  198.         if t.Parent == plr.Backpack then plr.Character.Humanoid:EquipTool(t) end
  199.         local r = t:WaitForChild("Remotes"):WaitForChild("ServerControls")
  200.         for i,v in next, workspace.Provinces:GetChildren() do
  201.             if v:IsA("BasePart") then
  202.                 if v.Name == "Province" and v.BrickColor == c1 then
  203.                     spawn(function() paint(r,v,c2.Color) end)
  204.                 end
  205.             end
  206.         end
  207.     end
  208. end
  209.  
  210. function RAND()
  211.     if t then
  212.         if t.Parent == plr.Backpack then plr.Character.Humanoid:EquipTool(t) end
  213.         local r = t:WaitForChild("Remotes"):WaitForChild("ServerControls")
  214.         for i,v in next, workspace.Provinces:GetChildren() do
  215.             if v:IsA("BasePart") then
  216.                 local c = Color3.new(math.random(0,255)/255,math.random(0,255)/255,math.random(0,255)/255)
  217.                 if v.Name == "Province" and not checkcol(v.Color, c) then
  218.                     spawn(function() paint(r,v,c) end)
  219.                 end
  220.             end
  221.         end
  222.     end
  223. end
  224.  
  225. plr.Chatted:Connect(function(msg,r)
  226.     t = plr.Backpack:FindFirstChild("PaintBucket") or plr.Character:FindFirstChild("PaintBucket")
  227.     if msg:find("/") == nil then return end
  228.     local cmd = msg:split("/")[1]
  229.     local a = {select(2,unpack(msg:split("/")))}
  230.     if cmd == "invert" then
  231.         invert()
  232.     elseif cmd == "rainbow" then
  233.         rainbow()
  234.     elseif cmd == "save" then
  235.         save(a[1])
  236.     elseif cmd == "load" then
  237.         loadmap(a[1])
  238.     elseif cmd == "del" then
  239.         if cansave then
  240.             delfile("mapgame/saves/"..a[1]..".lua")
  241.         else
  242.             saves[a[1]] = nil
  243.         end
  244.     elseif cmd == "name" then
  245.         name(a[1],a[2])
  246.     elseif cmd == "noname" then
  247.         for i,v in next, plr.Character:GetChildren() do
  248.             local h = v:FindFirstChild("Humanoid")
  249.             if h then h = h.Parent.Head h.Weld:Destroy() end
  250.         end
  251.     elseif cmd == "setcolor" then
  252.         setcolor(a[1])
  253.     elseif cmd == "replace" then
  254.         replace(a[1],a[2])
  255.     elseif cmd == "random" then
  256.         RAND()
  257.     end
  258. end)
RAW Paste Data Copied