Update gameserver.php
This commit is contained in:
parent
2bc73cb5b2
commit
4fe6cec9fa
|
|
@ -7,77 +7,174 @@ $rbxl = addslashes($_GET["rbxl"]);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
game:Load('rbxasset://<?php echo $rbxl; ?>')
|
-- Start Game Script Arguments
|
||||||
local assetPropertyNames = {"Texture", "TextureId", "SoundId", "MeshId", "SkyboxUp", "SkyboxLf", "SkyboxBk", "SkyboxRt", "SkyboxFt", "SkyboxDn", "PantsTemplate", "ShirtTemplate", "Graphic", "Frame", "ImageLabel", "GuiMain", "Image", "LinkedSource", "AnimationId"}
|
|
||||||
local variations = {"http://www%.roblox%.com/asset/%?id=", "http://www%.roblox%.com/asset%?id=", "http://%.roblox%.com/asset/%?id=", "http://%.roblox%.com/asset%?id="}
|
|
||||||
|
|
||||||
function GetDescendants(o)
|
------------------- UTILITY FUNCTIONS --------------------------
|
||||||
local allObjects = {}
|
|
||||||
function FindChildren(Object)
|
|
||||||
for _,v in pairs(Object:GetChildren()) do
|
|
||||||
table.insert(allObjects,v)
|
|
||||||
FindChildren(v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
FindChildren(o)
|
|
||||||
return allObjects
|
|
||||||
end
|
|
||||||
|
|
||||||
local replacedProperties = 0--Amount of properties changed
|
local cdnSuccess = 0
|
||||||
|
local cdnFailure = 0
|
||||||
|
|
||||||
for i, v in pairs(GetDescendants(game)) do
|
function waitForChild(parent, childName)
|
||||||
for _, property in pairs(assetPropertyNames) do
|
while true do
|
||||||
pcall(function()
|
local child = parent:findFirstChild(childName)
|
||||||
if v[property] and not v:FindFirstChild(property) then --Check for property, make sure we're not getting a child instead of a property
|
if child then
|
||||||
assetText = string.lower(v[property])
|
return child
|
||||||
for _, variation in pairs(variations) do
|
end
|
||||||
v[property], matches = string.gsub(assetText, variation, "http://www%.morblox%.us/asset/%?id=")
|
parent.ChildAdded:wait()
|
||||||
if matches > 0 then
|
|
||||||
replacedProperties = replacedProperties + 1
|
|
||||||
print("Replaced " .. property .. " asset link for " .. v.Name)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print("DONE! Replaced " .. replacedProperties .. " properties")
|
-- returns the player object that killed this humanoid
|
||||||
game:GetService("NetworkServer"):Start(<?php echo $port; ?>)
|
-- returns nil if the killer is no longer in the game
|
||||||
game:GetService("RunService"):Run()
|
function getKillerOfHumanoidIfStillInGame(humanoid)
|
||||||
game.Lighting.GlobalShadows = true
|
|
||||||
game.Players.PlayerAdded:connect(function(plr)
|
-- check for kill tag on humanoid - may be more than one - todo: deal with this
|
||||||
Player.Changed:connect(function(Property)
|
local tag = humanoid:findFirstChild("creator")
|
||||||
if (Property=="Character") and (Player.Character~=nil) then
|
|
||||||
local Character=Player.Character
|
-- find player with name on tag
|
||||||
local Humanoid=Character:FindFirstChild("Humanoid")
|
if tag then
|
||||||
if (Humanoid~=nil) then
|
local killer = tag.Value
|
||||||
Humanoid.Died:connect(function() delay(RespawnTime,function() Player:LoadCharacter() LoadCharacterNew(newWaitForChild(Player,"Appearance"),Player.Character,Player.Backpack) end) end)
|
if killer.Parent then -- killer still in game
|
||||||
|
return killer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
-----------------------------------END UTILITY FUNCTIONS -------------------------
|
||||||
|
|
||||||
|
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
|
||||||
|
|
||||||
|
pcall(function() settings().Network.UseInstancePacketCache = true end)
|
||||||
|
pcall(function() settings().Network.UsePhysicsPacketCache = true end)
|
||||||
|
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end)
|
||||||
|
|
||||||
|
|
||||||
|
settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors
|
||||||
|
settings().Network.ExperimentalPhysicsEnabled = true
|
||||||
|
settings().Network.WaitingForCharacterLogRate = 100
|
||||||
|
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
||||||
|
|
||||||
|
-----------------------------------START GAME SHARED SCRIPT------------------------------
|
||||||
|
|
||||||
|
-- establish this peer as the Server
|
||||||
|
local ns = game:GetService("NetworkServer")
|
||||||
|
|
||||||
|
local badgeUrlFlagExists, badgeUrlFlagValue = pcall(function () return settings():GetFFlag("NewBadgeServiceUrlEnabled") end)
|
||||||
|
local newBadgeUrlEnabled = badgeUrlFlagExists and badgeUrlFlagValue
|
||||||
|
if url~=nil then
|
||||||
|
local url = "http://www.morblox.us"
|
||||||
|
|
||||||
|
pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end)
|
||||||
|
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(url .. "/Asset/") end)
|
||||||
|
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end)
|
||||||
|
pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end)
|
||||||
|
|
||||||
|
if gameCode then
|
||||||
|
game:SetVIPServerId(tostring(gameCode))
|
||||||
|
end
|
||||||
|
|
||||||
|
game:GetService("BadgeService"):SetPlaceId(1818)
|
||||||
|
game:SetPlaceId(1818)
|
||||||
|
game:SetCreatorId(123891239128398123)
|
||||||
|
|
||||||
|
|
||||||
|
if newBadgeUrlEnabled then
|
||||||
|
game:GetService("BadgeService"):SetAwardBadgeUrl(apiProxyUrl .. "/assets/award-badge?userId=%d&badgeId=%d&placeId=%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
if access~=nil then
|
||||||
|
if not newBadgeUrlEnabled then
|
||||||
|
game:GetService("BadgeService"):SetAwardBadgeUrl(url .. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&" .. access)
|
||||||
|
end
|
||||||
|
|
||||||
|
game:GetService("BadgeService"):SetHasBadgeUrl(url .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&" .. access)
|
||||||
|
game:GetService("BadgeService"):SetIsBadgeDisabledUrl(url .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&" .. access)
|
||||||
|
|
||||||
|
game:GetService("FriendService"):SetMakeFriendUrl(url .. "/Game/CreateFriend?firstUserId=%d&secondUserId=%d")
|
||||||
|
game:GetService("FriendService"):SetBreakFriendUrl(url .. "/Game/BreakFriend?firstUserId=%d&secondUserId=%d")
|
||||||
|
game:GetService("FriendService"):SetGetFriendsUrl(url .. "/Game/AreFriends?userId=%d")
|
||||||
|
end
|
||||||
|
game:GetService("BadgeService"):SetIsBadgeLegalUrl("")
|
||||||
|
game:GetService("InsertService"):SetBaseSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base")
|
||||||
|
game:GetService("InsertService"):SetUserSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d")
|
||||||
|
game:GetService("InsertService"):SetCollectionUrl(url .. "/Game/Tools/InsertAsset.ashx?sid=%d")
|
||||||
|
game:GetService("InsertService"):SetAssetUrl(url .. "/Asset/?id=%d")
|
||||||
|
game:GetService("InsertService"):SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d")
|
||||||
|
|
||||||
|
pcall(function() loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
|
||||||
|
|
||||||
|
pcall(function()
|
||||||
|
if access then
|
||||||
|
loadfile(url .. "/Game/PlaceSpecificScript.ashx?PlaceId=" .. placeId .. "&" .. access)()
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
end)
|
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
|
||||||
game.Players.PlayerAdded:connect(onJoined)
|
settings().Diagnostics.LuaRamLimit = 0
|
||||||
game:GetService("NetworkServer"):Start(<?php echo $port; ?>)
|
|
||||||
game:GetService("RunService"):Run()
|
|
||||||
game.Lighting.GlobalShadows = true
|
|
||||||
game.Players.PlayerAdded:connect(function(plr)
|
if placeId~=nil and killID~=nil and deathID~=nil and url~=nil then
|
||||||
Player.Changed:connect(function(Property)
|
-- listen for the death of a Player
|
||||||
if (Property=="Character") and (Player.Character~=nil) then
|
function createDeathMonitor(player)
|
||||||
local Character=Player.Character
|
-- we don't need to clean up old monitors or connections since the Character will be destroyed soon
|
||||||
local Humanoid=Character:FindFirstChild("Humanoid")
|
if player.Character then
|
||||||
if (Humanoid~=nil) then
|
local humanoid = waitForChild(player.Character, "Humanoid")
|
||||||
Humanoid.Died:connect(function() delay(RespawnTime,function() Player:LoadCharacter() LoadCharacterNew(newWaitForChild(Player,"Appearance"),Player.Character,Player.Backpack) end) end)
|
humanoid.Died:connect(
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
game:GetService("Players").PlayerAdded:connect(function(player)
|
||||||
|
|
||||||
|
print("Player " .. player.userId .. " added")
|
||||||
|
|
||||||
|
if url and access and placeId and player and player.userId then
|
||||||
|
game:HttpGet(url .. "/Game/ClientPresence.ashx?action=connect&" .. access .. "&PlaceID=" .. placeId .. "&UserID=" .. player.userId)
|
||||||
|
game:HttpPost(url .. "/Game/PlaceVisit.ashx?UserID=" .. player.userId .. "&AssociatedPlaceID=" .. placeId .. "&" .. access, "")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
game:GetService("Players").PlayerRemoving:connect(function(player)
|
||||||
|
print("Player " .. player.userId .. " leaving")
|
||||||
|
|
||||||
|
if url and access and placeId and player and player.userId then
|
||||||
|
game:HttpGet(url .. "/Game/ClientPresence.ashx?action=disconnect&" .. access .. "&PlaceID=" .. placeId .. "&UserID=" .. player.userId)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
game.Players.PlayerAdded:connect(onJoined)
|
|
||||||
|
-- Now start the connection
|
||||||
|
game:Load("rbxasset://<?php echo $rbxl; ?>")
|
||||||
|
ns:Start(<?php echo $port; ?>, sleeptime)
|
||||||
|
pcall(function() game.LocalSaveEnabled = true end)
|
||||||
|
|
||||||
|
-- StartGame --
|
||||||
|
Game:GetService("RunService"):Run()
|
||||||
<?php
|
<?php
|
||||||
$data = ob_get_clean();
|
$data = ob_get_clean();
|
||||||
$signature;
|
$signature;
|
||||||
$key = file_get_contents("../GameRBLX/PrivKey.pem");
|
$key = file_get_contents("./PrivateKey.pem");
|
||||||
openssl_sign($data, $signature, $key, OPENSSL_ALGO_SHA1);
|
openssl_sign($data, $signature, $key, OPENSSL_ALGO_SHA1);
|
||||||
echo "" . sprintf("%%%s%%%s", base64_encode($signature), $data);
|
echo "" . sprintf("%%%s%%%s", base64_encode($signature), $data);
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue