Guest User

Datas

a guest
Jan 7th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.46 KB | None | 0 0
  1. folders = game.ServerScriptService:FindFirstChild(".PlayerFolders")
  2. folders2 = game.ServerScriptService.Crews
  3. local webHook = require(script.Parent.WebhookAPI)
  4. local myWebHook = webHook.new("523684243767820288","cL_YLz6v2PLp8hZjBwbC19fbooOGrJy2xedktOQgSeOiBWJkdUDSSJLLLcFZk0uQA1s9")
  5.  
  6. ignore = {"Invites", "Treasure", "Health", "MaxHealth"} -- things it should ignore
  7. DataStore = game:GetService("DataStoreService"):GetDataStore("DPODATANEW")
  8. DS = game:GetService("DataStoreService"):GetDataStore("DPOCREWSNEW")
  9.  
  10. function loadData(player, playerfolder, tabler)
  11. z = playerfolder:GetChildren()
  12. for i= 1, #z do
  13. keyname = z[i].Name
  14. dataz = tabler[keyname]
  15. if dataz ~= nil then -- saved key\
  16. --print("Loaded", z[i].Name, tabler[keyname])
  17. --make a table
  18. z[i].Value = tabler[keyname]
  19. end
  20. end
  21. end
  22.  
  23.  
  24. function saveData(player, savefolderz, new)
  25. nt = {}
  26. z = savefolderz:GetChildren()
  27. t = 0
  28. for i= 1, #z do
  29. if z[i].Name ~= "" then --ignore list
  30. ignored = false
  31. for d= 1, #ignore do
  32. if z[i].Name == ignore[d] then
  33. ignored = true
  34. --print("Ignored", z[i].Name)
  35. end
  36. end
  37. if ignored == false and z[i].ClassName ~= "Backpack" and (z[i].ClassName == "IntValue" or z[i].ClassName == "StringValue" or z[i].ClassName == "BoolValue" or z[i].ClassName == "NumberValue") then
  38. keyname = z[i].Name
  39. nt[keyname] = z[i].Value
  40. t = t + 1
  41. -- print("Saved", z[i].Name, nt[keyname], "=", z[i].Value)
  42. end
  43. end
  44. end
  45. if t < 3 then return end
  46. if new == true then
  47. DataStore:SetAsync(player.Name, nt)
  48. else
  49. DataStore:UpdateAsync(player.Name, function(oldValue) return nt; end)
  50. end
  51.  
  52. end
  53.  
  54. function Message(message)
  55. if not game:GetService("RunService"):IsStudio() then
  56. local BotName = "OPOR"
  57. myWebHook:post{username = BotName,content = message}
  58. end
  59. end
  60.  
  61. function onPlayerEntered(player)
  62. local savefolder = script.PlayerFolder:clone()
  63. savefolder.Name = player.Name
  64. savefolder.Parent = folders
  65.  
  66. local leaderstats = Instance.new("IntValue")
  67. leaderstats.Name = "leaderstats"
  68. leaderstats.Parent = player
  69.  
  70. local spn = Instance.new("ObjectValue")
  71. spn.Name = "SpawnChoice"
  72. --spn.Parent = player
  73.  
  74. local Skill = Instance.new("StringValue")
  75. Skill.Name = "Skill"
  76. Skill.Parent = player
  77.  
  78. local Use = Instance.new("BoolValue")
  79. Use.Name = "Use"
  80. Use.Parent = Skill
  81.  
  82. local std = Instance.new("IntConstrainedValue")
  83. std.Name = "StomachDie"
  84. std.MaxValue = 200
  85. std.Parent = savefolder
  86. std.Value = 100
  87.  
  88. local showbounty = Instance.new("IntValue")
  89. showbounty.Name = "Bounty"
  90. showbounty.Parent = leaderstats
  91. -- savefolder[".Bounty658"].BountyUpdate.Disabled = false
  92.  
  93. local bountyen = Instance.new("BoolValue")
  94. bountyen.Name = "BountyEnabled"
  95. bountyen.Parent = player
  96. bountyen.Value = true
  97.  
  98. local tabler = DataStore:GetAsync(player.Name)
  99.  
  100. if tabler then -- player has datastore
  101. loadData(player, savefolder, tabler)
  102. else -- player has no datastore
  103. saveData(player, savefolder, true)
  104. end
  105. savefolder.BusoPoints.Script.Disabled = false
  106. savefolder.HaoPoints.Script.Disabled = false
  107. savefolder.KenPoints.Script.Disabled = false
  108. if savefolder:FindFirstChild("Banned") and savefolder:FindFirstChild("Banned").Value == true then
  109. player:Kick("You are banned. BCode:41")
  110. end
  111. wait()
  112.  
  113. local HaoSound = savefolder:FindFirstChild("HaoS")
  114. if HaoSound and HaoSound.Value == 0 then
  115. math.randomseed(tick())
  116. local random = math.random(1,3)
  117. HaoSound.Value = random
  118. end
  119.  
  120. if not savefolder:findFirstChild("Crew") then
  121. local zcrew = Instance.new("StringValue")
  122. zcrew.Name = "Crew"
  123. zcrew.Parent = savefolder
  124. end
  125.  
  126.  
  127. if savefolder.Crew.Value ~= "" and not game.ServerScriptService.Crews:findFirstChild(savefolder.Crew.Value) then
  128. local x = DS:GetAsync(savefolder.Crew.Value)
  129. if x ~= nil then -- if there is a crew of that name
  130. if x[2] ~= "" then -- check for a cpt.
  131. else
  132. savefolder.Crew.Value = "" -- remove em from the crew
  133. end
  134. if game.ServerScriptService.Crews:findFirstChild(x[1]) then
  135. else
  136. local nf = game.ServerScriptService.RFEDS.CrewFolder:clone()
  137. nf.Parent = game.ServerScriptService.Crews
  138. nf.Name = x[1]
  139. nf.Title.Value = x[1]
  140. nf.Cpt.Value = x[2]
  141. nf.Pass.Value = x[3]
  142. nf.FlagID.Value = x[4]
  143. nf.ShipColor1.Value = BrickColor.new(x[5])
  144. nf.ShipColor2.Value = BrickColor.new(x[6])
  145. nf.Allies.Value = x[7]
  146. nf.Enemies.Value = x[8]
  147. end
  148. else -- no crew
  149. savefolder.Crew.Value = ""
  150. end
  151. end
  152. end
  153. local stopsaving = false
  154. local thisguylogged = false
  155. function onPlayerRemoving(player)
  156. local playerfolder = folders:FindFirstChild(player.Name)
  157. if (player ~= nil) then
  158. if player:FindFirstChild('MusicDB') ~= nil then
  159. if game.Players:FindFirstChild(player:FindFirstChild('MusicDB').Value.Name) then
  160. killer = player:FindFirstChild('MusicDB').Value.Name
  161. killerfolder = folders:FindFirstChild(killer)
  162. thisguylogged = true
  163. end
  164. elseif player:FindFirstChild('MusicDB') == nil then
  165. thisguylogged = false
  166. end
  167. if playerfolder ~= nil then
  168.  
  169. if thisguylogged == true then
  170. handleKillCount(killer,player)
  171. Message(player.name.." has logged while fighting "..killer)
  172. end
  173. end
  174. saveData(player, playerfolder, false)
  175. playerfolder:Destroy()
  176. g = folders2:GetChildren()
  177. for d= 1, #g do
  178. am = 0
  179. thecrew = g[d].Name
  180. z = folders:GetChildren()
  181. for i= 1, #z do
  182. if z[i].Crew.Value == thecrew then -- players still in crew
  183. am = am + 1
  184. end
  185. end
  186.  
  187. if am == 0 then --nobody still in crew lef
  188. folders2[thecrew]:Destroy()
  189. z = game.Workspace.Claim:GetChildren()
  190. for i= 1, #z do
  191. if z[i]:findFirstChild("Faction") and z[i].Faction.Value == thecrew then
  192. z[i].Wave.BrickColor = BrickColor.new("White")
  193. z[i].Faction.Value = ""
  194. z[i].Wave.Claimable.Visible = false
  195. end
  196. end
  197. end
  198. end
  199. if game.Workspace:findFirstChild("Barriers") then
  200. z = game.Workspace.Barriers:GetChildren()
  201. for i= 1, #z do
  202. if z[i]:findFirstChild("creator") and z[i].creator.Value == player or z[i].creator.Value == nil then
  203. z[i]:Destroy()
  204. end
  205. end
  206. end
  207. end
  208. end
  209. game:BindToClose(function()
  210. stopsaving = true
  211. for _,player in pairs(game.Players:GetPlayers()) do
  212. local playerfolder = folders:FindFirstChild(player.Name)
  213. if playerfolder then
  214. saveData(player, playerfolder, false)
  215. playerfolder:Destroy()
  216. end
  217. end
  218. wait(5)
  219. end)
  220.  
  221. spawn(function()
  222. repeat wait(60)
  223. for _,player in pairs(game.Players:GetPlayers()) do
  224. local playerfolder = folders:FindFirstChild(player.Name)
  225. if playerfolder then
  226. saveData(player, playerfolder, false)
  227. end
  228. end
  229. print("Auto Saved")
  230. until stopsaving
  231. end)
  232.  
  233. game.Players.PlayerAdded:connect(onPlayerEntered)
  234. game.Players.PlayerRemoving:connect(onPlayerRemoving)
  235.  
  236. -- Logging Bounty/Gold Giver
  237.  
  238. local HEALTH_BONUS_ON = true
  239. local HEALTH_BONUS_Pirate = 2 -- How much it divides by, so here it's 1/(2), which is +50%
  240. local HEALTH_BONUS_Marine = 3 -- 1/(3), +33%
  241.  
  242. function crewdeath(play)
  243. if folders:findFirstChild(play.Name) then
  244. local dafold = folders:findFirstChild(play.Name)
  245. if dafold:findFirstChild("Crew") then
  246. if folders2:findFirstChild(dafold.Crew.Value) then
  247. --they have a crew yay
  248. local newt = Instance.new("ObjectValue")
  249. newt.Name = play.Name
  250. newt.Value = game.Players:findFirstChild(play.Name)
  251. newt.Parent = game.ServerScriptService.RFEDS.DeathCount
  252. --print("Tag added")
  253. end
  254. end
  255. end
  256. end
  257.  
  258. function findOutIfBoosting(kfolder, name)
  259. local list = kfolder:FindFirstChild("HasKilledList")
  260. local conclusion = false
  261. if list ~= nil then
  262. if list:FindFirstChild(name) then
  263. conclusion = true
  264. end
  265. end
  266. return conclusion
  267. end
  268.  
  269. function addtoKilledList(kfolder, victim, timeamount)
  270. local list = kfolder:FindFirstChild("HasKilledList")
  271. if list == nil then
  272. list = Instance.new("Model")
  273. list.Name = "HasKilledList"
  274. list.Parent = kfolder
  275. end
  276. local storename = Instance.new("IntValue")
  277. storename.Name = victim.Name
  278. storename.Value = timeamount
  279. local new_script = script:FindFirstChild("KillList_Script"):clone()
  280. new_script.Parent = storename
  281. storename.Parent = list
  282. new_script.Disabled = false
  283. end
  284.  
  285.  
  286. function healthBonus(killer, divideby) -- Bonus health from killing someone else
  287. if HEALTH_BONUS_ON then
  288. if killer.Character ~= nil then
  289. local k_hum = killer.Character:FindFirstChild("Humanoid")
  290. if k_hum then
  291. if k_hum.Health > 0 and k_hum:FindFirstChild("Effects") then
  292. if not k_hum:FindFirstChild("Effects"):FindFirstChild("KillBonusHealth") then
  293. local orighealth = k_hum.Health
  294. local addhealth = k_hum.MaxHealth/divideby
  295. local totaladded = addhealth
  296.  
  297. local killbonuseffect = Instance.new("BoolValue")
  298. killbonuseffect.Name = "KillBonusHealth"
  299. killbonuseffect.Parent = k_hum:FindFirstChild("Effects")
  300. game.Debris:AddItem(killbonuseffect, 1)
  301.  
  302. if (k_hum.Health + addhealth) > k_hum.MaxHealth then
  303. totaladded = k_hum.MaxHealth - orighealth
  304. k_hum.Health = k_hum.MaxHealth
  305. else
  306. totaladded = addhealth
  307. k_hum.Health = orighealth + addhealth
  308. end
  309.  
  310. if killer:FindFirstChild("PlayerGui") then -- GUI Effect
  311. local pgui = killer:FindFirstChild("PlayerGui")
  312. if pgui:FindFirstChild("HUD") then
  313. local healthgui = pgui:FindFirstChild("HUD"):FindFirstChild("Health")
  314. if healthgui then
  315. local addedhealthamount = healthgui:FindFirstChild("AddedHealthAmount")
  316. if addedhealthamount ~= nil then
  317. addedhealthamount.Value = totaladded
  318. end
  319. end
  320. end
  321. end
  322. end
  323. end
  324. end
  325. end
  326. end
  327. end
  328.  
  329. -------- [[ Handle Kill Section ]] --------
  330.  
  331. function handlePirateKillPirate(vbeli, vbounty, kbeli, kbounty, vfolder) --< Pirate Kills Pirate
  332.  
  333. local jail = vfolder:FindFirstChild("IsInJail")
  334. if jail ~= nil then
  335. if jail.Value == true then
  336. jail.Value = false
  337. end
  338. end
  339.  
  340. local amount = vbeli.Value
  341. kbeli.Value = kbeli.Value + amount*0.7
  342. if vbounty.Value > kbounty.Value and vbounty.Value >= 5 then
  343. kbounty.Value = kbounty.Value + 100
  344. vbounty.Value = vbounty.Value - 50
  345. else
  346. kbounty.Value = kbounty.Value + 50
  347. end
  348. vbeli.Value = amount*0.25
  349. end
  350.  
  351. function handlePirateKillMarine(vbeli, vbounty, kbeli, kbounty) --< Pirate Kills Marine
  352. local amount = vbeli.Value
  353. kbeli.Value = kbeli.Value + amount*0.7
  354. kbounty.Value = kbounty.Value + 150
  355. vbounty.Value = math.min(vbounty.Value + 50,-1)
  356. vbeli.Value = amount*0.25
  357. end
  358.  
  359. function handleMarineKillPirate(vbeli, vbounty, kbeli, kbounty, victim, vfolder, killer) --< Marine Kills Pirate
  360. local jail = vfolder:FindFirstChild("IsInJail")
  361. local stopmkp = false
  362. if jail ~= nil then
  363. if jail.Value == true then
  364. stopmkp = true
  365. end
  366. if vbounty.Value > 50 then
  367. jail.Value = true
  368. elseif vbounty.Value <= 50 then
  369. jail.Value = false
  370. stopmkp = true
  371. end
  372. end
  373. if vbounty.Value <= 50 and vbounty.Value >= 0 then -- civilian killed
  374. vbounty.Value = vbounty.Value + 5
  375. kbounty.Value = math.min(kbounty.Value + 50,-1)
  376. jail.Value = false
  377. end
  378. if not stopmkp then
  379. local amount = vbeli.Value
  380. local bamount = vbounty.Value
  381. if vbounty.Value <= 5 then
  382. vbounty.Value = 0
  383. elseif vbounty.Value <= 9000 then
  384. vbounty.Value = vbounty.Value - (vbounty.Value/5)
  385. kbounty.Value = kbounty.Value - 100
  386. elseif vbounty.Value > 9000 then
  387. vbounty.Value = vbounty.Value - 3000
  388. kbounty.Value = kbounty.Value - 150
  389. end
  390. kbeli.Value = kbeli.Value + amount/2 + (bamount - vbounty.Value)*1
  391. vbeli.Value = vbeli.Value - ((amount/2) * 1.3)
  392. end
  393. end
  394.  
  395. function handleMarineKillMarine(kbounty, killer, kclass, kfolder) --< Marine Kills Marine (Team kill)
  396. local kchar = killer.Character
  397. if (kchar ~= nil) then
  398. local hum = kchar:FindFirstChild("Humanoid")
  399. if (hum ~= nil) then
  400. hum.Health = 0
  401. end
  402. end
  403. if kbounty.Value >= -2 then
  404. kbounty.Value = 1
  405. kclass.Value = "Pirate"
  406. local jail = kfolder:FindFirstChild("IsInJail")
  407. if jail ~= nil then
  408. jail.Value = true
  409. end
  410. end
  411. if kclass.Value ~= "Pirate" then
  412. if kbounty.Value < -5 then
  413. kbounty.Value = kbounty.Value + 5
  414. else
  415. kbounty.Value = -1
  416. end
  417. end
  418. end
  419. -------------------------------------------
  420.  
  421.  
  422.  
  423. function handleKillCount(killerplayer, victim)
  424. local killer = game:GetService("Players"):FindFirstChild(killerplayer)
  425. if (killer ~= nil) then
  426. if killer == victim then return end
  427. local kfolder = folders:FindFirstChild(killer.Name)
  428. if kfolder == nil then return end
  429. local vfolder = folders:FindFirstChild(victim.Name)
  430. if vfolder == nil then return end
  431. local kclass = kfolder:findFirstChild("Class") --< Killer's Class
  432. if (kclass == nil) then return end
  433. local vclass = vfolder:findFirstChild("Class") --< Victim's Class
  434. if (vclass == nil) then return end
  435.  
  436. local vbeli = vfolder:FindFirstChild("Gold") --< Victim's Beli
  437. if (vbeli == nil) then return end
  438. local kbeli = kfolder:FindFirstChild("Gold") --< Killer's Beli
  439. if (kbeli == nil) then return end
  440.  
  441. local vbounty = vfolder:FindFirstChild(".Bounty658") --< Victim's Bounty
  442. if (vbounty == nil) then return end
  443. local kbounty = kfolder:FindFirstChild(".Bounty658") --< Killer's Bounty
  444. if (kbounty == nil) then return end
  445.  
  446. local isboosting = findOutIfBoosting(kfolder, victim.Name)
  447.  
  448. crewdeath(victim) -- died from an enemy
  449.  
  450. if kclass.Value ~= "Marine" then
  451. healthBonus(killer, HEALTH_BONUS_Pirate)
  452. if vclass.Value ~= "Marine" then
  453. if isboosting then return end
  454. handlePirateKillPirate(vbeli, vbounty, kbeli, kbounty, vfolder)
  455. addtoKilledList(kfolder, victim, 4)
  456. elseif vclass.Value == "Marine" then
  457. if isboosting then return end
  458. handlePirateKillMarine(vbeli, vbounty, kbeli, kbounty)
  459. addtoKilledList(kfolder, victim, 6)
  460. end
  461. elseif kclass.Value == "Marine" then
  462. if vclass.Value ~= "Marine" then
  463. if isboosting then return end
  464. healthBonus(killer, HEALTH_BONUS_Marine)
  465. handleMarineKillPirate(vbeli, vbounty, kbeli, kbounty, victim, vfolder, killer)
  466. addtoKilledList(kfolder, victim, 10)
  467. elseif vclass.Value == "Marine" then
  468. handleMarineKillMarine(kbounty, killer, kclass, kfolder)
  469. end
  470. end
  471. end
  472. end
Advertisement
Add Comment
Please, Sign In to add comment