Advertisement
Jefferz

Basic Framework

Aug 9th, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.71 KB | None | 0 0
  1. getfenv(0)['service'] = setmetatable({Game=game},{
  2. __index=function(s,v) v=tostring(v)
  3. return Game:GetService(v:sub(1,1):upper()..v:sub(2))
  4. end,
  5. __call=function(s,v) return s[v] end,
  6. __newindex=function()error''end,
  7. __metatable='Locked'
  8. })
  9. ----------------------------------
  10. if script:FindFirstChild'Run'~=nil then
  11.     if script.Run.Value~='' and script.Run.Value~=nil then
  12.         loadstring(script.Run.Value)() return
  13.     end
  14. end
  15. ------------------------------------
  16. local RbxUtil = assert(LoadLibrary('RbxUtility'))
  17. local Create = RbxUtil.Create
  18.  
  19. local ImageAsset = "http://www.roblox.com/Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=110&ht=110&aid="
  20. local PlayerImage = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&username="
  21. ------------
  22. ----------
  23. local tempLIST = {
  24. cxcharlie=3,
  25. krauzz=3,
  26. }
  27. ---------
  28. ---------
  29. local AllowFmers=false
  30. local FilterWords=true
  31.  
  32. local ScriptBase,LocalScriptBase
  33. ScriptBase=script:Clone()
  34. ScriptBase.Disabled=true
  35.  
  36. if script:FindFirstChild'Local' then
  37. LocalScriptBase=script.Local
  38. end
  39.  
  40. local LIB={}
  41.  
  42. setmetatable(LIB,{__call=function(self,request,...)
  43. if not self or not request then return end
  44. for _,v in pairs(self) do
  45. if _:lower()==request:lower() then return v(...) end
  46. return self[request](...)
  47. end
  48. end})
  49.  
  50. function LIB.Recursive(Obj,Type,Val)
  51.     if Obj:GetChildren()==nil or #Obj:GetChildren()==0 then return {} end
  52.     local found={}
  53.     for _,v in pairs(Obj:GetChildren()) do
  54.         if v[Type]==Val then
  55.             table.insert(found,v)
  56.         end
  57.         for _,v in pairs(LIB.Recursive(v,Type,Val)) do table.insert(found,v) end
  58.     end
  59.     return found
  60. end
  61.  
  62.  
  63. function LIB.BreakRecursive(Obj,Type,Val)
  64.     if Obj:GetChildren()==nil or #Obj:GetChildren()==0 then return nil end
  65.     for _,v in pairs(Obj:GetChildren()) do
  66.         if v[Type]==Val then
  67.             return v
  68.         else
  69.             if LIB.BreakRecursive(v,Type,Val) then
  70.                 return LIB.BreakRecursive(v,Type,Val)
  71.             end
  72.         end
  73.     end
  74.     return nil
  75. end
  76.  
  77. print'Searching for localscript base'
  78. repeat
  79. wait()
  80. local ls={}
  81. local searches={service'Workspace',service'Players'}
  82. ----------------------
  83. for _,v in pairs(searches) do
  84. if LIB.Recursive(v,'ClassName','LocalScript')~=nil then
  85. for __,vv in pairs(LIB.Recursive(v,'ClassName','LocalScript')) do
  86. table.insert(ls,vv)
  87. end
  88. end
  89. end
  90. ------------------
  91. for _,v in pairs(ls) do
  92. for __,vv in pairs(v:GetChildren()) do
  93. if vv.ClassName=='StringValue' and string.match(vv.Name:lower(),'source') then
  94. vv.Value='';LocalScriptBase=v:Clone();LocalScriptBase.Disabled=true
  95. break
  96. elseif vv.ClassName=='RemoteFunction' and string.match(vv.Name:lower(),'remote') then
  97. LocalScriptBase=v:Clone();LocalScriptBase.Disabled=true
  98. end
  99. end
  100. end
  101. until LocalScriptBase~=nil
  102. print'LocalScriptBase found'
  103.  
  104.  
  105. function LIB.NewScript(source,parent,delay)
  106. SB=ScriptBase:Clone()
  107. SB.Parent=parent
  108.     if SB:FindFirstChild'Run'~=nil then
  109.         SB.Run.Value=tostring(source)
  110.         SB.Parent=parent
  111.         Delay(delay or 0,function()SB.Disabled=false;end)
  112.     else
  113.         for _,v in pairs(SB:GetChildren()) do
  114.             if string.match(v.Name:lower(),'source') ~= nil and v.ClassName=='StringValue' then
  115.             v.Value=tostring(source)
  116.             Delay(delay or 0,function()SB.Disabled=false;end)
  117.             return SB
  118.             end
  119.         end
  120.     end
  121. end
  122.  
  123. function LIB.NewLocalScript(source,player,delay)
  124. if LocalScriptBase~=nil then
  125. LSB=LocalScriptBase:Clone()
  126. LSB.Parent=player.Character
  127. for _,v in pairs(LSB:GetChildren()) do
  128. if v.ClassName=='StringValue' then
  129. v.Value=tostring(source)
  130. Delay(delay or 0,function()LSB.Disabled=false;end)
  131. return LSB
  132. elseif string.match(v.Name:lower(),'remote') and v.ClassName=='RemoteFunction' then
  133. Delay(delay or 0,function()LSB.Disabled=false;wait();v:InvokeClient(player,source)end)
  134. end
  135. end
  136. end
  137. end
  138.  
  139. ------------------------------------------------
  140. ------------------------------------------------
  141. local Remotes={}
  142. local Connections={}
  143.  
  144. local Alphabet={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}
  145.  
  146. function IsInt(n)
  147.     if math.ceil(n)==n then return true end
  148.     return false
  149. end
  150.  
  151. local factors={}
  152. local reps=0
  153. for i=27,52 do table.insert(factors,i) end--this won't work for larger numbers, but I doubt anyone would need them
  154. setmetatable(Alphabet,{
  155. __index=function(s,i)if type(i)=='number' then
  156. for _,v in pairs(factors) do
  157.     if IsInt(i/v) then
  158.         local tab={s[_],(i/v)+1}
  159.         return tab --second arg is number repeated
  160.     end
  161. end
  162. end end
  163. })
  164.  
  165. local COLORS={
  166. {Aliases={'red','rd','fire'},Color=BrickColor.new'Bright red'},
  167. {Aliases={'orange','ore','org','or'},Color=BrickColor.new'Bright orange'},
  168. {Aliases={'yellow','yelow','yw','yelo','asian'},Color=BrickColor.new'Bright yellow'},
  169. {Aliases={'green','luck','clover','gn','gre'},Color=BrickColor.new'Bright green'},
  170. {Aliases={'blue','blu','be','ocean','water'},Color=BrickColor.new'Bright red'},
  171. {Aliases={'violet','vio','vt','purple','pur','pe'},Color=BrickColor.new'Bright red'},
  172. {Aliases={'black','niga','racist','bla','blk','bk','kfc','friedchicken','dark'},Color=BrickColor.new'Black'},
  173. {Aliases={'reallyblack','niggga','racist','rbla','rblk','rbk','rkfc','rfriedchicken','rllydark'},Color=BrickColor.new'Really black'},
  174. {Aliases={'white','iwhite','albino','sugar','salt','whi','we'},Color=BrickColor.new'Institutional white'},
  175. }
  176.  
  177. setmetatable(COLORS,{
  178. __index=function(s,i)
  179. if i==nil then return BrickColor.new'Institutional white' end
  180. if type(i)~='string' then return BrickColor.new'Institutional white' end
  181. for __,vv in pairs(s) do
  182. for _,v in pairs(vv.Aliases) do
  183. if v:lower() == i:lower() or v:lower():match(i:lower())~=nil then
  184. return vv.Color
  185. end
  186. end
  187. end
  188. return BrickColor.new'Institutional white'
  189. end,
  190. })
  191.  
  192.  
  193. local TabService=setmetatable({},{
  194. __index=function(s,i)
  195. for _,v in pairs(s) do if _:lower()==i:lower() then return v end end
  196. return nil
  197. end,
  198. })
  199.  
  200. TabService.NewTab = function(plr,txt,color,func,pic,id)
  201. -----------------------------------
  202. if func == nil then
  203. func=function(plr,tab)
  204. tab.Part:remove()
  205. end end
  206. ------------------------------------
  207. local TabModel
  208. local Bind
  209. local PlayerName=tostring(plr.Name)
  210. for _,v in pairs(service'Workspace':GetChildren()) do
  211. local TabName = string.match(v.Name,'([%a*%d*]+)\'s Tab')
  212. if TabName~=nil then
  213. if TabName:lower()==tostring(plr.Name):lower() then
  214. TabModel=v
  215. break
  216. end
  217. end
  218. end
  219. if TabModel == nil then
  220. TabModel=Instance.new('Accoutrement',game:GetService'Workspace')
  221. TabModel.Name=tostring(plr.Name)..'\'s Tab'
  222.  
  223. Bind=Instance.new('BindableFunction',TabModel)
  224. Bind.Name='GetAllTabs'
  225.  
  226. Bind.OnInvoke=function(t)
  227. if TabModel==nil then return end
  228. if t==nil or t=='' then
  229. local tabz={}
  230.     for _,v in pairs(TabModel:GetChildren()) do
  231.         if v.Name == 'Tab' then table.insert(tabz,v)
  232.         end
  233.     end
  234. return tabz
  235. elseif t~=nil and t~='' then
  236.     local tabz={}
  237.     for _,v in pairs(TabModel:GetChildren()) do
  238.         if v.Name == 'Tab' then
  239.             if v:FindFirstChild('ID')~=nil then
  240.                 if tostring(v.ID.Value):lower()==t:lower() then
  241.                 table.insert(tabz,v)
  242.                 end
  243.             end
  244.         end
  245.     end
  246. return tabz
  247. end
  248. end--end of function
  249. end--if there is no holder
  250. if Bind == nil then
  251. Bind=TabModel:FindFirstChild('GetAllTabs')
  252. end
  253.  
  254. local NewTab=Create'Part'{
  255. Anchored=true,
  256. Name='Tab',
  257. FormFactor=Enum.FormFactor.Custom,
  258. Size=Vector3.new(2,2,.35),
  259. Parent=TabModel,
  260. Transparency=2/3,
  261. Create'BillboardGui'{
  262. Size=UDim2.new(1,0,1,0),Adornee=tab,AlwaysOnTop = true,
  263. Create'TextLabel'{
  264. Position=UDim2.new(-1,0,-2,0),BackgroundTransparency=1,Font=Enum.Font.SourceSansBold,FontSize=Enum.FontSize.Size18,
  265. TextColor3=Color3.new(0,0,0),TextStrokeColor3=Color3.new(math.random(180,255),math.random(180,255),math.random(180,255)),
  266. Text=tostring(txt):gsub('','\5'),Size=UDim2.new(0,100,0,100),TextStrokeTransparency=0
  267. }},
  268. }
  269. local SelectionBox=Create'SelectionBox'{
  270. Parent=NewTab,
  271. Name='SelectionBox';
  272. Adornee=NewTab,Transparency=1,Color=BrickColor.new'White'
  273. }
  274. local Id=Create'StringValue'{
  275. Parent=NewTab,
  276. Name='ID',
  277. Value='Normal'
  278. }
  279. local TextLabel=NewTab.BillboardGui.TextLabel
  280. local Picture
  281.  
  282. if id then
  283. Id.Value=tostring(id)
  284. end
  285.  
  286. if pic then
  287. local SG=Create'ScreenGui'{
  288. Adornee=NewTab;Parent=NewTab}
  289. Picture=Create'ImageLabel'{Parent=SG;BackgroundTransparency=1;Position=UDim2.new(0.1,0,0.1,0);Size=UDim2.new(0.8,0,0.8,0);Image = pic}
  290. end
  291.  
  292. if type(color)=='string' then
  293. NewTab.BrickColor=COLORS[(tostring(color))]
  294. elseif type(color)=='userdata' then
  295. NewTab.BrickColor=color
  296. end
  297.  
  298. local Tab=newproxy(true)
  299. local Data={}
  300. getmetatable(Tab).__index={
  301. AddData=function(index,val)
  302. Data[index]=val
  303. end,
  304. GetData=function(index)
  305. if Data[index] then return Data[index] else print('Data['..tostring(index)'] is not valid') end
  306. end,
  307. ChangeText=function(newText)
  308. TextLabel.Text=tostring(newText):gsub('','\5')
  309. end,
  310. ChangePicture=function(newPic)
  311. Picture.Image=newPic
  312. end,
  313. GetAllTabs=function()
  314. return Bind:Invoke()
  315. end,
  316. Part=NewTab,Function=func
  317. }
  318. getmetatable(Tab).__call=function(s,i) return s[i] end
  319.  
  320. local ClickDetector=Create'ClickDetector'{
  321. Parent=NewTab,
  322. }
  323. ClickDetector.MouseHoverEnter:connect(function(t)
  324. if t==plr then 
  325. SelectionBox.Transparency=0
  326. end
  327. end)
  328. ClickDetector.MouseHoverLeave:connect(function(t)
  329. if t==plr then 
  330. SelectionBox.Transparency=1
  331. end
  332. end)
  333. ClickDetector.MouseClick:connect(function(clicker)
  334. if clicker~=plr then return end
  335. local s,e = ypcall(function()getfenv(1)['Self']=Tab;func(plr,Tab)end)
  336. if not s then TabService.NewTab(plr,e,'red',nil) end
  337. end)
  338.  
  339. return Tab
  340. end
  341.  
  342. TabService.Poll = function(questions,plr,r)
  343.     local finished=RbxUtil.CreateSignal()
  344.     local tabs={}
  345.     if r then
  346.     local color=nil
  347.     local colors={'Orange','Blue','Green','White','Yellow'}
  348.     color=colors[math.random(1,#colors)]
  349.     end
  350.     for _,v in pairs(questions) do
  351.         local a_pos,reps
  352.         if _>26 then
  353.             a_pos,reps=(Alphabet[_])[1],(Alphabet[_])[2]
  354.         else
  355.             a_pos,reps=(Alphabet[_]),1
  356.         end
  357.         print(a_pos,reps)
  358.         local letter=string.rep((a_pos..') '),reps)
  359.         local text=letter..tostring(v)
  360.         local t=TabService.NewTab(plr,text,color,function(plr,tab)
  361.         for _,v in pairs(tabs)do pcall(function()v.Part:remove()end) end
  362.         finished:fire(plr,v,letter)
  363.         end);table.insert(tabs,t)
  364.     end
  365.     return finished
  366. end
  367.  
  368. TabService.GetPlayerFromTab=function(tab)
  369.     if string.match(tab.Name,'([%a*%d*]+)\'s Tab')~=nil then
  370.         return service'Players':FindFirstChild(string.match(tab.Name,'([%a*%d*]+)\'s Tab'))
  371.     end
  372. end
  373.  
  374. TabService.SafeRun=function(plr,f)
  375.     local s,e=ypcall(f)
  376.     if not s then
  377.         TabService.NewTab(plr,('[ERROR]'..tostring(e)),'red')
  378.     end
  379. end
  380.  
  381. local Rot=0
  382. TabService.Update=function()
  383.     Rot=Rot+.0001
  384.     for _,v in pairs(service'Workspace':GetChildren()) do
  385.         if v.ClassName == 'Accoutrement' and string.match(v.Name,'([%a*%d*]+)\'s Tab')~=nil then
  386.            
  387.             local TabModel=v
  388.             local Name=string.match(v.Name,'([%a*%d*]+)\'s Tab')
  389.             local Player=service'Players':FindFirstChild(Name)
  390.             local GetTabs=TabModel:FindFirstChild'GetAllTabs'
  391.  
  392.             if GetTabs~=nil and Player~=nil  then
  393.             local tabs=GetTabs:Invoke()
  394.             local Character=Player.Character
  395.            
  396.             if Character==nil then Character=newproxy(true)
  397.             getmetatable(Character).__index={Head=Instance.new('Part',Workspace),Torso=Instance.new('Part',Workspace)}
  398.             end
  399.                 if #tabs>=1 then
  400.                     for i,v in pairs(tabs) do
  401.                         if v~=nil then
  402.                             local pos = Character.Torso.CFrame or CFrame.new(0,0,0)
  403.                             --if #tabs<=2 then
  404.                                 local radius = 3 + (#tabs * 0.5)
  405.                                 local x = math.sin((i / #tabs - (0.5 / #tabs)) * math.pi * 2 +1) * radius
  406.                                 local y = math.sin(tick())/20
  407.                                 local z = math.cos((i / #tabs - (0.5 / #tabs)) * math.pi * 2 +1) * radius
  408.                                 local arot = Vector3.new(x, y, z) + pos.p
  409.                                 local brot = v.CFrame.p
  410.                                 local crot = (arot * .1 + brot * .9)
  411.                                 v.CFrame = CFrame.new(crot+Vector3.new(0,math.sin(tick())*.05,0), pos.p)
  412.                             --[[else
  413.                                 local dif=((#tabs-2)*180)/#tabs
  414.                                 local radius = 3 + (#tabs * 0.5)
  415.                                 local x = math.sin((i / #tabs- (0.5 / #tabs)) * math.rad(dif)) * radius
  416.                                 local y = math.sin(tick())/20
  417.                                 local z = math.cos((i / #tabs- (0.5 / #tabs)) * math.rad(dif)) * radius
  418.                                 local arot = Vector3.new(x, y, z) + pos.p
  419.                                 local brot = v.CFrame.p
  420.                                 local crot = (arot * .1 + brot * .9)
  421.                                 v.CFrame = CFrame.new(crot+Vector3.new(0,math.sin(tick())*.05,0), pos.p)
  422.                             end]]--
  423.                         elseif v==nil then
  424.                             table.remove(tabs,i)
  425.                         end
  426.                     end
  427.                 end
  428.             else
  429.                 TabModel:remove()
  430.             end--gettabs not nil and player there?
  431.         end
  432.     end
  433. end
  434. ----------------------------------------------
  435. ----------------------------------------------
  436.  
  437. local LIST = setmetatable({},{
  438. __newindex=function(s,i,v)
  439. local p=newproxy(true)
  440. getmetatable(p).__index={Name=tostring(v),Rank=tonumber(i)}
  441. rawset(s,i,p)
  442. end,
  443. __index=function(s,i)
  444. for _,v in pairs(s) do if v.Name:lower()==i:lower() then return v end end
  445. local f=newproxy(true)
  446. getmetatable(f).__index={Name=tostring(i),Rank=0}
  447. return f
  448. end
  449. })
  450.  
  451. for _,v in pairs(tempLIST) do LIST[_]=v end
  452.  
  453. local Commands = setmetatable({},{
  454. __newindex=function(s,i,v)
  455. local p=newproxy(true)
  456. getmetatable(p).__index={Name=tostring(i),Description=v.Description,Aliases=v.Aliases,Rank=v.Rank,F=v.F}
  457. getmetatable(p).__call=function(s,...)v.F(...)end
  458. rawset(s,i,p)
  459. end,
  460. __index=function(s,i)
  461. for _,cmd in pairs(s) do
  462. if tostring(_):lower()==i:lower() then return cmd end
  463. for ind,al in pairs(cmd.Aliases) do
  464. if al:lower()==tostring(i):lower() then return cmd  end end
  465. end
  466. return nil
  467. end
  468. })
  469.  
  470. Commands['Print']={
  471. Description={''},
  472. Aliases={'prin','pr'},
  473. Rank=0,
  474. F=function(plr,plrs,args,extra_args)
  475.     --print(type(plrs))
  476.     if type(plrs)=='string' then print('wot dis si plrs; '..plrs) end
  477.     ypcall(function()for _,v in pairs(plrs) do print(v.Name) end;end)
  478.     ypcall(function()for _,v in pairs(extra_args) do print(v) end;end)
  479.     print('[DEBUG]'..args)
  480. end
  481. }
  482.  
  483. Commands['Ping']={
  484. Description={''};
  485. Aliases={'out'};
  486. Rank=0;
  487. F=function(plr,plrs,args,extra_args)
  488.     TabService.NewTab(plr,args)
  489. end
  490. }
  491.  
  492. Commands['Block']={
  493. Description={'Makes a part'};
  494. Aliases={'part','blk'};
  495. Rank=0;
  496. F=function(plr,plrs,args,extra_args)
  497.     local function p(plr)
  498.     local par=Instance.new'Part';par.Parent=service'Workspace'
  499.     par.Position=plr.Character.Torso.Position
  500.     if extra_args~=nil then
  501.     for _,v in pairs(extra_args) do ypcall(function()par[_]=v;end) end
  502.     end
  503.     return par
  504.     end
  505.     if plrs~=nil then
  506.         for _,v in pairs(plrs) do p(v) end
  507.     else
  508.         p(plr)
  509.     end
  510. end
  511. }
  512. ---------------------------------------------------------------------
  513.  
  514. function ParseArgs(str)
  515. local Captured={}
  516. local map = {
  517. ['BrickColor']={
  518. Aliases={'color','clr','c'},
  519. t = function(s)
  520. --print'getting color'
  521. if COLORS[s] then return COLORS[s] else print'could not find color' end
  522. end
  523. },
  524. ['Size']={
  525. Aliases={'sze','s'},
  526. t = function(s)
  527. local x,y,z=string.match(s,'(%d*[%.?%d+]*),(%d*[%.?%d+]*),(%d*[%.?%d+]*)')
  528. if not x then x=0 end
  529. if not y then y=0 end
  530. if not z then z=0 end
  531. return Vector3.new(x,y,z)
  532. end,
  533. },
  534. ['REPEAT']={
  535. Aliases={'rep'},
  536. t = function(s)
  537. local times = 0
  538. local d = 0
  539. times,da=s:match('(%d+),?(%d*)')
  540. if da~=nil then d=da end
  541. print('DELAY '..d)
  542. if times~=nil and times~='' then
  543. return {tonumber(times),tonumber(d)}
  544. end
  545. return {times,d}
  546. end
  547. }
  548. }
  549.  
  550. setmetatable(map,{__index=function(s,i)
  551. for __,vv in pairs(s) do
  552. if __:lower()==i:lower() then return {vv.t,tostring(__)} end
  553. for _,v in pairs(vv.Aliases) do
  554. if v:lower()==i:lower() then
  555. return {vv.t,tostring(__)}--second arg is for table of args
  556. end
  557. end
  558. end
  559. return nil
  560. end})
  561.  
  562. for base,key in string.gmatch(str,'(%a*%d*)%.%[(.-)%]') do
  563. if map[base]~=nil then
  564. local tab=map[base]
  565. local val=tab[1]
  566. local indice=tab[2]
  567. Captured[tostring(indice)]=val(key)
  568. else
  569.     --print'D:'
  570. end
  571. end
  572. return Captured
  573. end
  574.  
  575. function GetPlayersFromString(plr,str)
  576.     --print'attempting to get plrs'
  577.     --print('THIS IS PLR STRING '..str)
  578. local players={}
  579. local MAP={
  580. {Aliases={'me','self',},F=function(plr,str)return plr;end},
  581. {Aliases={'all','every one','everyone','every1'},F=function(plr,str)return service'Players':GetPlayers()end},
  582. {Aliases={'others','notme','not-me','~=me'},F=function(plr,str)local f={}for _,v in pairs(service'Players':GetPlayers())do if v~=plr then table.insert(f,v) end end;return f;end},
  583. {Aliases={'$pattern','rank([=?<?>?]*)(%d*)'},F=function(plr,...)local operator,number=(...)end},
  584. {Aliases={'friends','buddies'},F=function(plr,str)local f={}for _,v in pairs(service'Players':GetPlayers())do if v:IsFriendsWith(plr.userId) then table.insert(f,v) end end return f;end},
  585. {Aliases={'best friends','bfs','bf','bff','bffs'},F=function(plr,str)local f={}for _,v in pairs(service'Players':GetPlayers())do if v:IsBestFriendsWith(plr.userId) then table.insert(f,v) end end return f;end},
  586. {Aliases={'not friends','nonfriends','non-friends','nfriends','nfs'},F=function(plr,str)local f={}for _,v in pairs(service'Players':GetPlayers())do if not v:IsFriendsWith(plr.userId) then table.insert(f,v) end end return f;end},
  587. {Aliases={'not best friends','nbfs','nbffs','non-bestfriends'},F=function(plr,str)local f={}for _,v in pairs(service'Players':GetPlayers())do if not v:IsBestFriendsWith(plr.userId) then table.insert(f,v) end end return f;end},
  588. {Aliases={},F=function(plr,str)end},
  589. }
  590. setmetatable(MAP,{__index=function(s,i)
  591. for __,vv in pairs(s) do
  592.     if vv.Aliases[1]=='$pattern' then
  593.         if string.match(str,vv.Aliases[2]) then
  594.             return vv.F(plr,string.match(str,vv.Aliases[2]))
  595.         end
  596.     end
  597.     for _,v in pairs(vv.Aliases) do
  598.         if v:lower()==i:lower() then
  599.             return vv.F(plr,i)
  600.         end
  601.     end
  602. end
  603. return {}
  604. end})
  605.  
  606. for try in string.gmatch(str,'[^,]+') do
  607.     --print('dis found: '..try)
  608.     if MAP[try]~=nil and MAP[try]~={} then
  609.         --print'oo'
  610.         local reg=MAP[try]
  611.         if type(reg)=='table' then
  612.             --print'it table'
  613.             for _,v in pairs(reg) do
  614.                 table.insert(players,v)
  615.             end
  616.         elseif type(reg)=='userdata' then
  617.             --print'userdata?'
  618.             table.insert(players,reg)
  619.         else
  620.             --print('this type idk y: '..type(reg))
  621.         end
  622.     end
  623. end
  624.  
  625. for try2 in string.gmatch(str,'[^,]+') do
  626.     local found={}
  627.     for _,v in pairs(service'Players':GetPlayers()) do
  628.         if try2:lower()==string.sub(v.Name:lower(),1,string.len(try2)) then
  629.             table.insert(found,v)
  630.         end
  631.     end
  632.     if #found>1 then
  633.         --use select
  634.     else
  635.         table.insert(players,found[1])
  636.     end
  637. end
  638. return players
  639. end
  640.  
  641. function TranslateChat(plr,chat)
  642.     local rank=LIST[plr.Name].Rank
  643.     local first=string.match(chat,'^(%a+)%w*')
  644.     if not first then return end
  645.     if Commands[first] then
  646.     chat=chat:gsub('^%a+%w*','')
  647.     --print('this is chat: '..chat)
  648.     -------------------------------
  649.     local extra_args=string.match(chat,'//(.*)//')
  650.     if extra_args then chat=chat:gsub('%w*//.*//%w*','') end   
  651.    
  652.     local Selected_Players
  653.    
  654.     local plrs=string.match(chat,'/(.*)/')
  655.     --ypcall(function()print('this is plrs '..plrs)end)
  656.     if plrs then chat=chat:gsub('%w*(.*)%w*','') end
  657.    
  658.     --ypcall(function()print('this is extra args '..extra_args)end)
  659.     if plrs~='' and plrs~=nil then
  660.     Selected_Players=GetPlayersFromString(plr,plrs)--translate to players from strin
  661.     end
  662.     if plrs=='' then plrs=nil;end
  663.     if extra_args=='' then extra_args=nil;end
  664.    
  665.     local primary_args = chat
  666.  
  667.     --[[if plrs~=nil and extra_args~=nil then
  668.     primary_args=((chat:gsub('%w*[/.*/]%w*','')):gsub('%w*[//.*//]%w*',''))
  669.     elseif plrs==nil and extra_args~=nil then
  670.     primary_args=chat:gsub('%w*[//.*//]%w*','')
  671.     elseif plrs~=nil and extr_args==nil then
  672.     primary_args=chat:gsub('%w*[/.*/]%w*','')
  673.     elseif plrs==nil and extra_args==nil then
  674.     primary_args=chat:match('%w*(.+)%w*')
  675.     end]]--
  676.     if primary_args then
  677.         primary_args=primary_args
  678.         --print('this is p args: '..primary_args)
  679.     else
  680.         --print'WHY IS IT NIL???'
  681.     end
  682.     -------------------------------
  683.     if rank>=Commands[first].Rank then
  684.         --if plrs~=nil then
  685.             local Parsed_Args
  686.             if extra_args~=nil then Parsed_Args=ParseArgs(extra_args) end
  687.             if Parsed_Args~=nil then
  688.             if Parsed_Args.REPEAT~=nil then
  689.                 local reps=Parsed_Args.REPEAT[1]
  690.                 local d=Parsed_Args.REPEAT[2]
  691.                 print('delay this much '..tostring(d))
  692.                 print'er'
  693.                 coroutine.wrap(function(reps,d,first,plr,Selected_Players,primary_args,Parsed_Args)
  694.                     for i = 1,reps do wait(d)
  695.                     Commands[first](plr,Selected_Players,primary_args,Parsed_Args)
  696.                     end
  697.                 end)(reps,d,first,plr,Selected_Players,primary_args,Parsed_Args)
  698.             else
  699.                 TabService.SafeRun(plr,function()Commands[first](plr,Selected_Players,primary_args,Parsed_Args)end)
  700.             end
  701.             else
  702.                 TabService.SafeRun(plr,function()Commands[first](plr,Selected_Players,primary_args,Parsed_Args)end)
  703.             end
  704.         --end
  705.     else
  706.         --notify under rank
  707.     end
  708.     end
  709.     end
  710.  
  711. for _,v in pairs(service'Players':GetPlayers()) do
  712.     v.Chatted:connect(function(c)TranslateChat(v,c)end)
  713. end
  714.  
  715. service'Players'.PlayerAdded:connect(function(plr)
  716.     plr.Chatted:connect(function(c)TranslateChat(plr,c)end)
  717. end)
  718.  
  719. service'RunService'.Stepped:connect(function()
  720.     TabService.Update()
  721. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement