Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- folders = game.ServerScriptService:FindFirstChild(".PlayerFolders")
- folders2 = game.ServerScriptService.Crews
- local webHook = require(script.Parent.WebhookAPI)
- local myWebHook = webHook.new("523684243767820288","cL_YLz6v2PLp8hZjBwbC19fbooOGrJy2xedktOQgSeOiBWJkdUDSSJLLLcFZk0uQA1s9")
- ignore = {"Invites", "Treasure", "Health", "MaxHealth"} -- things it should ignore
- DataStore = game:GetService("DataStoreService"):GetDataStore("DPODATANEW")
- DS = game:GetService("DataStoreService"):GetDataStore("DPOCREWSNEW")
- function loadData(player, playerfolder, tabler)
- z = playerfolder:GetChildren()
- for i= 1, #z do
- keyname = z[i].Name
- dataz = tabler[keyname]
- if dataz ~= nil then -- saved key\
- --print("Loaded", z[i].Name, tabler[keyname])
- --make a table
- z[i].Value = tabler[keyname]
- end
- end
- end
- function saveData(player, savefolderz, new)
- nt = {}
- z = savefolderz:GetChildren()
- t = 0
- for i= 1, #z do
- if z[i].Name ~= "" then --ignore list
- ignored = false
- for d= 1, #ignore do
- if z[i].Name == ignore[d] then
- ignored = true
- --print("Ignored", z[i].Name)
- end
- end
- 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
- keyname = z[i].Name
- nt[keyname] = z[i].Value
- t = t + 1
- -- print("Saved", z[i].Name, nt[keyname], "=", z[i].Value)
- end
- end
- end
- if t < 3 then return end
- if new == true then
- DataStore:SetAsync(player.Name, nt)
- else
- DataStore:UpdateAsync(player.Name, function(oldValue) return nt; end)
- end
- end
- function Message(message)
- if not game:GetService("RunService"):IsStudio() then
- local BotName = "OPOR"
- myWebHook:post{username = BotName,content = message}
- end
- end
- function onPlayerEntered(player)
- local savefolder = script.PlayerFolder:clone()
- savefolder.Name = player.Name
- savefolder.Parent = folders
- local leaderstats = Instance.new("IntValue")
- leaderstats.Name = "leaderstats"
- leaderstats.Parent = player
- local spn = Instance.new("ObjectValue")
- spn.Name = "SpawnChoice"
- --spn.Parent = player
- local Skill = Instance.new("StringValue")
- Skill.Name = "Skill"
- Skill.Parent = player
- local Use = Instance.new("BoolValue")
- Use.Name = "Use"
- Use.Parent = Skill
- local std = Instance.new("IntConstrainedValue")
- std.Name = "StomachDie"
- std.MaxValue = 200
- std.Parent = savefolder
- std.Value = 100
- local showbounty = Instance.new("IntValue")
- showbounty.Name = "Bounty"
- showbounty.Parent = leaderstats
- -- savefolder[".Bounty658"].BountyUpdate.Disabled = false
- local bountyen = Instance.new("BoolValue")
- bountyen.Name = "BountyEnabled"
- bountyen.Parent = player
- bountyen.Value = true
- local tabler = DataStore:GetAsync(player.Name)
- if tabler then -- player has datastore
- loadData(player, savefolder, tabler)
- else -- player has no datastore
- saveData(player, savefolder, true)
- end
- savefolder.BusoPoints.Script.Disabled = false
- savefolder.HaoPoints.Script.Disabled = false
- savefolder.KenPoints.Script.Disabled = false
- if savefolder:FindFirstChild("Banned") and savefolder:FindFirstChild("Banned").Value == true then
- player:Kick("You are banned. BCode:41")
- end
- wait()
- local HaoSound = savefolder:FindFirstChild("HaoS")
- if HaoSound and HaoSound.Value == 0 then
- math.randomseed(tick())
- local random = math.random(1,3)
- HaoSound.Value = random
- end
- if not savefolder:findFirstChild("Crew") then
- local zcrew = Instance.new("StringValue")
- zcrew.Name = "Crew"
- zcrew.Parent = savefolder
- end
- if savefolder.Crew.Value ~= "" and not game.ServerScriptService.Crews:findFirstChild(savefolder.Crew.Value) then
- local x = DS:GetAsync(savefolder.Crew.Value)
- if x ~= nil then -- if there is a crew of that name
- if x[2] ~= "" then -- check for a cpt.
- else
- savefolder.Crew.Value = "" -- remove em from the crew
- end
- if game.ServerScriptService.Crews:findFirstChild(x[1]) then
- else
- local nf = game.ServerScriptService.RFEDS.CrewFolder:clone()
- nf.Parent = game.ServerScriptService.Crews
- nf.Name = x[1]
- nf.Title.Value = x[1]
- nf.Cpt.Value = x[2]
- nf.Pass.Value = x[3]
- nf.FlagID.Value = x[4]
- nf.ShipColor1.Value = BrickColor.new(x[5])
- nf.ShipColor2.Value = BrickColor.new(x[6])
- nf.Allies.Value = x[7]
- nf.Enemies.Value = x[8]
- end
- else -- no crew
- savefolder.Crew.Value = ""
- end
- end
- end
- local stopsaving = false
- local thisguylogged = false
- function onPlayerRemoving(player)
- local playerfolder = folders:FindFirstChild(player.Name)
- if (player ~= nil) then
- if player:FindFirstChild('MusicDB') ~= nil then
- if game.Players:FindFirstChild(player:FindFirstChild('MusicDB').Value.Name) then
- killer = player:FindFirstChild('MusicDB').Value.Name
- killerfolder = folders:FindFirstChild(killer)
- thisguylogged = true
- end
- elseif player:FindFirstChild('MusicDB') == nil then
- thisguylogged = false
- end
- if playerfolder ~= nil then
- if thisguylogged == true then
- handleKillCount(killer,player)
- Message(player.name.." has logged while fighting "..killer)
- end
- end
- saveData(player, playerfolder, false)
- playerfolder:Destroy()
- g = folders2:GetChildren()
- for d= 1, #g do
- am = 0
- thecrew = g[d].Name
- z = folders:GetChildren()
- for i= 1, #z do
- if z[i].Crew.Value == thecrew then -- players still in crew
- am = am + 1
- end
- end
- if am == 0 then --nobody still in crew lef
- folders2[thecrew]:Destroy()
- z = game.Workspace.Claim:GetChildren()
- for i= 1, #z do
- if z[i]:findFirstChild("Faction") and z[i].Faction.Value == thecrew then
- z[i].Wave.BrickColor = BrickColor.new("White")
- z[i].Faction.Value = ""
- z[i].Wave.Claimable.Visible = false
- end
- end
- end
- end
- if game.Workspace:findFirstChild("Barriers") then
- z = game.Workspace.Barriers:GetChildren()
- for i= 1, #z do
- if z[i]:findFirstChild("creator") and z[i].creator.Value == player or z[i].creator.Value == nil then
- z[i]:Destroy()
- end
- end
- end
- end
- end
- game:BindToClose(function()
- stopsaving = true
- for _,player in pairs(game.Players:GetPlayers()) do
- local playerfolder = folders:FindFirstChild(player.Name)
- if playerfolder then
- saveData(player, playerfolder, false)
- playerfolder:Destroy()
- end
- end
- wait(5)
- end)
- spawn(function()
- repeat wait(60)
- for _,player in pairs(game.Players:GetPlayers()) do
- local playerfolder = folders:FindFirstChild(player.Name)
- if playerfolder then
- saveData(player, playerfolder, false)
- end
- end
- print("Auto Saved")
- until stopsaving
- end)
- game.Players.PlayerAdded:connect(onPlayerEntered)
- game.Players.PlayerRemoving:connect(onPlayerRemoving)
- -- Logging Bounty/Gold Giver
- local HEALTH_BONUS_ON = true
- local HEALTH_BONUS_Pirate = 2 -- How much it divides by, so here it's 1/(2), which is +50%
- local HEALTH_BONUS_Marine = 3 -- 1/(3), +33%
- function crewdeath(play)
- if folders:findFirstChild(play.Name) then
- local dafold = folders:findFirstChild(play.Name)
- if dafold:findFirstChild("Crew") then
- if folders2:findFirstChild(dafold.Crew.Value) then
- --they have a crew yay
- local newt = Instance.new("ObjectValue")
- newt.Name = play.Name
- newt.Value = game.Players:findFirstChild(play.Name)
- newt.Parent = game.ServerScriptService.RFEDS.DeathCount
- --print("Tag added")
- end
- end
- end
- end
- function findOutIfBoosting(kfolder, name)
- local list = kfolder:FindFirstChild("HasKilledList")
- local conclusion = false
- if list ~= nil then
- if list:FindFirstChild(name) then
- conclusion = true
- end
- end
- return conclusion
- end
- function addtoKilledList(kfolder, victim, timeamount)
- local list = kfolder:FindFirstChild("HasKilledList")
- if list == nil then
- list = Instance.new("Model")
- list.Name = "HasKilledList"
- list.Parent = kfolder
- end
- local storename = Instance.new("IntValue")
- storename.Name = victim.Name
- storename.Value = timeamount
- local new_script = script:FindFirstChild("KillList_Script"):clone()
- new_script.Parent = storename
- storename.Parent = list
- new_script.Disabled = false
- end
- function healthBonus(killer, divideby) -- Bonus health from killing someone else
- if HEALTH_BONUS_ON then
- if killer.Character ~= nil then
- local k_hum = killer.Character:FindFirstChild("Humanoid")
- if k_hum then
- if k_hum.Health > 0 and k_hum:FindFirstChild("Effects") then
- if not k_hum:FindFirstChild("Effects"):FindFirstChild("KillBonusHealth") then
- local orighealth = k_hum.Health
- local addhealth = k_hum.MaxHealth/divideby
- local totaladded = addhealth
- local killbonuseffect = Instance.new("BoolValue")
- killbonuseffect.Name = "KillBonusHealth"
- killbonuseffect.Parent = k_hum:FindFirstChild("Effects")
- game.Debris:AddItem(killbonuseffect, 1)
- if (k_hum.Health + addhealth) > k_hum.MaxHealth then
- totaladded = k_hum.MaxHealth - orighealth
- k_hum.Health = k_hum.MaxHealth
- else
- totaladded = addhealth
- k_hum.Health = orighealth + addhealth
- end
- if killer:FindFirstChild("PlayerGui") then -- GUI Effect
- local pgui = killer:FindFirstChild("PlayerGui")
- if pgui:FindFirstChild("HUD") then
- local healthgui = pgui:FindFirstChild("HUD"):FindFirstChild("Health")
- if healthgui then
- local addedhealthamount = healthgui:FindFirstChild("AddedHealthAmount")
- if addedhealthamount ~= nil then
- addedhealthamount.Value = totaladded
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- -------- [[ Handle Kill Section ]] --------
- function handlePirateKillPirate(vbeli, vbounty, kbeli, kbounty, vfolder) --< Pirate Kills Pirate
- local jail = vfolder:FindFirstChild("IsInJail")
- if jail ~= nil then
- if jail.Value == true then
- jail.Value = false
- end
- end
- local amount = vbeli.Value
- kbeli.Value = kbeli.Value + amount*0.7
- if vbounty.Value > kbounty.Value and vbounty.Value >= 5 then
- kbounty.Value = kbounty.Value + 100
- vbounty.Value = vbounty.Value - 50
- else
- kbounty.Value = kbounty.Value + 50
- end
- vbeli.Value = amount*0.25
- end
- function handlePirateKillMarine(vbeli, vbounty, kbeli, kbounty) --< Pirate Kills Marine
- local amount = vbeli.Value
- kbeli.Value = kbeli.Value + amount*0.7
- kbounty.Value = kbounty.Value + 150
- vbounty.Value = math.min(vbounty.Value + 50,-1)
- vbeli.Value = amount*0.25
- end
- function handleMarineKillPirate(vbeli, vbounty, kbeli, kbounty, victim, vfolder, killer) --< Marine Kills Pirate
- local jail = vfolder:FindFirstChild("IsInJail")
- local stopmkp = false
- if jail ~= nil then
- if jail.Value == true then
- stopmkp = true
- end
- if vbounty.Value > 50 then
- jail.Value = true
- elseif vbounty.Value <= 50 then
- jail.Value = false
- stopmkp = true
- end
- end
- if vbounty.Value <= 50 and vbounty.Value >= 0 then -- civilian killed
- vbounty.Value = vbounty.Value + 5
- kbounty.Value = math.min(kbounty.Value + 50,-1)
- jail.Value = false
- end
- if not stopmkp then
- local amount = vbeli.Value
- local bamount = vbounty.Value
- if vbounty.Value <= 5 then
- vbounty.Value = 0
- elseif vbounty.Value <= 9000 then
- vbounty.Value = vbounty.Value - (vbounty.Value/5)
- kbounty.Value = kbounty.Value - 100
- elseif vbounty.Value > 9000 then
- vbounty.Value = vbounty.Value - 3000
- kbounty.Value = kbounty.Value - 150
- end
- kbeli.Value = kbeli.Value + amount/2 + (bamount - vbounty.Value)*1
- vbeli.Value = vbeli.Value - ((amount/2) * 1.3)
- end
- end
- function handleMarineKillMarine(kbounty, killer, kclass, kfolder) --< Marine Kills Marine (Team kill)
- local kchar = killer.Character
- if (kchar ~= nil) then
- local hum = kchar:FindFirstChild("Humanoid")
- if (hum ~= nil) then
- hum.Health = 0
- end
- end
- if kbounty.Value >= -2 then
- kbounty.Value = 1
- kclass.Value = "Pirate"
- local jail = kfolder:FindFirstChild("IsInJail")
- if jail ~= nil then
- jail.Value = true
- end
- end
- if kclass.Value ~= "Pirate" then
- if kbounty.Value < -5 then
- kbounty.Value = kbounty.Value + 5
- else
- kbounty.Value = -1
- end
- end
- end
- -------------------------------------------
- function handleKillCount(killerplayer, victim)
- local killer = game:GetService("Players"):FindFirstChild(killerplayer)
- if (killer ~= nil) then
- if killer == victim then return end
- local kfolder = folders:FindFirstChild(killer.Name)
- if kfolder == nil then return end
- local vfolder = folders:FindFirstChild(victim.Name)
- if vfolder == nil then return end
- local kclass = kfolder:findFirstChild("Class") --< Killer's Class
- if (kclass == nil) then return end
- local vclass = vfolder:findFirstChild("Class") --< Victim's Class
- if (vclass == nil) then return end
- local vbeli = vfolder:FindFirstChild("Gold") --< Victim's Beli
- if (vbeli == nil) then return end
- local kbeli = kfolder:FindFirstChild("Gold") --< Killer's Beli
- if (kbeli == nil) then return end
- local vbounty = vfolder:FindFirstChild(".Bounty658") --< Victim's Bounty
- if (vbounty == nil) then return end
- local kbounty = kfolder:FindFirstChild(".Bounty658") --< Killer's Bounty
- if (kbounty == nil) then return end
- local isboosting = findOutIfBoosting(kfolder, victim.Name)
- crewdeath(victim) -- died from an enemy
- if kclass.Value ~= "Marine" then
- healthBonus(killer, HEALTH_BONUS_Pirate)
- if vclass.Value ~= "Marine" then
- if isboosting then return end
- handlePirateKillPirate(vbeli, vbounty, kbeli, kbounty, vfolder)
- addtoKilledList(kfolder, victim, 4)
- elseif vclass.Value == "Marine" then
- if isboosting then return end
- handlePirateKillMarine(vbeli, vbounty, kbeli, kbounty)
- addtoKilledList(kfolder, victim, 6)
- end
- elseif kclass.Value == "Marine" then
- if vclass.Value ~= "Marine" then
- if isboosting then return end
- healthBonus(killer, HEALTH_BONUS_Marine)
- handleMarineKillPirate(vbeli, vbounty, kbeli, kbounty, victim, vfolder, killer)
- addtoKilledList(kfolder, victim, 10)
- elseif vclass.Value == "Marine" then
- handleMarineKillMarine(kbounty, killer, kclass, kfolder)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment