%lZZlLfOvSRCAOR1B4ORtqDDjCcTpfHM6dcBlfr5slwnE1rLawF1oxlpvOUs97bFOAOZyGZh4L6TUuQw3L6rlJxpe+YL2dpqADRQIzOJ/WRad2OfmZ9JJPk4zlP3NTS46NcWEJ5JmY52mGtFo1r4WTx6sifv3QvK+vul3pzwyixo=% local placeId, port, sleeptime, access, url, killID, deathID, timeout = ... local assetId = placeId pcall(function() game:GetService("BadgeService"):SetBaseUrl("http://www.roblox.com/") end) pcall(function() game:GetService("BadgeService"):SetPlaceId(placeId) end) pcall(function() game:GetService("BadgeService"):SetAccessKey(access) end) pcall(function() settings().Diagnostics:SetBlockingRemove(false) end) settings().Diagnostics.LuaRamLimit = 0 shared["__time"] = 0 game:GetService("RunService").Stepped:connect(function (time) shared["__time"] = time end) pcall(function() game:GetService("ContentProvider"):SetAssetUrl("http://www.roblox.com/Asset/") end) pcall(function() settings().Diagnostics:LegacyScriptMode() end) --settings().Network.SendRate = 35 settings().Network.PhysicsSend = 1 -- 1==RoundRobin --settings().Network.PhysicsSend = 0 -- 1==RoundRobin settings().Network.WaitingForCharacterLogRate = 100 settings().Network.ExperimentalPhysicsEnabled = true pcall(function() if access then loadfile("http://www.roblox.com/game/PlaceSpecificScript.ashx?PlaceId=" .. placeId .. "&" .. access)() end end) -- this has to be a pcall because it won't work for local players pcall(function() game:GetService("Players"):SetChatFilterUrl("http://www.roblox.com/Game/ChatFilter.ashx") end) pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) if true then delay(1 * 60, function() local lastSuccessCount = -1 local lastFailureCount = -1 while true do local successCount = settings().Diagnostics.CdnSuccessCount local failureCount = settings().Diagnostics.CdnFailureCount if successCount ~= lastSuccessCount or failureCount ~= lastFailureCount then local delta = failureCount - lastFailureCount if lastFailureCount == -1 then delta = 0 end game:HttpGet("http://app1.roblox.com/Game/Cdn.ashx?success=" .. successCount .. "&failure=" .. failureCount .. "&delta=" .. delta, false) lastSuccessCount, lastFailureCount = successCount, failureCount end wait(10 * 60) end end) end --delay(1, function() -- loadfile("http://www.roblox.com/analytics/GamePerfMonitor.ashx")(game.JobId, placeId) --end) ------------------- UTILITY FUNCTIONS -------------------------- function waitForChild(parent, childName) while true do local child = parent:findFirstChild(childName) if child then return child end parent.ChildAdded:wait() end end -- returns the player object that killed this humanoid -- returns nil if the killer is no longer in the game function getKillerOfHumanoidIfStillInGame(humanoid) -- check for kill tag on humanoid - may be more than one - todo: deal with this local tag = humanoid:findFirstChild("creator") -- find player with name on tag if tag then local killer = tag.Value if killer.Parent then -- killer still in game return killer end end return nil end -- This code might move to C++ function characterRessurection(player) if player.Character then local humanoid = player.Character.Humanoid humanoid.Died:connect(function() wait(5) player:LoadCharacter() end) end end -- send kill and death stats when a player dies function onDied(victim, humanoid) local killer = getKillerOfHumanoidIfStillInGame(humanoid) local victorId = 0 if killer then victorId = killer.userId print("STAT: kill by " .. victorId .. " of " .. victim.userId) game:HttpGet(url .. "/Game/Statistics.ashx?TypeID=" .. killID .. "&UserID=" .. victorId .. "&AssociatedCreatorType=User&AssociatedCreatorID=" .. victim.userId .. "&AssociatedPlaceID=" .. placeId) end print("STAT: death of " .. victim.userId .. " by " .. victorId) game:HttpGet(url .. "/Game/Statistics.ashx?TypeID=" .. deathID .. "&UserID=" .. victim.userId .. "&AssociatedCreatorType=User&AssociatedCreatorID=" .. victorId .. "&AssociatedPlaceID=" .. placeId) end -----------------------------------END UTILITY FUNCTIONS ------------------------- -----------------------------------START GAME SHARED SCRIPT------------------------------ local placeId, port, sleeptime, access, url, killID, deathID, timeout = ... local scriptContext = game:GetService('ScriptContext') scriptContext.ScriptsDisabled = true game:GetService("ChangeHistoryService"):SetEnabled(false) -- establish this peer as the Server local ns = game:GetService("NetworkServer") if url~=nil then game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end if placeId~=nil and killID~=nil and deathID~=nil and url~=nil then -- listen for the death of a Player function createDeathMonitor(player) -- we don't need to clean up old monitors or connections since the Character will be destroyed soon if player.Character then local humanoid = waitForChild(player.Character, "Humanoid") humanoid.Died:connect( function () onDied(player, humanoid) end ) end end -- listen to all Players' Characters game:GetService("Players").ChildAdded:connect( function (player) createDeathMonitor(player) player.Changed:connect( function (property) if property=="Character" then createDeathMonitor(player) end end ) end ) end game:GetService("Players").PlayerAdded:connect(function(player) print("Player " .. player.userId .. " added") characterRessurection(player) player.Changed:connect(function(name) if name=="Character" then characterRessurection(player) end end) end) if placeId~=nil and url~=nil and access~=nil then -- yield so that file load happens in the heartbeat thread wait() -- load the game game:Load(url .. "/asset/?id=" .. placeId .. "&" .. access) end -- Now start the connection ns:Start(port, sleeptime) if timeout then scriptContext:SetTimeout(timeout) end scriptContext.ScriptsDisabled = false ------------------------------END START GAME SHARED SCRIPT---------------------------- THIS BLANK SPACE IS VERY NECESSARY game:GetService("RunService"):Run()