Advertisement
Sqxwell

api

Jan 23rd, 2023
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.89 KB | None | 0 0
  1. local ver = 1
  2.  
  3. local xlp = {
  4. ["div"] = function(v1, v2)
  5. return v1/v2
  6. end,
  7. ["humanoidrootpart"] = function()
  8. return game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
  9. end,
  10. ["humanoid"] = function()
  11. return game:GetService("Players").LocalPlayer.Character.Humanoid
  12. end,
  13. ["tween"] = function(time, pos) -- tween to position by (time) + (cframe)
  14. game:GetService("TweenService"):Create(game.Players.LocalPlayer.Character.HumanoidRootPart, TweenInfo.new(time, Enum.EasingStyle.Linear), {CFrame = pos}):Play() task.wait(time)
  15. end,
  16. ["walkTo"] = function(v3) -- walk to position (not pathfinding)
  17. game:GetService("Players").LocalPlayer.Character.Humanoid:MoveTo(v3)
  18. end,
  19. ["isExist"] = function(obj) -- check for object, if it is exist then returnes true
  20. if obj ~= nil then
  21. return true
  22. end
  23. end,
  24. ["notify"] = function(title, description, duration)
  25. pcall(function()
  26. game.StarterGui:SetCore("SendNotification", {
  27. Title = title;
  28. Text = description;
  29. Duration = duration;
  30. })
  31. end)
  32. end,
  33. ["isSynapse"] = function()
  34. if syn then
  35. return true
  36. else
  37. return false
  38. end
  39. end,
  40. ['isKrnl'] = function()
  41. if Krnl then
  42. return true
  43. else
  44. return false
  45. end
  46. end,
  47. ['tableVReturn'] = function(table)
  48. for i,v in pairs(table) do
  49. print(i,v)
  50. end
  51. end,
  52. ['ver'] = ver,
  53. ['placeid'] = game.PlaceId,
  54. ['placeversion'] = game.PlaceVersion,
  55. ['getsitebody'] = function(link)
  56. local Response = syn.request({Url = link, Method = "GET"})
  57. return Response.Body
  58. end,
  59. ['killroblox'] = function()
  60. game:Shutdown()
  61. end,
  62. ['rmagnitude'] = function(v1, v2)
  63. return (v1-v2).magnitude
  64. end,
  65. ['varExchange'] = function(v,v2)
  66. v,v2 = v2,v
  67. local vartable = {v,v2}
  68. return vartable
  69. end,
  70. ['enabled'] = true,
  71. ['player'] = game:GetService("Players").LocalPlayer,
  72. ['camera'] = function()
  73. return game:GetService("Workspace").Camera
  74. end,
  75. ['search'] = {
  76. ['byName'] = function(a,b)
  77. for _,v in pairs(a:GetDescendants()) do
  78. if v.Name == b then
  79. return v
  80. end
  81. end
  82. warn("Can't find object")
  83. end,
  84. ["byMaterial"] = function(a, b, c)
  85. pcall(function()
  86. local size = c
  87. if c+1-1 == nil or c < 1 or c == nil then
  88. size = 1
  89. elseif c == 0 then
  90. size = math.huge
  91. end
  92. for _, v in pairs(a:GetDescendants()) do
  93. if v:IsA(b) then
  94. local objects = {}
  95. table.insert(objects, v)
  96. if #objects == size then
  97. return objects
  98. end
  99. end
  100. end
  101. warn("Can't find object")
  102. end)
  103. end
  104. },
  105. ['childTable'] = function(path)
  106. local rtable = {}
  107. for _,v in pairs(path:GetChildren()) do
  108. table.insert(rtable, v)
  109. end
  110. return rtable
  111. end,
  112. ['afunc'] = function(f)
  113. --[[
  114. f = function
  115.  
  116. function functiontest()
  117. task.wait(3) -- you can do task.wait(), it will be async
  118. print("test")
  119. end
  120.  
  121. api.afunc(functiontest)
  122. ]]
  123. local wa = coroutine.create(
  124. function()
  125. f()
  126. end
  127. )
  128. coroutine.resume(wa)
  129. end,
  130. ['getclosestpart'] = function(path, t)
  131. local root = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
  132. if root == nil then return end
  133. local studs = math.huge
  134. local part;
  135. if not t then
  136. t = "descendants"
  137. end
  138. if t == "descendants" then
  139. for _, obj in ipairs(path:GetDescendants()) do
  140. if obj:IsA('BasePart') then
  141. local distance = (root.Position - obj.Position).Magnitude
  142. if distance < studs then
  143. studs = distance
  144. part = obj
  145. end
  146. end
  147. end
  148. else
  149. for _, obj in ipairs(path:GetDescendants()) do
  150. if obj:IsA('BasePart') then
  151. local distance = (root.Position - obj.Position).Magnitude
  152. if distance < studs then
  153. studs = distance
  154. part = obj
  155. end
  156. end
  157. end
  158. end
  159. return part
  160. end,
  161. ['getsmallestpart'] = function(path, typee, magnitude)
  162. if not typee then
  163. typee = "BasePart"
  164. end
  165. if typee ~= "BasePart" and typee ~= "MeshPart" then
  166. typee = "BasePart"
  167. end
  168. if not magnitude then
  169. magnitude = math.huge
  170. end
  171. local root = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
  172. if root == nil then return end
  173. local size = Vector3.new(math.huge,math.huge,math.huge)
  174. local part;
  175. for _, obj in ipairs(path:GetDescendants()) do
  176. if obj:IsA(typee) then
  177. local objsize = obj.Size
  178. if objsize.X < size.X and objsize.Y < size.Y and (obj.Position-root.Position).magnitude < magnitude then
  179. size = objsize
  180. part = obj
  181. end
  182. end
  183. end
  184. return part
  185. end,
  186. ['generaterandomstring'] = function(a)
  187. local let = ('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'):split('')
  188. local string = ''
  189. for i = 1, a do
  190. string = string..let[math.random(1, #let)]
  191. end
  192. return string
  193. end,
  194. ['request'] = syn and syn.request or http and http.request or http_request or httprequest or request,
  195. ['pathfindserv'] = game:GetService('PathfindingService'),
  196. ['toHMS'] = function(t)
  197. Minutes = (t - t%60)/60
  198. t = t - Minutes*60
  199. Hours = (Minutes - Minutes%60)/60
  200. Minutes = Minutes - Hours*60
  201. return string.format("%02i", Hours)..":"..string.format("%02i", Minutes)..":"..string.format("%02i", t)
  202. end,
  203. ['tablefind'] = function(tt, va)
  204. for i,v in pairs(tt) do
  205. if v == va then
  206. return i
  207. end
  208. end
  209. end,
  210. ['suffixstring'] = function(st)
  211. local suffixes = {"k", "m", "b", "t", "q", "Q", "sx", "sp", "o", "n", "d"}
  212. for i = #suffixes, 1, -1 do
  213. local mp = math.pow(10, i * 3)
  214. if st >= mp then
  215. return ("%.1f"):format(st / mp) .. suffixes[i]
  216. end
  217. end
  218. return tostring(st)
  219. end,
  220. ['teleport'] = function(cf)
  221. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = cf
  222. end,
  223. ['findvalue'] = function(Table, Value)
  224. if type(Table) == "table" then
  225. for index, value in pairs(Table) do
  226. if value == Value then
  227. return true
  228. end
  229. end
  230. else
  231. return false
  232. end
  233. return false
  234. end,
  235. ['webhook'] = function(hook, color, title, description)
  236. pcall(function()
  237. local OSTime = os.time();
  238. local Time = os.date('!*t', OSTime);
  239. local Embed = {
  240. color = color;
  241. title = title;
  242. description = description;
  243. };
  244.  
  245. (syn and syn.request or http_request) {
  246. Url = hook;
  247. Method = 'POST';
  248. Headers = {
  249. ['Content-Type'] = 'application/json';
  250. };
  251. Body = game:GetService'HttpService':JSONEncode( { content = Content; embeds = { Embed } } );
  252. };
  253. end)
  254. end,
  255. ['returnvalue'] = function(tab, val)
  256. ok = false
  257. for i,v in pairs(tab) do
  258. if string.match(val, v) then
  259. ok = v
  260. break
  261. end
  262. end
  263. return ok
  264. end,
  265. ['pathfind'] = function(target)
  266. local PathfindingService = game:GetService("PathfindingService")
  267. local Humanoid = game.Players.LocalPlayer.Character.Humanoid
  268. local Root = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
  269. local path = PathfindingService:CreatePath({
  270. AgentCanJump = true,
  271. WaypointSpacing = 1
  272. })
  273. path:ComputeAsync(Root.Position, target)
  274. local waypoints = path:GetWaypoints()
  275. for i, waypoint in ipairs(waypoints) do
  276. game:GetService("Players").LocalPlayer.Character.Humanoid:MoveTo(waypoint.Position)
  277. game:GetService("Players").LocalPlayer.Character.Humanoid.MoveToFinished:wait()
  278. if waypoint.Action == Enum.PathWaypointAction.Jump then
  279. Humanoid.Jump = true
  280. end
  281. end
  282. end,
  283. ['getcpnew'] = function(path)
  284. local Closest
  285. for i,v in next, path:GetChildren() do
  286. if Closest == nil then
  287. Closest = v
  288. else
  289. if (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Position).magnitude < (Closest.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude then
  290. Closest = v
  291. end
  292. end
  293. end
  294. return Closest
  295. end,
  296. ['getcpfrompart'] = function(path, part)
  297. local Closest
  298. for i,v in next, path:GetChildren() do
  299. if v:IsA("MeshPart") or v:IsA("Part") then
  300. if Closest == nil then
  301. Closest = v
  302. else
  303. if (part.Position - v.Position).magnitude < (Closest.Position - part.Position).magnitude then
  304. Closest = v
  305. end
  306. end
  307. end
  308. end
  309. return Closest
  310. end,
  311. ['partwithnamepart'] = function(name, path)
  312. for i,v in next, path:GetChildren() do
  313. if (v.Name:match(name)) then
  314. return v
  315. end
  316. end
  317. end,
  318. ['getbiggestmodel'] = function(path)
  319. local part
  320. for i,v in next, path:GetChildren() do
  321. if v:IsA("Model") then
  322. if part == nil then
  323. part = v
  324. end
  325. if v:GetExtentsSize().Y > part:GetExtentsSize().Y then
  326. part = v
  327. end
  328. end
  329. end
  330. return part
  331. end,
  332. ['imagehook'] = function(hook, description, title, image, duration)
  333. pcall(function()
  334. local OSTime = os.time();
  335. local Time = os.date('!*t', OSTime);
  336. local Embed = {
  337. color = '3454955';
  338. title = title;
  339. description = description;
  340. thumbnail = {
  341. url = image;
  342. };
  343. author = {
  344. name = "nil";
  345. };
  346. };
  347.  
  348. (syn and syn.request or http_request) {
  349. Url = hook;
  350. Method = 'POST';
  351. Headers = {
  352. ['Content-Type'] = 'application/json';
  353. };
  354. Body = game:GetService'HttpService':JSONEncode( { content = Content; embeds = { Embed } } );
  355. };
  356. end)
  357. end
  358. }
  359.  
  360. return xlp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement